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 slotIdx 56 * @param slotIdx 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 slotIdx, String callingPackage)60 SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIdx, 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 slotId 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 slotId)102 int addSubInfoRecord(String iccId, int slotId); 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 Sim Provisioning Status by subscription ID 122 * @param simProvisionStatus with the subscription: 123 * {@See SubscriptionManager#SIM_PROVISIONED} 124 * {@See SubscriptionManager#SIM_UNPROVISIONED_COLD} 125 * {@See SubscriptionManager#SIM_UNPROVISIONED_OUT_OF_CREDIT} 126 * @param subId the unique SubInfoRecord index in database 127 * @return the number of records updated 128 */ setSimProvisioningStatus(int simProvisioningStatus, int subId)129 int setSimProvisioningStatus(int simProvisioningStatus, int subId); 130 131 /** 132 * Set display name by simInfo index with name source 133 * @param displayName the display name of SIM card 134 * @param subId the unique SubscriptionInfo index in database 135 * @param nameSource, 0: DEFAULT_SOURCE, 1: SIM_SOURCE, 2: USER_INPUT 136 * @return the number of records updated 137 */ setDisplayNameUsingSrc(String displayName, int subId, long nameSource)138 int setDisplayNameUsingSrc(String displayName, int subId, long nameSource); 139 140 /** 141 * Set phone number by subId 142 * @param number the phone number of the SIM 143 * @param subId the unique SubscriptionInfo index in database 144 * @return the number of records updated 145 */ setDisplayNumber(String number, int subId)146 int setDisplayNumber(String number, int subId); 147 148 /** 149 * Set data roaming by simInfo index 150 * @param roaming 0:Don't allow data when roaming, 1:Allow data when roaming 151 * @param subId the unique SubscriptionInfo index in database 152 * @return the number of records updated 153 */ setDataRoaming(int roaming, int subId)154 int setDataRoaming(int roaming, int subId); 155 getSlotId(int subId)156 int getSlotId(int subId); 157 getSubId(int slotId)158 int[] getSubId(int slotId); 159 getDefaultSubId()160 int getDefaultSubId(); 161 clearSubInfo()162 int clearSubInfo(); 163 getPhoneId(int subId)164 int getPhoneId(int subId); 165 166 /** 167 * Get the default data subscription 168 * @return Id of the data subscription 169 */ getDefaultDataSubId()170 int getDefaultDataSubId(); 171 setDefaultDataSubId(int subId)172 void setDefaultDataSubId(int subId); 173 getDefaultVoiceSubId()174 int getDefaultVoiceSubId(); 175 setDefaultVoiceSubId(int subId)176 void setDefaultVoiceSubId(int subId); 177 getDefaultSmsSubId()178 int getDefaultSmsSubId(); 179 setDefaultSmsSubId(int subId)180 void setDefaultSmsSubId(int subId); 181 clearDefaultsForInactiveSubIds()182 void clearDefaultsForInactiveSubIds(); 183 getActiveSubIdList()184 int[] getActiveSubIdList(); 185 setSubscriptionProperty(int subId, String propKey, String propValue)186 void setSubscriptionProperty(int subId, String propKey, String propValue); 187 getSubscriptionProperty(int subId, String propKey, String callingPackage)188 String getSubscriptionProperty(int subId, String propKey, String callingPackage); 189 190 /** 191 * Get the SIM state for the slot idx 192 * @return SIM state as the ordinal of IccCardConstants.State 193 */ getSimStateForSlotIdx(int slotIdx)194 int getSimStateForSlotIdx(int slotIdx); 195 isActiveSubId(int subId)196 boolean isActiveSubId(int subId); 197 } 198