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 22 interface 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 */ getAllSubInfoList(String callingPackage)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 */ getAllSubInfoCount(String callingPackage)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 */ getActiveSubscriptionInfo(int subId, String callingPackage)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 */ getActiveSubscriptionInfoForIccId(String iccId, String callingPackage)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 */ getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage)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 */ getActiveSubscriptionInfoList(String callingPackage)82 List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage); 83 84 /** 85 * @param callingPackage The package making the call. 86 * @return the number of active subscriptions 87 */ getActiveSubInfoCount(String callingPackage)88 int getActiveSubInfoCount(String callingPackage); 89 90 /** 91 * @return the maximum number of subscriptions this device will support at any one time. 92 */ getActiveSubInfoCountMax()93 int getActiveSubInfoCountMax(); 94 95 /** 96 * @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList 97 */ getAvailableSubscriptionInfoList(String callingPackage)98 List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage); 99 100 /** 101 * @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList 102 */ getAccessibleSubscriptionInfoList(String callingPackage)103 List<SubscriptionInfo> getAccessibleSubscriptionInfoList(String callingPackage); 104 105 /** 106 * @see android.telephony.SubscriptionManager#requestEmbeddedSubscriptionInfoListRefresh 107 */ requestEmbeddedSubscriptionInfoListRefresh()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 */ addSubInfoRecord(String iccId, int slotIndex)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 */ setIconTint(int tint, int subId)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 */ setDisplayName(String displayName, int subId)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 */ setDisplayNameUsingSrc(String displayName, int subId, long nameSource)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 */ setDisplayNumber(String number, int subId)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 */ setDataRoaming(int roaming, int subId)157 int setDataRoaming(int roaming, int subId); 158 getSlotIndex(int subId)159 int getSlotIndex(int subId); 160 getSubId(int slotIndex)161 int[] getSubId(int slotIndex); 162 getDefaultSubId()163 int getDefaultSubId(); 164 clearSubInfo()165 int clearSubInfo(); 166 getPhoneId(int subId)167 int getPhoneId(int subId); 168 169 /** 170 * Get the default data subscription 171 * @return Id of the data subscription 172 */ getDefaultDataSubId()173 int getDefaultDataSubId(); 174 setDefaultDataSubId(int subId)175 void setDefaultDataSubId(int subId); 176 getDefaultVoiceSubId()177 int getDefaultVoiceSubId(); 178 setDefaultVoiceSubId(int subId)179 void setDefaultVoiceSubId(int subId); 180 getDefaultSmsSubId()181 int getDefaultSmsSubId(); 182 setDefaultSmsSubId(int subId)183 void setDefaultSmsSubId(int subId); 184 clearDefaultsForInactiveSubIds()185 void clearDefaultsForInactiveSubIds(); 186 getActiveSubIdList()187 int[] getActiveSubIdList(); 188 setSubscriptionProperty(int subId, String propKey, String propValue)189 void setSubscriptionProperty(int subId, String propKey, String propValue); 190 getSubscriptionProperty(int subId, String propKey, String callingPackage)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 */ getSimStateForSlotIndex(int slotIndex)197 int getSimStateForSlotIndex(int slotIndex); 198 isActiveSubId(int subId)199 boolean isActiveSubId(int subId); 200 } 201