diff options
| -rw-r--r-- | data/etc/privapp-permissions-platform.xml | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionInfo.java | 48 |
2 files changed, 46 insertions, 3 deletions
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index ff4e1005c9d9..364828023305 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -177,6 +177,7 @@ applications that come with the platform <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/> <permission name="android.permission.INTERACT_ACROSS_USERS"/> <permission name="android.permission.MANAGE_USERS"/> + <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/> <permission name="android.permission.UPDATE_APP_OPS_STATS"/> <permission name="android.permission.USE_RESERVED_DISK"/> </privapp-permissions> diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index 1e6cd474d13b..fcfc728b2c7b 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -201,6 +201,19 @@ public class SubscriptionInfo implements Parcelable { private int mSubscriptionType; /** + * Public copy constructor. + * @hide + */ + public SubscriptionInfo(SubscriptionInfo info) { + this(info.mId, info.mIccId, info.mSimSlotIndex, info.mDisplayName, info.mCarrierName, + info.mNameSource, info.mIconTint, info.mNumber, info.mDataRoaming, info.mIconBitmap, + info.mMcc, info.mMnc, info.mCountryIso, info.mIsEmbedded, info.mAccessRules, + info.mCardString, info.mCardId, info.mIsOpportunistic, + info.mGroupUUID == null ? null : info.mGroupUUID.toString(), info.mIsGroupDisabled, + info.mCarrierId, info.mProfileClass, info.mSubscriptionType, info.mGroupOwner); + } + + /** * @hide */ public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName, @@ -271,13 +284,27 @@ public class SubscriptionInfo implements Parcelable { } /** - * @return the ICC ID. + * Returns the ICC ID if the calling app has been granted the READ_PRIVILEGED_PHONE_STATE + * permission, has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}), or + * is a device owner or profile owner that has been granted the READ_PHONE_STATE permission. + * The profile owner is an app that owns a managed profile on the device; for more details see + * <a href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile + * owner access is deprecated and will be removed in a future release. + * + * @return the ICC ID, or an empty string if one of these requirements is not met */ public String getIccId() { return this.mIccId; } /** + * @hide + */ + public void clearIccId() { + this.mIccId = ""; + } + + /** * @return the slot index of this Subscription's SIM card. */ public int getSimSlotIndex() { @@ -600,8 +627,16 @@ public class SubscriptionInfo implements Parcelable { } /** - * @return the card string of the SIM card which contains the subscription. The card string is - * the ICCID for UICCs or the EID for eUICCs. + * Returns the card string if the calling app has been granted the READ_PRIVILEGED_PHONE_STATE + * permission, has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}), or + * is a device owner or profile owner on an organization owned device that has been granted the + * READ_PHONE_STATE permission. The profile owner is an app that owns a managed profile on the + * device; for more details see <a href="https://developer.android.com/work/managed-profiles"> + * Work profiles</a>. + * + * @return the card string of the SIM card which contains the subscription or an empty string + * if these requirements are not met. The card string is the ICCID for UICCs or the EID for + * eUICCs. * @hide * //TODO rename usages in LPA: UiccSlotUtil.java, UiccSlotsManager.java, UiccSlotInfoTest.java */ @@ -610,6 +645,13 @@ public class SubscriptionInfo implements Parcelable { } /** + * @hide + */ + public void clearCardString() { + this.mCardString = ""; + } + + /** * Returns the card ID of the SIM card which contains the subscription (see * {@link UiccCardInfo#getCardId()}. * @return the cardId |