1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.internal.telephony.uicc; 18 19 import android.annotation.IntDef; 20 21 import java.lang.annotation.Retention; 22 import java.lang.annotation.RetentionPolicy; 23 import java.util.List; 24 25 /** 26 * Represents the received ADN entries from the SIM. 27 * 28 * {@hide} 29 */ 30 public class ReceivedPhonebookRecords { 31 @PhonebookReceivedState 32 private int mPhonebookReceivedState; 33 private List<SimPhonebookRecord> mEntries; 34 35 @IntDef(value = { 36 RS_OK, 37 RS_ERROR, 38 RS_ABORT, 39 RS_FINAL 40 }) 41 @Retention(RetentionPolicy.SOURCE) 42 public @interface PhonebookReceivedState {} 43 44 public static final int RS_OK = 1; 45 public static final int RS_ERROR = 2; 46 public static final int RS_ABORT = 3; 47 public static final int RS_FINAL = 4; 48 ReceivedPhonebookRecords(@honebookReceivedState int state, List<SimPhonebookRecord> entries)49 public ReceivedPhonebookRecords(@PhonebookReceivedState int state, 50 List<SimPhonebookRecord> entries) { 51 mPhonebookReceivedState = state; 52 mEntries = entries; 53 } 54 isCompleted()55 public boolean isCompleted() { 56 return mPhonebookReceivedState == RS_FINAL; 57 } 58 isRetryNeeded()59 public boolean isRetryNeeded() { 60 return mPhonebookReceivedState == RS_ABORT; 61 } 62 isOk()63 public boolean isOk() { 64 return mPhonebookReceivedState == RS_OK; 65 } getPhonebookRecords()66 public List<SimPhonebookRecord> getPhonebookRecords() { 67 return mEntries; 68 } 69 } 70