1/*
2 * Copyright (C) 2014 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 android.app.PendingIntent;
20import android.telephony.SubscriptionInfo;
21
22interface ISub {
23    /**
24     * @param callingPackage The package maing the call.
25     * @return a list of all subscriptions in the database, this includes
26     * all subscriptions that have been seen.
27     */
28    List<SubscriptionInfo> getAllSubInfoList(String callingPackage);
29
30    /**
31     * @param callingPackage The package maing the call.
32     * @return the count of all subscriptions in the database, this includes
33     * all subscriptions that have been seen.
34     */
35    int getAllSubInfoCount(String callingPackage);
36
37    /**
38     * Get the active SubscriptionInfo with the subId key
39     * @param subId The unique SubscriptionInfo key in database
40     * @param callingPackage The package maing the call.
41     * @return SubscriptionInfo, maybe null if its not active
42     */
43    SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage);
44
45    /**
46     * Get the active SubscriptionInfo associated with the iccId
47     * @param iccId the IccId of SIM card
48     * @param callingPackage The package maing the call.
49     * @return SubscriptionInfo, maybe null if its not active
50     */
51    SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage);
52
53    /**
54     * Get the active SubscriptionInfo associated with the slotIndex
55     * @param slotIndex the slot which the subscription is inserted
56     * @param callingPackage The package maing the call.
57     * @return SubscriptionInfo, maybe null if its not active
58     */
59    SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage);
60
61    /**
62     * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted
63     * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}.
64     *
65     * @param callingPackage The package maing the call.
66     * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device.
67     * <ul>
68     * <li>
69     * If null is returned the current state is unknown but if a {@link OnSubscriptionsChangedListener}
70     * has been registered {@link OnSubscriptionsChangedListener#onSubscriptionsChanged} will be
71     * invoked in the future.
72     * </li>
73     * <li>
74     * If the list is empty then there are no {@link SubscriptionInfo} records currently available.
75     * </li>
76     * <li>
77     * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex}
78     * then by {@link SubscriptionInfo#getSubscriptionId}.
79     * </li>
80     * </ul>
81     */
82    List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage);
83
84    /**
85     * @param callingPackage The package making the call.
86     * @return the number of active subscriptions
87     */
88    int getActiveSubInfoCount(String callingPackage);
89
90    /**
91     * @return the maximum number of subscriptions this device will support at any one time.
92     */
93    int getActiveSubInfoCountMax();
94
95    /**
96     * @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList
97     */
98    List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage);
99
100    /**
101     * @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList
102     */
103    List<SubscriptionInfo> getAccessibleSubscriptionInfoList(String callingPackage);
104
105    /**
106     * @see android.telephony.SubscriptionManager#requestEmbeddedSubscriptionInfoListRefresh
107     */
108    oneway void requestEmbeddedSubscriptionInfoListRefresh();
109
110    /**
111     * Add a new SubscriptionInfo to subinfo database if needed
112     * @param iccId the IccId of the SIM card
113     * @param slotIndex the slot which the SIM is inserted
114     * @return the URL of the newly created row or the updated row
115     */
116    int addSubInfoRecord(String iccId, int slotIndex);
117
118    /**
119     * Set SIM icon tint color by simInfo index
120     * @param tint the icon tint color of the SIM
121     * @param subId the unique SubscriptionInfo index in database
122     * @return the number of records updated
123     */
124    int setIconTint(int tint, int subId);
125
126    /**
127     * Set display name by simInfo index
128     * @param displayName the display name of SIM card
129     * @param subId the unique SubscriptionInfo index in database
130     * @return the number of records updated
131     */
132    int setDisplayName(String displayName, int subId);
133
134    /**
135     * Set display name by simInfo index with name source
136     * @param displayName the display name of SIM card
137     * @param subId the unique SubscriptionInfo index in database
138     * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
139     * @return the number of records updated
140     */
141    int setDisplayNameUsingSrc(String displayName, int subId, long nameSource);
142
143    /**
144     * Set phone number by subId
145     * @param number the phone number of the SIM
146     * @param subId the unique SubscriptionInfo index in database
147     * @return the number of records updated
148     */
149    int setDisplayNumber(String number, int subId);
150
151    /**
152     * Set data roaming by simInfo index
153     * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
154     * @param subId the unique SubscriptionInfo index in database
155     * @return the number of records updated
156     */
157    int setDataRoaming(int roaming, int subId);
158
159    int getSlotIndex(int subId);
160
161    int[] getSubId(int slotIndex);
162
163    int getDefaultSubId();
164
165    int clearSubInfo();
166
167    int getPhoneId(int subId);
168
169    /**
170     * Get the default data subscription
171     * @return Id of the data subscription
172     */
173    int getDefaultDataSubId();
174
175    void setDefaultDataSubId(int subId);
176
177    int getDefaultVoiceSubId();
178
179    void setDefaultVoiceSubId(int subId);
180
181    int getDefaultSmsSubId();
182
183    void setDefaultSmsSubId(int subId);
184
185    void clearDefaultsForInactiveSubIds();
186
187    int[] getActiveSubIdList();
188
189    void setSubscriptionProperty(int subId, String propKey, String propValue);
190
191    String getSubscriptionProperty(int subId, String propKey, String callingPackage);
192
193    /**
194     * Get the SIM state for the slot index
195     * @return SIM state as the ordinal of IccCardConstants.State
196     */
197    int getSimStateForSlotIndex(int slotIndex);
198
199    boolean isActiveSubId(int subId);
200}
201