IMPI system API implementation

Bug:237347020
Test: atest frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony

Change-Id: Idba7dbd021668edcdede72f03968486e891317a2
This commit is contained in:
arunvoddu
2022-11-16 08:57:46 +00:00
parent 64ecf87bb4
commit e11231df3b
2 changed files with 43 additions and 0 deletions

View File

@@ -6000,6 +6000,7 @@ public class TelephonyManager {
* Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
* @return the IMPI, or null if not present or not loaded
* @hide
* @deprecated use {@link #getImsPrivateUserIdentity()}
*/
@UnsupportedAppUsage
public String getIsimImpi() {
@@ -6017,6 +6018,35 @@ public class TelephonyManager {
}
}
/**
* Returns the IMS private user identity (IMPI) of the subscription that was loaded from the
* ISIM records {@link #APPTYPE_ISIM}. This value is fetched from the Elementary file EF_IMPI.
* The contents of the file is a <b>Ip Multimedia Service Private User Identity</b> of the user
* as defined in the section 4.2.2 of 3GPP TS 131 103.
*
* @return IMPI (IMS private user identity) of type string.
* @throws IllegalStateException in case the ISIM has’t been loaded
* @throws SecurityException if the caller does not have the required permission/privileges
* @hide
*/
@NonNull
@RequiresPermission(android.Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER)
@RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION)
public String getImsPrivateUserIdentity() {
try {
IPhoneSubInfo info = getSubscriberInfoService();
if (info == null) {
Rlog.e(TAG, "getImsPrivateUserIdentity(): IPhoneSubInfo instance is NULL");
throw new RuntimeException("IMPI error: Subscriber Info is null");
}
return info.getImsPrivateUserIdentity(getSubId(), getOpPackageName(),
getAttributionTag());
} catch (RemoteException | NullPointerException | IllegalArgumentException ex) {
Rlog.e(TAG, "getImsPrivateUserIdentity() Exception = " + ex);
throw new RuntimeException(ex.getMessage());
}
}
/**
* Returns the IMS home network domain name that was loaded from the ISIM {@see #APPTYPE_ISIM}.
* @return the IMS domain name. Returns {@code null} if ISIM hasn't been loaded or IMS domain

View File

@@ -179,6 +179,19 @@ interface IPhoneSubInfo {
*/
String getIsimImpi(int subId);
/**
* Fetches the ISIM PrivateUserIdentity (EF_IMPI) based on subId
*
* @param subId subscriptionId
* @return IMPI (IMS private user identity) of type string or null if EF_IMPI is not available.
* @throws IllegalArgumentException if the subscriptionId is not valid
* @throws IllegalStateException in case the ISIM hasn’t been loaded.
* @throws SecurityException if the caller does not have the required permission
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
+ "android.Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER)")
String getImsPrivateUserIdentity(int subId, String callingPackage, String callingFeatureId);
/**
* Returns the IMS home network domain name that was loaded from the ISIM.
* @return the IMS domain name, or null if not present or not loaded