From 4ece3db113808ee479dfd1ef857c63de04576c22 Mon Sep 17 00:00:00 2001 From: Malcolm Chen Date: Mon, 16 Dec 2019 14:01:50 -0800 Subject: Expose setUiccApplicationsEnabled as @SystemApi for eSIM to call upon slot mapping change. Because currently we rely on eSIM module to do handle some slot mapping change and single to dual SIM config change, eSIM needs to also make sure uicc applications are enabled for certain scenarios. So we expose the SubscriptionManager#setUiccApplicationsEnabled as @SystemApi Bug: 141018421 Test: unittest Change-Id: I9844e71260ea009afd0928a0f4be4426e7d12358 Merged-In: I9844e71260ea009afd0928a0f4be4426e7d12358 --- api/system-current.txt | 1 + .../android/telephony/SubscriptionManager.java | 28 ++++++++++++++++++++++ .../java/com/android/internal/telephony/ISub.aidl | 2 ++ 3 files changed, 31 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index a39394dae45e..038ed605cf06 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8927,6 +8927,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultVoiceSubscriptionId(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPreferredDataSubscriptionId(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int, boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUiccApplicationsEnabled(boolean, int); field @RequiresPermission(android.Manifest.permission.MANAGE_SUBSCRIPTION_PLANS) public static final String ACTION_SUBSCRIPTION_PLANS_CHANGED = "android.telephony.action.SUBSCRIPTION_PLANS_CHANGED"; field @NonNull public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI; field public static final int PROFILE_CLASS_DEFAULT = -1; // 0xffffffff diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 2ee0be19e36c..15c1807cd532 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -3166,6 +3166,34 @@ public class SubscriptionManager { return false; } + /** + * Set uicc applications being enabled or disabled. + * The value will be remembered on the subscription and will be applied whenever it's present. + * If the subscription in currently present, it will also apply the setting to modem + * immediately. + * + * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required + * + * @param enabled whether uicc applications are enabled or disabled. + * @param subscriptionId which subscription to operate on. + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + public void setUiccApplicationsEnabled(boolean enabled, int subscriptionId) { + if (VDBG) { + logd("setUiccApplicationsEnabled subId= " + subscriptionId + " enable " + enabled); + } + try { + ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); + if (iSub != null) { + iSub.setUiccApplicationsEnabled(enabled, subscriptionId); + } + } catch (RemoteException ex) { + // ignore it + } + } + /** * Whether it's supported to disable / re-enable a subscription on a physical (non-euicc) SIM. * diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index 92aab4b12330..5a26232c8892 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -285,4 +285,6 @@ interface ISub { int getActiveDataSubscriptionId(); boolean canDisablePhysicalSubscription(); + + int setUiccApplicationsEnabled(boolean enabled, int subscriptionId); } -- cgit v1.2.3-59-g8ed1b