1fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville/*
28fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * Copyright (C) 2014 The Android Open Source Project
38fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville *
48fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * Licensed under the Apache License, Version 2.0 (the "License");
58fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * you may not use this file except in compliance with the License.
68fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * You may obtain a copy of the License at
78fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville *
88fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville *      http://www.apache.org/licenses/LICENSE-2.0
98fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville *
108fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * Unless required by applicable law or agreed to in writing, software
118fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * distributed under the License is distributed on an "AS IS" BASIS,
128fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * See the License for the specific language governing permissions and
148fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville * limitations under the License.
158fec2e4414abfbc4e4e20d719e80ba99dc9ceb60Wink Saville */
16fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
17fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Savillepackage com.android.internal.telephony;
18fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
19fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Savilleimport android.app.PendingIntent;
20a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Savilleimport android.telephony.SubscriptionInfo;
21a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Savilleimport com.android.internal.telephony.ISubscriptionListener;
22fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
23fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Savilleinterface ISub {
24fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
2521301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov     * @param callingPackage The package maing the call.
26d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return a list of all subscriptions in the database, this includes
27d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * all subscriptions that have been seen.
28fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
2921301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov    List<SubscriptionInfo> getAllSubInfoList(String callingPackage);
30fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
31fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
3221301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov     * @param callingPackage The package maing the call.
33d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return the count of all subscriptions in the database, this includes
34d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * all subscriptions that have been seen.
35fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
3621301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov    int getAllSubInfoCount(String callingPackage);
37fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
38fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
39d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * Get the active SubscriptionInfo with the subId key
40d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @param subId The unique SubscriptionInfo key in database
4121301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov     * @param callingPackage The package maing the call.
42d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return SubscriptionInfo, maybe null if its not active
43fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
4421301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov    SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage);
45fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
46fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
47d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * Get the active SubscriptionInfo associated with the iccId
48d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @param iccId the IccId of SIM card
4921301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov     * @param callingPackage The package maing the call.
50d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return SubscriptionInfo, maybe null if its not active
51fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
5221301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov    SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage);
53fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
54fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
557e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe     * Get the active SubscriptionInfo associated with the slotIndex
567e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe     * @param slotIndex the slot which the subscription is inserted
5721301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov     * @param callingPackage The package maing the call.
58d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return SubscriptionInfo, maybe null if its not active
59fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
607e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe    SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage);
61fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
62fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
63d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted
64d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}.
65d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     *
6621301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov     * @param callingPackage The package maing the call.
67d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device.
68d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * <ul>
69d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * <li>
70d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * If null is returned the current state is unknown but if a {@link OnSubscriptionsChangedListener}
71d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * has been registered {@link OnSubscriptionsChangedListener#onSubscriptionsChanged} will be
72d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * invoked in the future.
73d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * </li>
74d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * <li>
75d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * If the list is empty then there are no {@link SubscriptionInfo} records currently available.
76d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * </li>
77d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * <li>
78d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex}
79d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * then by {@link SubscriptionInfo#getSubscriptionId}.
80d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * </li>
81d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * </ul>
82fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
8321301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov    List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage);
84fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
85fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
86278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt     * @param callingPackage The package making the call.
87d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return the number of active subscriptions
88c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville     */
8921301f6016ce50594f6cd9c66581ee9a08b57be9Svet Ganov    int getActiveSubInfoCount(String callingPackage);
90c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville
91c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville    /**
92d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     * @return the maximum number of subscriptions this device will support at any one time.
93d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville     */
94d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville    int getActiveSubInfoCountMax();
95d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville
96d09c4cad65c708f2c4810d24295456708a2000d2Wink Saville    /**
97a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Saville     * Add a new SubscriptionInfo to subinfo database if needed
98fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @param iccId the IccId of the SIM card
997e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe     * @param slotIndex the slot which the SIM is inserted
100fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return the URL of the newly created row or the updated row
101fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
1027e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe    int addSubInfoRecord(String iccId, int slotIndex);
103fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
104fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
105ab45ec177a787fee046f6a9c4d1098d529aff7bbStuart Scott     * Set SIM icon tint color by simInfo index
106ab45ec177a787fee046f6a9c4d1098d529aff7bbStuart Scott     * @param tint the icon tint color of the SIM
107a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Saville     * @param subId the unique SubscriptionInfo index in database
108fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return the number of records updated
109fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
110278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    int setIconTint(int tint, int subId);
111fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
112fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
113fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * Set display name by simInfo index
114fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @param displayName the display name of SIM card
115a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Saville     * @param subId the unique SubscriptionInfo index in database
116fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return the number of records updated
117fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
118278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    int setDisplayName(String displayName, int subId);
119fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
120fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
121fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * Set display name by simInfo index with name source
122fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @param displayName the display name of SIM card
123a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Saville     * @param subId the unique SubscriptionInfo index in database
124fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT
125fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return the number of records updated
126fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
127278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    int setDisplayNameUsingSrc(String displayName, int subId, long nameSource);
128fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
129fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
130fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * Set phone number by subId
131fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @param number the phone number of the SIM
132a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Saville     * @param subId the unique SubscriptionInfo index in database
133fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return the number of records updated
134fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
135278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    int setDisplayNumber(String number, int subId);
136fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
137fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
138fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * Set data roaming by simInfo index
139fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming
140a374c3d03b28f135cdfba2cadf6fe6f03ac010bdWink Saville     * @param subId the unique SubscriptionInfo index in database
141fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return the number of records updated
142fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
143278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    int setDataRoaming(int roaming, int subId);
144fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
1457e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe    int getSlotIndex(int subId);
146fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
1477e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe    int[] getSubId(int slotIndex);
148fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
14963f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    int getDefaultSubId();
150fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
151278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    int clearSubInfo();
152fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
15363f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    int getPhoneId(int subId);
154fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
155fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville    /**
156fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * Get the default data subscription
157fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     * @return Id of the data subscription
158fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville     */
15963f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    int getDefaultDataSubId();
160fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
16163f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    void setDefaultDataSubId(int subId);
162fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
16363f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    int getDefaultVoiceSubId();
164fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville
16563f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    void setDefaultVoiceSubId(int subId);
166c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville
16763f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    int getDefaultSmsSubId();
168c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville
16963f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    void setDefaultSmsSubId(int subId);
170c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville
171278b8f950948435fb08db0a12313e2ea704fa637Robert Greenwalt    void clearDefaultsForInactiveSubIds();
172c650e0b12a656060de767d91d99f6b33e51c6ab2Wink Saville
17363f03dd94c43c22f2c77306059b5748e5e1e0e3cWink Saville    int[] getActiveSubIdList();
17447920fac33efb7ce4bf33a5691e4af1b67ab6019Wink Saville
175dc49309cefed9519611b183ae2c616e6f0110738Sanket Padawe    void setSubscriptionProperty(int subId, String propKey, String propValue);
176dc49309cefed9519611b183ae2c616e6f0110738Sanket Padawe
177dc49309cefed9519611b183ae2c616e6f0110738Sanket Padawe    String getSubscriptionProperty(int subId, String propKey, String callingPackage);
178dc49309cefed9519611b183ae2c616e6f0110738Sanket Padawe
17947920fac33efb7ce4bf33a5691e4af1b67ab6019Wink Saville    /**
1807e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe     * Get the SIM state for the slot index
18147920fac33efb7ce4bf33a5691e4af1b67ab6019Wink Saville     * @return SIM state as the ordinal of IccCardConstants.State
18247920fac33efb7ce4bf33a5691e4af1b67ab6019Wink Saville     */
1837e4602519977b6bb9c41afc91a44ca782e716e40Sanket Padawe    int getSimStateForSlotIndex(int slotIndex);
18447920fac33efb7ce4bf33a5691e4af1b67ab6019Wink Saville
1850ced792cd69ff4e78b3ea84e6b38c1f1fddce82eShishir Agrawal    boolean isActiveSubId(int subId);
186fb40dd4d00bd3361b2535bc866e6c21eadc52558Wink Saville}
187