From 77d7d6f76dc444702ffae6480d285c0191a089fc Mon Sep 17 00:00:00 2001 From: Michael Groover Date: Fri, 20 Mar 2020 21:16:12 -0700 Subject: [PATCH] Update SubInfo#getNumber docs to reflect permission requirement getLine1Number has been moved out of the READ_PHONE_STATE permission, but callers with READ_PHONE_STATE can still query SubscriptionInfo which contains the number for the subscription. The number will be sanitized from the resulting SubscriptionInfo object(s); this change updates the docs to reflect the new READ_PHONE_NUMBERS permission requirement. Bug: 152063877 Test: atest SubscriptionControllerTest Change-Id: If4834ad0f648556207ad9b848fc4db332993a6d6 --- telephony/java/android/telephony/SubscriptionInfo.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index a6c5c3ba932b..35464340550b 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -449,12 +449,20 @@ public class SubscriptionInfo implements Parcelable { } /** - * @return the number of this subscription. + * @return the number of this subscription if the calling app has been granted the + * READ_PHONE_NUMBERS permission, or an empty string otherwise */ public String getNumber() { return mNumber; } + /** + * @hide + */ + public void clearNumber() { + mNumber = ""; + } + /** * @return the data roaming state for this subscription, either * {@link SubscriptionManager#DATA_ROAMING_ENABLE} or {@link SubscriptionManager#DATA_ROAMING_DISABLE}.