summaryrefslogtreecommitdiff
path: root/telephony
diff options
context:
space:
mode:
authorChiachang Wang <chiachangwang@google.com>2020-12-22 11:22:58 +0800
committerChiachang Wang <chiachangwang@google.com>2020-12-22 11:22:58 +0800
commit228306b008a97eab6841a1cb9c93b750f2e18bb2 (patch)
treee099db2e0d27800ed6c185a7eecc097fe6e71664 /telephony
parent4ba82f5dba48100b6050a1c18af3ac9f652123bb (diff)
Create getMobileProvisioningUrl in telephony
ConnectivityService is going to become mainline and can not access hidden APIs. Telephony and Settings were both accessing the hidden API ConnectivityManager#getMobileProvisioningUrl. Moving #getMobileProvisioningUrl method into telephony means that there is one less access to a hidden API within the overall framework since the connectivity stack never needed this value. Thus, add getMobileProvisioningUrl() to telephony surface to replace the one in connectivity stack. Bug: 175177794 Test: atest FrameworksTelephonyTests Change-Id: Icff8bf39b168b28f972b6737e4e7be8fc86b3dee
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java29
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl6
2 files changed, 35 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 26fd99de0a04..81d78d642a6d 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -9275,6 +9275,35 @@ public class TelephonyManager {
}
/**
+ * Get the mobile provisioning url that is used to launch a browser to allow users to manage
+ * their mobile plan.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE}.
+ *
+ * TODO: The legacy design only supports single sim design. Ideally, this should support
+ * multi-sim design in current world.
+ *
+ * {@hide}
+ */
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public @Nullable String getMobileProvisioningUrl() {
+ try {
+ final ITelephony service = getITelephony();
+ if (service != null) {
+ return service.getMobileProvisioningUrl();
+ } else {
+ throw new IllegalStateException("telephony service is null.");
+ }
+ } catch (RemoteException ex) {
+ if (!isSystemProcess()) {
+ ex.rethrowAsRuntimeException();
+ }
+ }
+ return null;
+ }
+
+ /**
* Turns mobile data on or off.
* If this object has been created with {@link #createForSubscriptionId}, applies to the given
* subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 7c5047c2deaf..33acc159e18a 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -2352,4 +2352,10 @@ interface ITelephony {
* Gets the config of RCS VoLTE single registration enabled for the carrier/subscription.
*/
boolean getCarrierSingleRegistrationEnabled(int subId);
+
+ /**
+ * Return the mobile provisioning url that is used to launch a browser to allow users to manage
+ * their mobile plan.
+ */
+ String getMobileProvisioningUrl();
}