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 /** 87 * Retrieves the Group Identifier Level1 for GSM phones of a subId. 88 */ getGroupIdLevel2ForSubscriber(int subId, String callingPackage, String callingFeatureId)89 String getGroupIdLevel2ForSubscriber(int subId, String callingPackage, 90 String callingFeatureId); 91 92 /** @deprecared Use {@link getIccSerialNumberWithFeature(String, String)} instead */ 93 @UnsupportedAppUsage getIccSerialNumber(String callingPackage)94 String getIccSerialNumber(String callingPackage); 95 96 /** 97 * Retrieves the serial number of the ICC, if applicable. 98 */ getIccSerialNumberWithFeature(String callingPackage, String callingFeatureId)99 String getIccSerialNumberWithFeature(String callingPackage, String callingFeatureId); 100 101 /** 102 * Retrieves the serial number of a given subId. 103 */ getIccSerialNumberForSubscriber(int subId, String callingPackage, String callingFeatureId)104 String getIccSerialNumberForSubscriber(int subId, String callingPackage, 105 String callingFeatureId); 106 107 /** 108 * Retrieves the phone number string for line 1. 109 */ getLine1Number(String callingPackage, String callingFeatureId)110 String getLine1Number(String callingPackage, String callingFeatureId); 111 112 /** 113 * Retrieves the phone number string for line 1 of a subcription. 114 */ getLine1NumberForSubscriber(int subId, String callingPackage, String callingFeatureId)115 String getLine1NumberForSubscriber(int subId, String callingPackage, String callingFeatureId); 116 117 118 /** 119 * Retrieves the alpha identifier for line 1. 120 */ getLine1AlphaTag(String callingPackage, String callingFeatureId)121 String getLine1AlphaTag(String callingPackage, String callingFeatureId); 122 123 /** 124 * Retrieves the alpha identifier for line 1 of a subId. 125 */ getLine1AlphaTagForSubscriber(int subId, String callingPackage, String callingFeatureId)126 String getLine1AlphaTagForSubscriber(int subId, String callingPackage, 127 String callingFeatureId); 128 129 130 /** 131 * Retrieves MSISDN Number. 132 */ getMsisdn(String callingPackage, String callingFeatureId)133 String getMsisdn(String callingPackage, String callingFeatureId); 134 135 /** 136 * Retrieves the Msisdn of a subId. 137 */ getMsisdnForSubscriber(int subId, String callingPackage, String callingFeatureId)138 String getMsisdnForSubscriber(int subId, String callingPackage, String callingFeatureId); 139 140 /** 141 * Retrieves the voice mail number. 142 */ getVoiceMailNumber(String callingPackage, String callingFeatureId)143 String getVoiceMailNumber(String callingPackage, String callingFeatureId); 144 145 /** 146 * Retrieves the voice mail number of a given subId. 147 */ getVoiceMailNumberForSubscriber(int subId, String callingPackage, String callingFeatureId)148 String getVoiceMailNumberForSubscriber(int subId, String callingPackage, 149 String callingFeatureId); 150 151 /** 152 * Retrieves the Carrier information used to encrypt IMSI and IMPI. 153 */ getCarrierInfoForImsiEncryption(int subId, int keyType, String callingPackage)154 ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int subId, int keyType, 155 String callingPackage); 156 157 /** 158 * Stores the Carrier information used to encrypt IMSI and IMPI. 159 */ setCarrierInfoForImsiEncryption(int subId, String callingPackage, in ImsiEncryptionInfo imsiEncryptionInfo)160 void setCarrierInfoForImsiEncryption(int subId, String callingPackage, 161 in ImsiEncryptionInfo imsiEncryptionInfo); 162 163 /** 164 * Resets the Carrier Keys in the database. This involves 2 steps: 165 * 1. Delete the keys from the database. 166 * 2. Send an intent to download new Certificates. 167 */ resetCarrierKeysForImsiEncryption(int subId, String callingPackage)168 void resetCarrierKeysForImsiEncryption(int subId, String callingPackage); 169 170 /** 171 * Retrieves the alpha identifier associated with the voice mail number. 172 */ getVoiceMailAlphaTag(String callingPackage, String callingFeatureId)173 String getVoiceMailAlphaTag(String callingPackage, String callingFeatureId); 174 175 /** 176 * Retrieves the alpha identifier associated with the voice mail number 177 * of a subId. 178 */ getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage, String callingFeatureId)179 String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage, 180 String callingFeatureId); 181 182 /** 183 * Returns the IMS private user identity (IMPI) that was loaded from the ISIM. 184 * @return the IMPI, or null if not present or not loaded 185 */ getIsimImpi(int subId)186 String getIsimImpi(int subId); 187 188 /** 189 * Fetches the ISIM PrivateUserIdentity (EF_IMPI) based on subId 190 * 191 * @param subId subscriptionId 192 * @return IMPI (IMS private user identity) of type string or null if EF_IMPI is not available. 193 * @throws IllegalArgumentException if the subscriptionId is not valid 194 * @throws IllegalStateException in case the ISIM hasn’t been loaded. 195 * @throws SecurityException if the caller does not have the required permission 196 */ 197 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" 198 + "android.Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER)") getImsPrivateUserIdentity(int subId, String callingPackage, String callingFeatureId)199 String getImsPrivateUserIdentity(int subId, String callingPackage, String callingFeatureId); 200 201 /** 202 * Returns the IMS home network domain name that was loaded from the ISIM. 203 * @return the IMS domain name, or null if not present or not loaded 204 */ getIsimDomain(int subId)205 String getIsimDomain(int subId); 206 207 /** 208 * Returns the IMS public user identities (IMPU) that were loaded from the ISIM. 209 * @return an array of IMPU strings, with one IMPU per string, or null if 210 * not present or not loaded 211 */ getIsimImpu(int subId)212 String[] getIsimImpu(int subId); 213 214 /** 215 * Fetches the ISIM public user identities (EF_IMPU) from UICC based on subId 216 */ 217 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" 218 + "android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") getImsPublicUserIdentities(int subId, String callingPackage)219 List<Uri> getImsPublicUserIdentities(int subId, String callingPackage); 220 221 /** 222 * Returns the IMS Service Table (IST) that was loaded from the ISIM. 223 * @return IMS Service Table or null if not present or not loaded 224 */ getIsimIst(int subId)225 String getIsimIst(int subId); 226 227 /** 228 * Returns the IMS Proxy Call Session Control Function(PCSCF) that were loaded from the ISIM. 229 * @return an array of PCSCF strings with one PCSCF per string, or null if 230 * not present or not loaded 231 */ getIsimPcscf(int subId)232 String[] getIsimPcscf(int subId); 233 234 /** 235 * Fetches IMS Proxy Call Session Control Function(P-CSCF) based on the subscription. 236 * 237 * @param subId subscriptionId 238 * @param callingPackage package name of the caller 239 * @return List of IMS Proxy Call Session Control Function strings. 240 * @throws IllegalArgumentException if the subscriptionId is not valid 241 * @throws IllegalStateException in case the ISIM hasn’t been loaded. 242 * @throws SecurityException if the caller does not have the required permission 243 */ 244 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(" 245 + "android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") getImsPcscfAddresses(int subId, String callingPackage)246 List<String> getImsPcscfAddresses(int subId, String callingPackage); 247 248 /** 249 * Returns the response of the SIM application on the UICC to authentication 250 * challenge/response algorithm. The data string and challenge response are 251 * Base64 encoded Strings. 252 * Can support EAP-SIM, EAP-AKA with results encoded per 3GPP TS 31.102. 253 * 254 * @param subId subscription ID to be queried 255 * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) 256 * @param authType Authentication type, see PhoneConstants#AUTHTYPE_xxx 257 * @param data authentication challenge data 258 * @return challenge response 259 */ getIccSimChallengeResponse(int subId, int appType, int authType, String data, String callingPackage, String callingFeatureId)260 String getIccSimChallengeResponse(int subId, int appType, int authType, String data, 261 String callingPackage, String callingFeatureId); 262 263 /** 264 * Fetches the EF_PSISMSC value from the UICC that contains the Public Service Identity of 265 * the SM-SC (either a SIP URI or tel URI). The EF_PSISMSC of ISIM and USIM can be found in 266 * DF_TELECOM. 267 * The EF_PSISMSC value is used by the ME to submit SMS over IP as defined in 24.341 [55]. 268 * 269 * @return Uri : Public Service Identity of SM-SC 270 * @throws SecurityException if the caller does not have the required permission/privileges 271 * @hide 272 */ 273 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") getSmscIdentity(int subId, int appType)274 Uri getSmscIdentity(int subId, int appType); 275 276 /** 277 * Fetches the sim service table from the EFUST/EFIST based on the application type 278 * {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. The return value is hexaString format 279 * representing X bytes (x >= 1). Each bit of every byte indicates which optional services 280 * are available for the given application type. 281 * The USIM service table EF is described in as per Section 4.2.8 of 3GPP TS 31.102. 282 * The ISIM service table EF is described in as per Section 4.2.7 of 3GPP TS 31.103. 283 * The list of services mapped to the exact nth byte of response as mentioned in Section 4.2 284 * .7 of 3GPP TS 31.103. Eg. Service n°1: Local Phone Book, Service n°2: Fixed Dialling 285 * Numbers (FDN) - Bit 1 and 2 of the 1st Byte represent service Local Phone Book and Fixed 286 * Dialling Numbers (FDN)respectively. The coding format for each service type should be 287 * interpreted as bit = 1: service available;bit = 0:service not available. 288 * 289 * @param appType of type int of either {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. 290 * @return HexString represents sim service table else null. 291 * @throws SecurityException if the caller does not have the required permission/privileges 292 * @throws IllegalStateException in case if phone or UiccApplication is not available. 293 * @hide 294 */ 295 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") getSimServiceTable(int subId, int appType)296 String getSimServiceTable(int subId, int appType); 297 } 298