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 * Add a new SubscriptionInfo to subinfo database if needed 98 * @param iccId the IccId of the SIM card 99 * @param slotIndex the slot which the SIM is inserted 100 * @return the URL of the newly created row or the updated row 101 */ addSubInfoRecord(String iccId, int slotIndex)102 int addSubInfoRecord(String iccId, int slotIndex); 103 104 /** 105 * Set SIM icon tint color by simInfo index 106 * @param tint the icon tint color of the SIM 107 * @param subId the unique SubscriptionInfo index in database 108 * @return the number of records updated 109 */ setIconTint(int tint, int subId)110 int setIconTint(int tint, int subId); 111 112 /** 113 * Set display name by simInfo index 114 * @param displayName the display name of SIM card 115 * @param subId the unique SubscriptionInfo index in database 116 * @return the number of records updated 117 */ setDisplayName(String displayName, int subId)118 int setDisplayName(String displayName, int subId); 119 120 /** 121 * Set display name by simInfo index with name source 122 * @param displayName the display name of SIM card 123 * @param subId the unique SubscriptionInfo index in database 124 * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT 125 * @return the number of records updated 126 */ setDisplayNameUsingSrc(String displayName, int subId, long nameSource)127 int setDisplayNameUsingSrc(String displayName, int subId, long nameSource); 128 129 /** 130 * Set phone number by subId 131 * @param number the phone number of the SIM 132 * @param subId the unique SubscriptionInfo index in database 133 * @return the number of records updated 134 */ setDisplayNumber(String number, int subId)135 int setDisplayNumber(String number, int subId); 136 137 /** 138 * Set data roaming by simInfo index 139 * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming 140 * @param subId the unique SubscriptionInfo index in database 141 * @return the number of records updated 142 */ setDataRoaming(int roaming, int subId)143 int setDataRoaming(int roaming, int subId); 144 getSlotIndex(int subId)145 int getSlotIndex(int subId); 146 getSubId(int slotIndex)147 int[] getSubId(int slotIndex); 148 getDefaultSubId()149 int getDefaultSubId(); 150 clearSubInfo()151 int clearSubInfo(); 152 getPhoneId(int subId)153 int getPhoneId(int subId); 154 155 /** 156 * Get the default data subscription 157 * @return Id of the data subscription 158 */ getDefaultDataSubId()159 int getDefaultDataSubId(); 160 setDefaultDataSubId(int subId)161 void setDefaultDataSubId(int subId); 162 getDefaultVoiceSubId()163 int getDefaultVoiceSubId(); 164 setDefaultVoiceSubId(int subId)165 void setDefaultVoiceSubId(int subId); 166 getDefaultSmsSubId()167 int getDefaultSmsSubId(); 168 setDefaultSmsSubId(int subId)169 void setDefaultSmsSubId(int subId); 170 clearDefaultsForInactiveSubIds()171 void clearDefaultsForInactiveSubIds(); 172 getActiveSubIdList()173 int[] getActiveSubIdList(); 174 setSubscriptionProperty(int subId, String propKey, String propValue)175 void setSubscriptionProperty(int subId, String propKey, String propValue); 176 getSubscriptionProperty(int subId, String propKey, String callingPackage)177 String getSubscriptionProperty(int subId, String propKey, String callingPackage); 178 179 /** 180 * Get the SIM state for the slot index 181 * @return SIM state as the ordinal of IccCardConstants.State 182 */ getSimStateForSlotIndex(int slotIndex)183 int getSimStateForSlotIndex(int slotIndex); 184 isActiveSubId(int subId)185 boolean isActiveSubId(int subId); 186 } 187