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
17package com.android.internal.telephony;
18
19import com.android.internal.telephony.AdnRecord;
20
21
22
23/** Interface for applications to access the ICC phone book.
24 *
25 * <p>The following code snippet demonstrates a static method to
26 * retrieve the IIccPhoneBook interface from Android:</p>
27 * <pre>private static IIccPhoneBook getSimPhoneBookInterface()
28            throws DeadObjectException {
29    IServiceManager sm = ServiceManagerNative.getDefault();
30    IIccPhoneBook spb;
31    spb = IIccPhoneBook.Stub.asInterface(sm.getService("iccphonebook"));
32    return spb;
33}
34 * </pre>
35 */
36
37interface IIccPhoneBook {
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     * @return List of AdnRecord
45     */
46    List<AdnRecord> getAdnRecordsInEf(int efid);
47
48    /**
49     * Replace oldAdn with newAdn in ADN-like record in EF
50     *
51     * getAdnRecordsInEf must be called at least once before this function,
52     * otherwise an error will be returned
53     *
54     * @param efid must be one among EF_ADN, EF_FDN, and EF_SDN
55     * @param oldTag adn tag to be replaced
56     * @param oldPhoneNumber adn number to be replaced
57     *        Set both oldTag and oldPhoneNubmer to "" means to replace an
58     *        empty record, aka, insert new record
59     * @param newTag adn tag to be stored
60     * @param newPhoneNumber adn number ot be stored
61     *        Set both newTag and newPhoneNubmer to "" means to replace the old
62     *        record with empty one, aka, delete old record
63     * @param pin2 required to update EF_FDN, otherwise must be null
64     * @return true for success
65     */
66    boolean updateAdnRecordsInEfBySearch(int efid,
67            String oldTag, String oldPhoneNumber,
68            String newTag, String newPhoneNumber,
69            String pin2);
70
71    /**
72     * Update an ADN-like EF record by record index
73     *
74     * This is useful for iteration the whole ADN file, such as write the whole
75     * phone book or erase/format the whole phonebook
76     *
77     * @param efid must be one among EF_ADN, EF_FDN, and EF_SDN
78     * @param newTag adn tag to be stored
79     * @param newPhoneNumber adn number to be stored
80     *        Set both newTag and newPhoneNubmer to "" means to replace the old
81     *        record with empty one, aka, delete old record
82     * @param index is 1-based adn record index to be updated
83     * @param pin2 required to update EF_FDN, otherwise must be null
84     * @return true for success
85     */
86    boolean updateAdnRecordsInEfByIndex(int efid, String newTag,
87            String newPhoneNumber, int index,
88            String pin2);
89
90    /**
91     * Get the max munber of records in efid
92     *
93     * @param efid the EF id of a ADN-like SIM
94     * @return  int[3] array
95     *            recordSizes[0]  is the single record length
96     *            recordSizes[1]  is the total length of the EF file
97     *            recordSizes[2]  is the number of records in the EF file
98     */
99    int[] getAdnRecordsSize(int efid);
100
101}
102