diff options
| author | 2019-12-04 19:26:51 +0000 | |
|---|---|---|
| committer | 2019-12-04 19:26:51 +0000 | |
| commit | 454c0659a6321fefd4b51ac663ed804160d2d1f4 (patch) | |
| tree | f91b08ac1a994472a98034c442b97a6bb0c37462 | |
| parent | 91e1a008461cf08b8868a57dc2681e21a4bcab2f (diff) | |
| parent | 4c7c1b25e9c851216394ff38b3869c9bb3cdae13 (diff) | |
Merge "Add System API to indicate whether physical SIM can be disabled."
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 38 | ||||
| -rwxr-xr-x | telephony/java/com/android/internal/telephony/ISub.aidl | 2 |
3 files changed, 40 insertions, 1 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 6340cfecdbb1..9f8af7f768bc 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8582,6 +8582,7 @@ package android.telephony { } public class SubscriptionManager { + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean canDisablePhysicalSubscription(); method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int); method @NonNull public static android.content.res.Resources getResourcesForSubId(@NonNull android.content.Context, int); diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 999c5cac08c8..fbbc9518065d 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -3104,7 +3104,11 @@ public class SubscriptionManager { } /** - * Enables or disables a subscription. This is currently used in the settings page. + * Enables or disables a subscription. This is currently used in the settings page. It will + * fail and return false if operation is not supported or failed. + * + * To disable an active subscription on a physical (non-Euicc) SIM, + * {@link #canDisablePhysicalSubscription} needs to be true. * * <p> * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required @@ -3136,6 +3140,38 @@ public class SubscriptionManager { } /** + * Whether it's supported to disable / re-enable a subscription on a physical (non-euicc) SIM. + * + * Physical SIM refers non-euicc, or aka non-programmable SIM. + * + * It provides whether a physical SIM card can be disabled without taking it out, which is done + * via {@link #setSubscriptionEnabled(int, boolean)} API. + * + * Requires Permission: READ_PRIVILEGED_PHONE_STATE. + * + * @return whether can disable subscriptions on physical SIMs. + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + public boolean canDisablePhysicalSubscription() { + if (VDBG) { + logd("canDisablePhysicalSubscription"); + } + try { + ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); + if (iSub != null) { + return iSub.canDisablePhysicalSubscription(); + } + } catch (RemoteException ex) { + // ignore it + } + + return false; + } + + /** * DO NOT USE. * This API is designed for features that are not finished at this point. Do not call this API. * @hide diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index 7cc37d0d2b15..92aab4b12330 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -283,4 +283,6 @@ interface ISub { boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow); int getActiveDataSubscriptionId(); + + boolean canDisablePhysicalSubscription(); } |