From b44763419b10c936f0020555782cfd7588bdbeae Mon Sep 17 00:00:00 2001 From: Malcolm Chen Date: Mon, 16 Dec 2019 14:01:50 -0800 Subject: [PATCH] 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 --- api/system-current.txt | 1 + .../telephony/SubscriptionManager.java | 28 +++++++++++++++++++ .../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 609faa89ecdbd..319efa121c078 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -9891,6 +9891,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 f08e1ec38cdaa..15398ca80cc29 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -3174,6 +3174,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 c5d58ac24904f..cc02a409c16db 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -300,4 +300,6 @@ interface ISub { int getActiveDataSubscriptionId(); boolean canDisablePhysicalSubscription(); + + int setUiccApplicationsEnabled(boolean enabled, int subscriptionId); }