1 /* 2 ** Copyright 2007, 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; 18 19 import android.content.ContentValues; 20 21 import com.android.internal.telephony.uicc.AdnCapacity; 22 import com.android.internal.telephony.uicc.AdnRecord; 23 24 /** 25 * Interface for applications to access the ICC phone book. 26 */ 27 interface IIccPhoneBook { 28 29 /** 30 * Loads the AdnRecords in efid and returns them as a 31 * List of AdnRecords 32 * 33 * @param efid the EF id of a ADN-like SIM 34 * @return List of AdnRecord 35 */ 36 @UnsupportedAppUsage getAdnRecordsInEf(int efid)37 List<AdnRecord> getAdnRecordsInEf(int efid); 38 39 /** 40 * Loads the AdnRecords in efid and returns them as a 41 * List of AdnRecords 42 * 43 * @param efid the EF id of a ADN-like SIM 44 * @param subId user preferred subId 45 * @return List of AdnRecord 46 */ 47 @UnsupportedAppUsage getAdnRecordsInEfForSubscriber(int subId, int efid)48 List<AdnRecord> getAdnRecordsInEfForSubscriber(int subId, int efid); 49 50 /** 51 * Replace oldAdn with newAdn in ADN-like record in EF 52 * 53 * getAdnRecordsInEf must be called at least once before this function, 54 * otherwise an error will be returned 55 * 56 * @param efid must be one among EF_ADN, EF_FDN, and EF_SDN 57 * @param oldTag adn tag to be replaced 58 * @param oldPhoneNumber adn number to be replaced 59 * Set both oldTag and oldPhoneNubmer to "" means to replace an 60 * empty record, aka, insert new record 61 * @param newTag adn tag to be stored 62 * @param newPhoneNumber adn number ot be stored 63 * Set both newTag and newPhoneNubmer to "" means to replace the old 64 * record with empty one, aka, delete old record 65 * @param pin2 required to update EF_FDN, otherwise must be null 66 * @return true for success 67 */ 68 @UnsupportedAppUsage updateAdnRecordsInEfBySearch(int efid, String oldTag, String oldPhoneNumber, String newTag, String newPhoneNumber, String pin2)69 boolean updateAdnRecordsInEfBySearch(int efid, 70 String oldTag, String oldPhoneNumber, 71 String newTag, String newPhoneNumber, 72 String pin2); 73 74 /** 75 * Replace oldAdn with newAdn in ADN-like record in EF 76 * 77 * getAdnRecordsInEf must be called at least once before this function, 78 * otherwise an error will be returned 79 * 80 * @param subId user preferred subId 81 * @param efid must be one among EF_ADN, EF_FDN, and EF_SDN 82 * @param values including ADN,EMAIL,ANR to be updated 83 * @param pin2 required to update EF_FDN, otherwise must be null 84 * @return true for success 85 */ updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid, in ContentValues values, String pin2)86 boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, 87 int efid, in ContentValues values, String pin2); 88 89 /** 90 * Update an ADN-like EF record by record index 91 * 92 * This is useful for iteration the whole ADN file, such as write the whole 93 * phone book or erase/format the whole phonebook 94 * 95 * @param subId user preferred subId 96 * @param efid must be one among EF_ADN, EF_FDN, and EF_SDN 97 * @param values including ADN,EMAIL,ANR to be updated 98 * @param index is 1-based adn record index to be updated 99 * @param pin2 required to update EF_FDN, otherwise must be null 100 * @return true for success 101 */ updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid, in ContentValues values, int index, String pin2)102 boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid, in ContentValues values, 103 int index, String pin2); 104 105 /** 106 * Get the max munber of records in efid 107 * 108 * @param efid the EF id of a ADN-like SIM 109 * @return int[3] array 110 * recordSizes[0] is the single record length 111 * recordSizes[1] is the total length of the EF file 112 * recordSizes[2] is the number of records in the EF file 113 */ 114 @UnsupportedAppUsage getAdnRecordsSize(int efid)115 int[] getAdnRecordsSize(int efid); 116 117 /** 118 * Get the max munber of records in efid 119 * 120 * @param efid the EF id of a ADN-like SIM 121 * @param subId user preferred subId 122 * @return int[3] array 123 * recordSizes[0] is the single record length 124 * recordSizes[1] is the total length of the EF file 125 * recordSizes[2] is the number of records in the EF file 126 */ 127 @UnsupportedAppUsage getAdnRecordsSizeForSubscriber(int subId, int efid)128 int[] getAdnRecordsSizeForSubscriber(int subId, int efid); 129 130 /** 131 * Get the capacity of ADN records 132 * 133 * @param subId user preferred subId 134 * @return AdnCapacity 135 */ getAdnRecordsCapacityForSubscriber(int subId)136 AdnCapacity getAdnRecordsCapacityForSubscriber(int subId); 137 } 138