diff options
author | 2022-11-23 14:53:53 -0800 | |
---|---|---|
committer | 2023-03-03 21:41:57 -0800 | |
commit | b69a772758c57a7cc40674f56b4f35c3aab2b01e (patch) | |
tree | 5f16bd9426bc58d5a6700c6594b22f62e9011dca | |
parent | 4f4c9a48f59ad837beb69d1d0ec7283b2fefa418 (diff) |
Added few more APIs support
Added getAllSubscriptionInfoList and setPhoneNumber support. Allowed
carrier privilege apps to get full subscription info on their
associated subscriptions.
Bug: 239607619
Test: atest SubscriptionManagerServiceTest
Merged-In: Id3c0f3afc7a5fc95beb4dde0c570520626244761
Change-Id: Id3c0f3afc7a5fc95beb4dde0c570520626244761
-rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index eade18652db4..682bd9cb868e 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -1640,17 +1640,33 @@ public class SubscriptionManager { } /** - * @return List of all SubscriptionInfo records in database, - * include those that were inserted before, maybe empty but not null. + * Get all subscription info records from SIMs that are inserted now or were inserted before. + * + * <p> + * If the caller does not have {@link Manifest.permission#READ_PHONE_NUMBERS} permission, + * {@link SubscriptionInfo#getNumber()} will return empty string. + * If the caller does not have {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER}, + * {@link SubscriptionInfo#getIccId()} and {@link SubscriptionInfo#getCardString()} will return + * empty string, and {@link SubscriptionInfo#getGroupUuid()} will return {@code null}. + * + * <p> + * The carrier app will always have full {@link SubscriptionInfo} for the subscriptions + * that it has carrier privilege. + * + * @return List of all {@link SubscriptionInfo} records from SIMs that are inserted or + * inserted before. Sorted by {@link SubscriptionInfo#getSimSlotIndex()}, then + * {@link SubscriptionInfo#getSubscriptionId()}. + * * @hide */ + @RequiresPermission(anyOf = { + Manifest.permission.READ_PHONE_STATE, + Manifest.permission.READ_PRIVILEGED_PHONE_STATE, + "carrier privileges", + }) @NonNull - @UnsupportedAppUsage public List<SubscriptionInfo> getAllSubscriptionInfoList() { - if (VDBG) logd("[getAllSubscriptionInfoList]+"); - List<SubscriptionInfo> result = null; - try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { @@ -3400,7 +3416,6 @@ public class SubscriptionManager { /** * Get subscriptionInfo list of subscriptions that are in the same group of given subId. - * See {@link #createSubscriptionGroup(List)} for more details. * * Caller must have {@link android.Manifest.permission#READ_PHONE_STATE} * or carrier privilege permission on the subscription. @@ -4097,6 +4112,26 @@ public class SubscriptionManager { } /** + * Convert phone number source to string. + * + * @param source The phone name source. + * + * @return The phone name source in string format. + * + * @hide + */ + @NonNull + public static String phoneNumberSourceToString(@PhoneNumberSource int source) { + switch (source) { + case SubscriptionManager.PHONE_NUMBER_SOURCE_UICC: return "UICC"; + case SubscriptionManager.PHONE_NUMBER_SOURCE_CARRIER: return "CARRIER"; + case SubscriptionManager.PHONE_NUMBER_SOURCE_IMS: return "IMS"; + default: + return "UNKNOWN(" + source + ")"; + } + } + + /** * Convert display name source to string. * * @param source The display name source. |