1 /* 2 * Copyright (C) 2007 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.ImsiEncryptionInfo; 20 import android.net.Uri; 21 22 /** 23 * Interface used to retrieve various phone-related subscriber information. 24 * 25 */ 26 interface IPhoneSubInfo { 27 28 /** @deprecated Use {@link #getDeviceIdWithFeature(String, String) instead */ 29 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) getDeviceId(String callingPackage)30 String getDeviceId(String callingPackage); 31 32 /** 33 * Retrieves the unique device ID, e.g., IMEI for GSM phones. 34 */ getDeviceIdWithFeature(String callingPackage, String callingFeatureId)35 String getDeviceIdWithFeature(String callingPackage, String callingFeatureId); 36 37 /** 38 * Retrieves the unique Network Access ID 39 */ getNaiForSubscriber(int subId, String callingPackage, String callingFeatureId)40 String getNaiForSubscriber(int subId, String callingPackage, String callingFeatureId); 41 42 /** 43 * Retrieves the unique device ID of a phone for the device, e.g., IMEI 44 * for GSM phones. 45 */ getDeviceIdForPhone(int phoneId, String callingPackage, String callingFeatureId)46 String getDeviceIdForPhone(int phoneId, String callingPackage, String callingFeatureId); 47 48 /** 49 * Retrieves the IMEI. 50 */ getImeiForSubscriber(int subId, String callingPackage, String callingFeatureId)51 String getImeiForSubscriber(int subId, String callingPackage, String callingFeatureId); 52 53 /** 54 * Retrieves the software version number for the device, e.g., IMEI/SV 55 * for GSM phones. 56 */ getDeviceSvn(String callingPackage, String callingFeatureId)57 String getDeviceSvn(String callingPackage, String callingFeatureId); 58 59 /** 60 * Retrieves the software version number of a subId for the device, e.g., IMEI/SV 61 * for GSM phones. 62 */ getDeviceSvnUsingSubId(int subId, String callingPackage, String callingFeatureId)63 String getDeviceSvnUsingSubId(int subId, String callingPackage, String callingFeatureId); 64 65 /** @deprecated Use {@link #getSubscriberIdWithFeature(String, String) instead */ 66 @UnsupportedAppUsage getSubscriberId(String callingPackage)67 String getSubscriberId(String callingPackage); 68 69 /** 70 * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones. 71 */ getSubscriberIdWithFeature(String callingPackage, String callingComponenId)72 String getSubscriberIdWithFeature(String callingPackage, String callingComponenId); 73 74 /** 75 * Retrieves the unique subscriber ID of a given subId, e.g., IMSI for GSM phones. 76 */ getSubscriberIdForSubscriber(int subId, String callingPackage, String callingFeatureId)77 String getSubscriberIdForSubscriber(int subId, String callingPackage, 78 String callingFeatureId); 79 80 /** 81 * Retrieves the Group Identifier Level1 for GSM phones of a subId. 82 */ getGroupIdLevel1ForSubscriber(int subId, String callingPackage, String callingFeatureId)83 String getGroupIdLevel1ForSubscriber(int subId, String callingPackage, 84 String callingFeatureId); 85 86 /** @deprecared Use {@link getIccSerialNumberWithFeature(String, String)} instead */ 87 @UnsupportedAppUsage getIccSerialNumber(String callingPackage)88 String getIccSerialNumber(String callingPackage); 89 90 /** 91 * Retrieves the serial number of the ICC, if applicable. 92 */ getIccSerialNumberWithFeature(String callingPackage, String callingFeatureId)93 String getIccSerialNumberWithFeature(String callingPackage, String callingFeatureId); 94 95 /** 96 * Retrieves the serial number of a given subId. 97 */ getIccSerialNumberForSubscriber(int subId, String callingPackage, String callingFeatureId)98 String getIccSerialNumberForSubscriber(int subId, String callingPackage, 99 String callingFeatureId); 100 101 /** 102 * Retrieves the phone number string for line 1. 103 */ getLine1Number(String callingPackage, String callingFeatureId)104 String getLine1Number(String callingPackage, String callingFeatureId); 105 106 /** 107 * Retrieves the phone number string for line 1 of a subcription. 108 */ getLine1NumberForSubscriber(int subId, String callingPackage, String callingFeatureId)109 String getLine1NumberForSubscriber(int subId, String callingPackage, String callingFeatureId); 110 111 112 /** 113 * Retrieves the alpha identifier for line 1. 114 */ getLine1AlphaTag(String callingPackage, String callingFeatureId)115 String getLine1AlphaTag(String callingPackage, String callingFeatureId); 116 117 /** 118 * Retrieves the alpha identifier for line 1 of a subId. 119 */ getLine1AlphaTagForSubscriber(int subId, String callingPackage, String callingFeatureId)120 String getLine1AlphaTagForSubscriber(int subId, String callingPackage, 121 String callingFeatureId); 122 123 124 /** 125 * Retrieves MSISDN Number. 126 */ getMsisdn(String callingPackage, String callingFeatureId)127 String getMsisdn(String callingPackage, String callingFeatureId); 128 129 /** 130 * Retrieves the Msisdn of a subId. 131 */ getMsisdnForSubscriber(int subId, String callingPackage, String callingFeatureId)132 String getMsisdnForSubscriber(int subId, String callingPackage, String callingFeatureId); 133 134 /** 135 * Retrieves the voice mail number. 136 */ getVoiceMailNumber(String callingPackage, String callingFeatureId)137 String getVoiceMailNumber(String callingPackage, String callingFeatureId); 138 139 /** 140 * Retrieves the voice mail number of a given subId. 141 */ getVoiceMailNumberForSubscriber(int subId, String callingPackage, String callingFeatureId)142 String getVoiceMailNumberForSubscriber(int subId, String callingPackage, 143 String callingFeatureId); 144 145 /** 146 * Retrieves the Carrier information used to encrypt IMSI and IMPI. 147 */ getCarrierInfoForImsiEncryption(int subId, int keyType, String callingPackage)148 ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int subId, int keyType, 149 String callingPackage); 150 151 /** 152 * Stores the Carrier information used to encrypt IMSI and IMPI. 153 */ setCarrierInfoForImsiEncryption(int subId, String callingPackage, in ImsiEncryptionInfo imsiEncryptionInfo)154 void setCarrierInfoForImsiEncryption(int subId, String callingPackage, 155 in ImsiEncryptionInfo imsiEncryptionInfo); 156 157 /** 158 * Resets the Carrier Keys in the database. This involves 2 steps: 159 * 1. Delete the keys from the database. 160 * 2. Send an intent to download new Certificates. 161 */ resetCarrierKeysForImsiEncryption(int subId, String callingPackage)162 void resetCarrierKeysForImsiEncryption(int subId, String callingPackage); 163 164 /** 165 * Retrieves the alpha identifier associated with the voice mail number. 166 */ getVoiceMailAlphaTag(String callingPackage, String callingFeatureId)167 String getVoiceMailAlphaTag(String callingPackage, String callingFeatureId); 168 169 /** 170 * Retrieves the alpha identifier associated with the voice mail number 171 * of a subId. 172 */ getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage, String callingFeatureId)173 String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage, 174 String callingFeatureId); 175 176 /** 177 * Returns the IMS private user identity (IMPI) that was loaded from the ISIM. 178 * @return the IMPI, or null if not present or not loaded 179 */ getIsimImpi(int subId)180 String getIsimImpi(int subId); 181 182 /** 183 * Fetches the ISIM PrivateUserIdentity (EF_IMPI) based on subId 184 * 185 * @param subId subscriptionId 186 * @return IMPI (IMS private user identity) of type string or null if EF_IMPI is not available. 187 * @throws IllegalArgumentException if the subscriptionId is not valid 188 * @throws IllegalStateException in case the ISIM hasn’t been loaded. 189 * @throws SecurityException if the caller does not have the required permission 190 */ 191 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" 192 + "android.Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER)") getImsPrivateUserIdentity(int subId, String callingPackage, String callingFeatureId)193 String getImsPrivateUserIdentity(int subId, String callingPackage, String callingFeatureId); 194 195 /** 196 * Returns the IMS home network domain name that was loaded from the ISIM. 197 * @return the IMS domain name, or null if not present or not loaded 198 */ getIsimDomain(int subId)199 String getIsimDomain(int subId); 200 201 /** 202 * Returns the IMS public user identities (IMPU) that were loaded from the ISIM. 203 * @return an array of IMPU strings, with one IMPU per string, or null if 204 * not present or not loaded 205 */ getIsimImpu(int subId)206 String[] getIsimImpu(int subId); 207 208 /** 209 * Fetches the ISIM public user identities (EF_IMPU) from UICC based on subId 210 */ 211 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" + 212 "anyOf={android.Manifest.permission.READ_PHONE_NUMBERS, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE})") getImsPublicUserIdentities(int subId, String callingPackage, String callingFeatureId)213 List<Uri> getImsPublicUserIdentities(int subId, String callingPackage, 214 String callingFeatureId); 215 216 /** 217 * Returns the IMS Service Table (IST) that was loaded from the ISIM. 218 * @return IMS Service Table or null if not present or not loaded 219 */ getIsimIst(int subId)220 String getIsimIst(int subId); 221 222 /** 223 * Returns the IMS Proxy Call Session Control Function(PCSCF) that were loaded from the ISIM. 224 * @return an array of PCSCF strings with one PCSCF per string, or null if 225 * not present or not loaded 226 */ getIsimPcscf(int subId)227 String[] getIsimPcscf(int subId); 228 229 /** 230 * Returns the response of the SIM application on the UICC to authentication 231 * challenge/response algorithm. The data string and challenge response are 232 * Base64 encoded Strings. 233 * Can support EAP-SIM, EAP-AKA with results encoded per 3GPP TS 31.102. 234 * 235 * @param subId subscription ID to be queried 236 * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) 237 * @param authType Authentication type, see PhoneConstants#AUTHTYPE_xxx 238 * @param data authentication challenge data 239 * @return challenge response 240 */ getIccSimChallengeResponse(int subId, int appType, int authType, String data, String callingPackage, String callingFeatureId)241 String getIccSimChallengeResponse(int subId, int appType, int authType, String data, 242 String callingPackage, String callingFeatureId); 243 244 /** 245 * Fetches the EF_PSISMSC value from the UICC that contains the Public Service Identity of 246 * the SM-SC (either a SIP URI or tel URI). The EF_PSISMSC of ISIM and USIM can be found in 247 * DF_TELECOM. 248 * The EF_PSISMSC value is used by the ME to submit SMS over IP as defined in 24.341 [55]. 249 * 250 * @return Uri : Public Service Identity of SM-SC 251 * @throws SecurityException if the caller does not have the required permission/privileges 252 * @hide 253 */ 254 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") getSmscIdentity(int subId, int appType)255 Uri getSmscIdentity(int subId, int appType); 256 257 /** 258 * Fetches the sim service table from the EFUST/EFIST based on the application type 259 * {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. The return value is hexaString format 260 * representing X bytes (x >= 1). Each bit of every byte indicates which optional services 261 * are available for the given application type. 262 * The USIM service table EF is described in as per Section 4.2.8 of 3GPP TS 31.102. 263 * The ISIM service table EF is described in as per Section 4.2.7 of 3GPP TS 31.103. 264 * The list of services mapped to the exact nth byte of response as mentioned in Section 4.2 265 * .7 of 3GPP TS 31.103. Eg. Service n°1: Local Phone Book, Service n°2: Fixed Dialling 266 * Numbers (FDN) - Bit 1 and 2 of the 1st Byte represent service Local Phone Book and Fixed 267 * Dialling Numbers (FDN)respectively. The coding format for each service type should be 268 * interpreted as bit = 1: service available;bit = 0:service not available. 269 * 270 * @param appType of type int of either {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. 271 * @return HexString represents sim service table else null. 272 * @throws SecurityException if the caller does not have the required permission/privileges 273 * @throws IllegalStateException in case if phone or UiccApplication is not available. 274 * @hide 275 */ 276 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") getSimServiceTable(int subId, int appType)277 String getSimServiceTable(int subId, int appType); 278 } 279