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 17 package com.android.internal.telephony; 18 19 import android.telephony.SubscriptionInfo; 20 import android.os.ParcelUuid; 21 import com.android.internal.telephony.ISetOpportunisticDataCallback; 22 23 interface ISub { 24 /** 25 * @param callingPackage The package maing the call. 26 * @return a list of all subscriptions in the database, this includes 27 * all subscriptions that have been seen. 28 */ getAllSubInfoList(String callingPackage)29 List<SubscriptionInfo> getAllSubInfoList(String callingPackage); 30 31 /** 32 * @param callingPackage The package maing the call. 33 * @return the count of all subscriptions in the database, this includes 34 * all subscriptions that have been seen. 35 */ getAllSubInfoCount(String callingPackage)36 int getAllSubInfoCount(String callingPackage); 37 38 /** 39 * Get the active SubscriptionInfo with the subId key 40 * @param subId The unique SubscriptionInfo key in database 41 * @param callingPackage The package maing the call. 42 * @return SubscriptionInfo, maybe null if its not active 43 */ getActiveSubscriptionInfo(int subId, String callingPackage)44 SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage); 45 46 /** 47 * Get the active SubscriptionInfo associated with the iccId 48 * @param iccId the IccId of SIM card 49 * @param callingPackage The package maing the call. 50 * @return SubscriptionInfo, maybe null if its not active 51 */ getActiveSubscriptionInfoForIccId(String iccId, String callingPackage)52 SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage); 53 54 /** 55 * Get the active SubscriptionInfo associated with the slotIndex 56 * @param slotIndex the slot which the subscription is inserted 57 * @param callingPackage The package making the call. 58 * @return SubscriptionInfo, null for Remote-SIMs or non-active slotIndex. 59 */ getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage)60 SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage); 61 62 /** 63 * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted 64 * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}. 65 * 66 * @param callingPackage The package maing the call. 67 * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device. 68 * <ul> 69 * <li> 70 * If null is returned the current state is unknown but if a {@link OnSubscriptionsChangedListener} 71 * has been registered {@link OnSubscriptionsChangedListener#onSubscriptionsChanged} will be 72 * invoked in the future. 73 * </li> 74 * <li> 75 * If the list is empty then there are no {@link SubscriptionInfo} records currently available. 76 * </li> 77 * <li> 78 * if the list is non-empty the list is sorted by {@link SubscriptionInfo#getSimSlotIndex} 79 * then by {@link SubscriptionInfo#getSubscriptionId}. 80 * </li> 81 * </ul> 82 */ getActiveSubscriptionInfoList(String callingPackage)83 List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage); 84 85 /** 86 * @param callingPackage The package making the call. 87 * @return the number of active subscriptions 88 */ getActiveSubInfoCount(String callingPackage)89 int getActiveSubInfoCount(String callingPackage); 90 91 /** 92 * @return the maximum number of subscriptions this device will support at any one time. 93 */ getActiveSubInfoCountMax()94 int getActiveSubInfoCountMax(); 95 96 /** 97 * @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList 98 */ getAvailableSubscriptionInfoList(String callingPackage)99 List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage); 100 101 /** 102 * @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList 103 */ getAccessibleSubscriptionInfoList(String callingPackage)104 List<SubscriptionInfo> getAccessibleSubscriptionInfoList(String callingPackage); 105 106 /** 107 * @see android.telephony.SubscriptionManager#requestEmbeddedSubscriptionInfoListRefresh 108 */ requestEmbeddedSubscriptionInfoListRefresh(int cardId)109 oneway void requestEmbeddedSubscriptionInfoListRefresh(int cardId); 110 111 /** 112 * Add a new SubscriptionInfo to subinfo database if needed 113 * @param iccId the IccId of the SIM card 114 * @param slotIndex the slot which the SIM is inserted 115 * @return the URL of the newly created row or the updated row 116 */ addSubInfoRecord(String iccId, int slotIndex)117 int addSubInfoRecord(String iccId, int slotIndex); 118 119 /** 120 * Add a new subscription info record, if needed 121 * @param uniqueId This is the unique identifier for the subscription within the specific 122 * subscription type. 123 * @param displayName human-readable name of the device the subscription corresponds to. 124 * @param slotIndex the slot assigned to this device 125 * @param subscriptionType the type of subscription to be added. 126 * @return 0 if success, < 0 on error. 127 */ addSubInfo(String uniqueId, String displayName, int slotIndex, int subscriptionType)128 int addSubInfo(String uniqueId, String displayName, int slotIndex, int subscriptionType); 129 130 /** 131 * Remove subscription info record for the given device. 132 * @param uniqueId This is the unique identifier for the subscription within the specific 133 * subscription type. 134 * @param subscriptionType the type of subscription to be removed 135 * @return 0 if success, < 0 on error. 136 */ removeSubInfo(String uniqueId, int subscriptionType)137 int removeSubInfo(String uniqueId, int subscriptionType); 138 139 /** 140 * Set SIM icon tint color by simInfo index 141 * @param tint the icon tint color of the SIM 142 * @param subId the unique SubscriptionInfo index in database 143 * @return the number of records updated 144 */ setIconTint(int tint, int subId)145 int setIconTint(int tint, int subId); 146 147 /** 148 * Set display name by simInfo index with name source 149 * @param displayName the display name of SIM card 150 * @param subId the unique SubscriptionInfo index in database 151 * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT 152 * @return the number of records updated 153 */ setDisplayNameUsingSrc(String displayName, int subId, int nameSource)154 int setDisplayNameUsingSrc(String displayName, int subId, int nameSource); 155 156 /** 157 * Set phone number by subId 158 * @param number the phone number of the SIM 159 * @param subId the unique SubscriptionInfo index in database 160 * @return the number of records updated 161 */ setDisplayNumber(String number, int subId)162 int setDisplayNumber(String number, int subId); 163 164 /** 165 * Set data roaming by simInfo index 166 * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming 167 * @param subId the unique SubscriptionInfo index in database 168 * @return the number of records updated 169 */ setDataRoaming(int roaming, int subId)170 int setDataRoaming(int roaming, int subId); 171 172 /** 173 * Switch to a certain subscription 174 * 175 * @param opportunistic whether it’s opportunistic subscription. 176 * @param subId the unique SubscriptionInfo index in database 177 * @return the number of records updated 178 */ setOpportunistic(boolean opportunistic, int subId, String callingPackage)179 int setOpportunistic(boolean opportunistic, int subId, String callingPackage); 180 181 /** 182 * Inform SubscriptionManager that subscriptions in the list are bundled 183 * as a group. Typically it's a primary subscription and an opportunistic 184 * subscription. It should only affect multi-SIM scenarios where primary 185 * and opportunistic subscriptions can be activated together. 186 * Being in the same group means they might be activated or deactivated 187 * together, some of them may be invisible to the users, etc. 188 * 189 * Caller will either have {@link android.Manifest.permission.MODIFY_PHONE_STATE} 190 * permission or can manage all subscriptions in the list, according to their 191 * acess rules. 192 * 193 * @param subIdList list of subId that will be in the same group 194 * @return groupUUID a UUID assigned to the subscription group. It returns 195 * null if fails. 196 * 197 */ createSubscriptionGroup(in int[] subIdList, String callingPackage)198 ParcelUuid createSubscriptionGroup(in int[] subIdList, String callingPackage); 199 200 /** 201 * Set which subscription is preferred for cellular data. It's 202 * designed to overwrite default data subscription temporarily. 203 * 204 * @param subId which subscription is preferred to for cellular data. 205 * @param needValidation whether validation is needed before switching. 206 * @param callback callback upon request completion. 207 * 208 * @hide 209 * 210 */ setPreferredDataSubscriptionId(int subId, boolean needValidation, ISetOpportunisticDataCallback callback)211 void setPreferredDataSubscriptionId(int subId, boolean needValidation, 212 ISetOpportunisticDataCallback callback); 213 214 /** 215 * Get which subscription is preferred for cellular data. 216 * 217 * @hide 218 * 219 */ getPreferredDataSubscriptionId()220 int getPreferredDataSubscriptionId(); 221 222 /** 223 * Get User downloaded Profiles. 224 * 225 * Return opportunistic subscriptions that can be visible to the caller. 226 * @return the list of opportunistic subscription info. If none exists, an empty list. 227 */ getOpportunisticSubscriptions(String callingPackage)228 List<SubscriptionInfo> getOpportunisticSubscriptions(String callingPackage); 229 removeSubscriptionsFromGroup(in int[] subIdList, in ParcelUuid groupUuid, String callingPackage)230 void removeSubscriptionsFromGroup(in int[] subIdList, in ParcelUuid groupUuid, 231 String callingPackage); 232 addSubscriptionsIntoGroup(in int[] subIdList, in ParcelUuid groupUuid, String callingPackage)233 void addSubscriptionsIntoGroup(in int[] subIdList, in ParcelUuid groupUuid, 234 String callingPackage); 235 getSubscriptionsInGroup(in ParcelUuid groupUuid, String callingPackage)236 List<SubscriptionInfo> getSubscriptionsInGroup(in ParcelUuid groupUuid, String callingPackage); 237 getSlotIndex(int subId)238 int getSlotIndex(int subId); 239 getSubId(int slotIndex)240 int[] getSubId(int slotIndex); 241 getDefaultSubId()242 int getDefaultSubId(); 243 clearSubInfo()244 int clearSubInfo(); 245 getPhoneId(int subId)246 int getPhoneId(int subId); 247 248 /** 249 * Get the default data subscription 250 * @return Id of the data subscription 251 */ getDefaultDataSubId()252 int getDefaultDataSubId(); 253 setDefaultDataSubId(int subId)254 void setDefaultDataSubId(int subId); 255 getDefaultVoiceSubId()256 int getDefaultVoiceSubId(); 257 setDefaultVoiceSubId(int subId)258 void setDefaultVoiceSubId(int subId); 259 getDefaultSmsSubId()260 int getDefaultSmsSubId(); 261 setDefaultSmsSubId(int subId)262 void setDefaultSmsSubId(int subId); 263 getActiveSubIdList(boolean visibleOnly)264 int[] getActiveSubIdList(boolean visibleOnly); 265 setSubscriptionProperty(int subId, String propKey, String propValue)266 int setSubscriptionProperty(int subId, String propKey, String propValue); 267 getSubscriptionProperty(int subId, String propKey, String callingPackage)268 String getSubscriptionProperty(int subId, String propKey, String callingPackage); 269 setSubscriptionEnabled(boolean enable, int subId)270 boolean setSubscriptionEnabled(boolean enable, int subId); 271 isSubscriptionEnabled(int subId)272 boolean isSubscriptionEnabled(int subId); 273 getEnabledSubscriptionId(int slotIndex)274 int getEnabledSubscriptionId(int slotIndex); 275 /** 276 * Get the SIM state for the slot index 277 * @return SIM state as the ordinal of IccCardConstants.State 278 */ getSimStateForSlotIndex(int slotIndex)279 int getSimStateForSlotIndex(int slotIndex); 280 isActiveSubId(int subId, String callingPackage)281 boolean isActiveSubId(int subId, String callingPackage); 282 setAlwaysAllowMmsData(int subId, boolean alwaysAllow)283 boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow); 284 } 285