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.app.PendingIntent; 20 import android.telephony.SubscriptionInfo; 21 import com.android.internal.telephony.ISubscriptionListener; 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 maing the call. 58 * @return SubscriptionInfo, maybe null if its not active 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()109 oneway void requestEmbeddedSubscriptionInfoListRefresh(); 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 * Set SIM icon tint color by simInfo index 121 * @param tint the icon tint color of the SIM 122 * @param subId the unique SubscriptionInfo index in database 123 * @return the number of records updated 124 */ setIconTint(int tint, int subId)125 int setIconTint(int tint, int subId); 126 127 /** 128 * Set display name by simInfo index 129 * @param displayName the display name of SIM card 130 * @param subId the unique SubscriptionInfo index in database 131 * @return the number of records updated 132 */ setDisplayName(String displayName, int subId)133 int setDisplayName(String displayName, int subId); 134 135 /** 136 * Set display name by simInfo index with name source 137 * @param displayName the display name of SIM card 138 * @param subId the unique SubscriptionInfo index in database 139 * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT 140 * @return the number of records updated 141 */ setDisplayNameUsingSrc(String displayName, int subId, long nameSource)142 int setDisplayNameUsingSrc(String displayName, int subId, long nameSource); 143 144 /** 145 * Set phone number by subId 146 * @param number the phone number of the SIM 147 * @param subId the unique SubscriptionInfo index in database 148 * @return the number of records updated 149 */ setDisplayNumber(String number, int subId)150 int setDisplayNumber(String number, int subId); 151 152 /** 153 * Set data roaming by simInfo index 154 * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming 155 * @param subId the unique SubscriptionInfo index in database 156 * @return the number of records updated 157 */ setDataRoaming(int roaming, int subId)158 int setDataRoaming(int roaming, int subId); 159 getSlotIndex(int subId)160 int getSlotIndex(int subId); 161 getSubId(int slotIndex)162 int[] getSubId(int slotIndex); 163 getDefaultSubId()164 int getDefaultSubId(); 165 clearSubInfo()166 int clearSubInfo(); 167 getPhoneId(int subId)168 int getPhoneId(int subId); 169 170 /** 171 * Get the default data subscription 172 * @return Id of the data subscription 173 */ getDefaultDataSubId()174 int getDefaultDataSubId(); 175 setDefaultDataSubId(int subId)176 void setDefaultDataSubId(int subId); 177 getDefaultVoiceSubId()178 int getDefaultVoiceSubId(); 179 setDefaultVoiceSubId(int subId)180 void setDefaultVoiceSubId(int subId); 181 getDefaultSmsSubId()182 int getDefaultSmsSubId(); 183 setDefaultSmsSubId(int subId)184 void setDefaultSmsSubId(int subId); 185 clearDefaultsForInactiveSubIds()186 void clearDefaultsForInactiveSubIds(); 187 getActiveSubIdList()188 int[] getActiveSubIdList(); 189 setSubscriptionProperty(int subId, String propKey, String propValue)190 void setSubscriptionProperty(int subId, String propKey, String propValue); 191 getSubscriptionProperty(int subId, String propKey, String callingPackage)192 String getSubscriptionProperty(int subId, String propKey, String callingPackage); 193 194 /** 195 * Get the SIM state for the slot index 196 * @return SIM state as the ordinal of IccCardConstants.State 197 */ getSimStateForSlotIndex(int slotIndex)198 int getSimStateForSlotIndex(int slotIndex); 199 isActiveSubId(int subId)200 boolean isActiveSubId(int subId); 201 } 202