diff options
| author | 2020-01-21 20:00:41 -0800 | |
|---|---|---|
| committer | 2021-01-11 19:46:18 +0000 | |
| commit | a13fc7f314ac56e75eca09c94db8090f928023ff (patch) | |
| tree | 250c9c17530746e47022d29d7ba884c997f9982d | |
| parent | 1a96cae4218853264f76301e568879f02f5b3696 (diff) | |
Update the getIccId docs to reflect access requirements
In Android 10 access to device identifiers was limited to apps with
the READ_PRIVILEGED_PHONE_STATE permission, carrier privileges, the
READ_DEVICE_IDENTIFIERS appop set to allow, or those that pass a
device / profile owner check. TelephonyManager#getSimSerialNumber
was guarded behind these new access requirements, but the same value
is still accessible via SubscriptionInfo#getIccId. This change
updates the documentation to reflect that the getIccId will no
longer be accessible if the caller does not meet the new access
requirements.
Bug: 131909991
Bug: 173421434
Test: Builds
Change-Id: I03072c65e1c7101538a7a20541d2ac59a2d213e3
Merged-In: I03072c65e1c7101538a7a20541d2ac59a2d213e3
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionInfo.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index 1e6cd474d13b..d34b8c932f77 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -38,6 +38,8 @@ import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; +import com.android.telephony.Rlog; + import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -201,6 +203,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 +286,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() { |