TelecomManager#getSelfManagedPA comments update (3/3)
bug: 209839019
Test: CTS
Change-Id: I152e0ee7bd749598a1822f34566b66a50df04863
diff --git a/core/api/current.txt b/core/api/current.txt
index f4797db..a094a61 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -41073,7 +41073,7 @@
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(String);
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}, conditional=true) public String getLine1Number(android.telecom.PhoneAccountHandle);
method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
- method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
+ method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.MANAGE_OWN_CALLS}) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
method public android.telecom.PhoneAccountHandle getSimCallManager();
method @Nullable public android.telecom.PhoneAccountHandle getSimCallManagerForSubscription(int);
method @Nullable public String getSystemDialerPackage();
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 6279bf8..ecb8595 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1294,14 +1294,24 @@
* {@link PhoneAccount#CAPABILITY_SELF_MANAGED}.
* <p>
* Requires permission {@link android.Manifest.permission#READ_PHONE_STATE}, or that the caller
- * is the default dialer app.
+ * is the default dialer app to get all phone account handles.
+ * <P>
+ * If the caller doesn't meet any of the above requirements and has {@link
+ * android.Manifest.permission#MANAGE_OWN_CALLS}, the caller can get only the phone account
+ * handles they have registered.
* <p>
- * A {@link SecurityException} will be thrown if a called is not the default dialer, or lacks
- * the {@link android.Manifest.permission#READ_PHONE_STATE} permission.
+ * A {@link SecurityException} will be thrown if the caller is not the default dialer
+ * or the caller does not have at least one of the following permissions:
+ * {@link android.Manifest.permission#READ_PHONE_STATE} permission,
+ * {@link android.Manifest.permission#MANAGE_OWN_CALLS} permission
*
* @return A list of {@code PhoneAccountHandle} objects.
*/
- @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
+ @RequiresPermission(anyOf = {
+ READ_PRIVILEGED_PHONE_STATE,
+ android.Manifest.permission.READ_PHONE_STATE,
+ android.Manifest.permission.MANAGE_OWN_CALLS
+ })
public List<PhoneAccountHandle> getSelfManagedPhoneAccounts() {
ITelecomService service = getTelecomService();
if (service != null) {