diff options
| author | 2024-11-28 06:16:35 +0000 | |
|---|---|---|
| committer | 2024-11-28 06:16:35 +0000 | |
| commit | 6801f23cee4d234d7a4a3385ef6d3de421bcdfdb (patch) | |
| tree | f0ffd4f3c7b70d4b8288a752f89efc13dfcf4863 | |
| parent | 6e8799b58a6f931a51e5216146239753a646e1fd (diff) | |
| parent | 97b1176de2fccd52d3a6ec7a1a99f14178a3e7c9 (diff) | |
Merge "New System Api: getGroupIdLevel2" into main
| -rw-r--r-- | core/api/system-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 30 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl | 6 |
3 files changed, 37 insertions, 0 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index d7010ae54072..a7a5f366addc 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -16271,6 +16271,7 @@ package android.telephony { method @FlaggedApi("android.permission.flags.get_emergency_role_holder_api_enabled") @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getEmergencyAssistancePackageName(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEmergencyNumberDbVersion(); + method @FlaggedApi("com.android.internal.telephony.flags.get_group_id_level2") @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getGroupIdLevel2(); method @FlaggedApi("com.android.internal.telephony.flags.support_isim_record") @NonNull @RequiresPermission(value=android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, conditional=true) public java.util.List<java.lang.String> getImsPcscfAddresses(); method @FlaggedApi("com.android.internal.telephony.flags.support_isim_record") @Nullable @RequiresPermission(android.Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER) public String getImsPrivateUserIdentity(); method @FlaggedApi("com.android.internal.telephony.flags.support_isim_record") @NonNull @RequiresPermission(value=android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, conditional=true) public java.util.List<android.net.Uri> getImsPublicUserIdentities(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ad5d42ad5a68..024d7f580a53 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5251,6 +5251,36 @@ public class TelephonyManager { } /** + * Returns the Group Identifier Level 2 in hexadecimal format. + * @return the Group Identifier Level 2 for the SIM card. + * Return null if it is unavailable. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ + @FlaggedApi(Flags.FLAG_GET_GROUP_ID_LEVEL2) + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) + @SystemApi + @Nullable + public String getGroupIdLevel2() { + try { + IPhoneSubInfo info = getSubscriberInfoService(); + if (info == null) { + return null; + } + return info.getGroupIdLevel2ForSubscriber(getSubId(), mContext.getOpPackageName(), + mContext.getAttributionTag()); + } catch (RemoteException ex) { + return null; + } catch (NullPointerException ex) { + // This could happen before phone restarts due to crashing + return null; + } + } + + /** * Returns the phone number string for line 1, for example, the MSISDN * for a GSM phone for a particular subscription. Return null if it is unavailable. * <p> diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index 974cc14ae444..71327dcfc3b1 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -83,6 +83,12 @@ interface IPhoneSubInfo { String getGroupIdLevel1ForSubscriber(int subId, String callingPackage, String callingFeatureId); + /** + * Retrieves the Group Identifier Level1 for GSM phones of a subId. + */ + String getGroupIdLevel2ForSubscriber(int subId, String callingPackage, + String callingFeatureId); + /** @deprecared Use {@link getIccSerialNumberWithFeature(String, String)} instead */ @UnsupportedAppUsage String getIccSerialNumber(String callingPackage); |