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