From 1c1bc30ce345f770de44b4348420e860d0958534 Mon Sep 17 00:00:00 2001 From: Michael Groover Date: Wed, 19 Feb 2020 23:37:42 -0800 Subject: [PATCH 1/2] Whitelist READ_PRIVILEGED_PHONE_STATE for the contacts provider In Android 10 access to device identifiers was moved from a runtime permission to the privileged READ_PRIVILEGED_PHONE_STATE permission. One of the non-resettable identifiers missed was SubscriptionInfo# getIccId. The contacts provider currently uses this ID to upgrade to version 1003 of the database; to ensure there are no issues with this upgrade this permission is being whitelisted for the contacts provider. Bug: 131909991 Bug: 173421434 Test: atest ContactsProviderTests Change-Id: I7574f787a7e55aa0337237b9fe916ee143a2f697 Merged-In: I7574f787a7e55aa0337237b9fe916ee143a2f697 --- data/etc/privapp-permissions-platform.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index ff4e1005c9d98..3648280233053 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 + From 5aba70130d3539fc77cfdfb4b550d8e86acd8a60 Mon Sep 17 00:00:00 2001 From: Michael Groover Date: Fri, 20 Mar 2020 13:13:36 -0700 Subject: [PATCH 2/2] Add method to clear out SubscriptionInfo#getCardString In Androird 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 as the cardString from the SubscriptionInfo. While getCardString is a hidden API SubscriptionInfo#toString can be used to obtain this value. Bug: 152057778 Bug: 173421434 Test: atest SubscriptionControllerTest Change-Id: I9b8786a321b1ba79d81b74c3041589f30df8e9c8 Merged-In: I9b8786a321b1ba79d81b74c3041589f30df8e9c8 --- .../android/telephony/SubscriptionInfo.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index d34b8c932f77d..fcfc728b2c7be 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -38,8 +38,6 @@ 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; @@ -629,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 + * Work profiles. + * + * @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 */ @@ -638,6 +644,13 @@ public class SubscriptionInfo implements Parcelable { return this.mCardString; } + /** + * @hide + */ + public void clearCardString() { + this.mCardString = ""; + } + /** * Returns the card ID of the SIM card which contains the subscription (see * {@link UiccCardInfo#getCardId()}.