summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alireza Forouzan <alirezaf@google.com> 2021-03-22 17:57:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-03-22 17:57:57 +0000
commitfefc85a46b72a3c36c8650e62bb97a1f9919d7e5 (patch)
tree0641049525dbe70dac3a1cfe3238e1ecfce221e4
parented21f7f9e6ac3ada1bfc0d145fa1bab46f5802f5 (diff)
parent32d484c8e0745e3f5141410d67d68270dc76355d (diff)
Merge "Add an API to getPhoneAccountHandle for a TelephonyManager" into sc-dev
-rw-r--r--core/api/current.txt1
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java19
2 files changed, 20 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 001e960d2867..dad2d7db015d 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -42364,6 +42364,7 @@ package android.telephony {
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getNetworkSlicingConfiguration(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.telephony.data.SlicingConfig,android.telephony.TelephonyManager.SlicingException>);
method public String getNetworkSpecifier();
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
+ method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
method @Deprecated public int getPhoneCount();
method public int getPhoneType();
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index a7f62042b60c..d3246ca8ba6c 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -11037,6 +11037,25 @@ public class TelephonyManager {
}
/**
+ * Determines the {@link PhoneAccountHandle} associated with this TelephonyManager.
+ *
+ * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
+ * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
+ *
+ * <p>Requires Permission android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE or that the
+ * calling app has carrier privileges (see {@link #hasCarrierPrivileges})
+ *
+ * @return The {@link PhoneAccountHandle} associated with the TelphonyManager, or {@code null}
+ * if there is no associated {@link PhoneAccountHandle}; this can happen if the subscription is
+ * data-only or an opportunistic subscription.
+ */
+ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public @Nullable PhoneAccountHandle getPhoneAccountHandle() {
+ return getPhoneAccountHandleForSubscriptionId(getSubId());
+ }
+
+ /**
* Determines the {@link PhoneAccountHandle} associated with a subscription Id.
*
* @param subscriptionId The subscription Id to check.