Loading api/system-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -7653,10 +7653,13 @@ package android.telephony { public class SubscriptionManager { method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSubscriptionEnabled(int); method public void requestEmbeddedSubscriptionInfoListRefresh(); method public void requestEmbeddedSubscriptionInfoListRefresh(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultDataSubId(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultSmsSubId(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int, boolean); field public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI; field public static final int PROFILE_CLASS_DEFAULT = -1; // 0xffffffff field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2 Loading core/java/android/provider/Settings.java +13 −0 Original line number Diff line number Diff line Loading @@ -13785,6 +13785,19 @@ public final class Settings { public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1", "user_preferred_sub2","user_preferred_sub3"}; /** * Which subscription is enabled for a physical slot. * @hide */ public static final String ENABLED_SUBSCRIPTION_FOR_SLOT = "enabled_subscription_for_slot"; /** * Whether corresponding logical modem is enabled for a physical slot. * The value 1 - enable, 0 - disable * @hide */ public static final String MODEM_STACK_ENABLED_FOR_SLOT = "modem_stack_enabled_for_slot"; /** * Whether to enable new contacts aggregator or not. * The value 1 - enable, 0 - disable core/tests/coretests/src/android/provider/SettingsBackupTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -563,7 +563,9 @@ public class SettingsBackupTest { Settings.Global.APPOP_HISTORY_BASE_INTERVAL_MILLIS, Settings.Global.ENABLE_RADIO_BUG_DETECTION, Settings.Global.RADIO_BUG_WAKELOCK_TIMEOUT_COUNT_THRESHOLD, Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD); Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD, Settings.Global.ENABLED_SUBSCRIPTION_FOR_SLOT, Settings.Global.MODEM_STACK_ENABLED_FOR_SLOT); private static final Set<String> BACKUP_BLACKLISTED_SECURE_SETTINGS = newHashSet( Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE, Loading telephony/java/android/telephony/SubscriptionManager.java +89 −0 Original line number Diff line number Diff line Loading @@ -2859,6 +2859,95 @@ public class SubscriptionManager { } } /** * Enabled or disable a subscription. This is currently used in the settings page. * * <p> * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required * * @param enable whether user is turning it on or off. * @param subscriptionId Subscription to be enabled or disabled. * It could be a eSIM or pSIM subscription. * * @return whether the operation is successful. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int subscriptionId, boolean enable) { if (VDBG) { logd("setSubscriptionActivated subId= " + subscriptionId + " enable " + enable); } try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { return iSub.setSubscriptionEnabled(enable, subscriptionId); } } catch (RemoteException ex) { // ignore it } return false; } /** * Returns whether the subscription is enabled or not. This is different from activated * or deactivated for two aspects. 1) For when user disables a physical subscription, we * actually disable the modem because we can't switch off the subscription. 2) For eSIM, * user may enable one subscription but the system may activate another temporarily. In this * case, user enabled one is different from current active one. * @param subscriptionId The subscription it asks about. * @return whether it's enabled or not. {@code true} if user set this subscription enabled * earlier, or user never set subscription enable / disable on this slot explicitly, and * this subscription is currently active. Otherwise, it returns {@code false}. * * @hide */ @SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSubscriptionEnabled(int subscriptionId) { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { return iSub.isSubscriptionEnabled(subscriptionId); } } catch (RemoteException ex) { // ignore it } return false; } /** * Get which subscription is enabled on this slot. See {@link #isSubscriptionEnabled(int)} * for more details. * * @param slotIndex which slot it asks about. * @return which subscription is enabled on this slot. If there's no enabled subscription * in this slot, it will return {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}. * * @hide */ @SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int slotIndex) { int subId = INVALID_SUBSCRIPTION_ID; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { subId = iSub.getEnabledSubscriptionId(slotIndex); } } catch (RemoteException ex) { // ignore it } if (VDBG) logd("getEnabledSubscriptionId, subId = " + subId); return subId; } private interface CallISubMethodHelper { int callMethod(ISub iSub) throws RemoteException; } Loading telephony/java/com/android/internal/telephony/ISub.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,11 @@ interface ISub { String getSubscriptionProperty(int subId, String propKey, String callingPackage); boolean setSubscriptionEnabled(boolean enable, int subId); boolean isSubscriptionEnabled(int subId); int getEnabledSubscriptionId(int slotIndex); /** * Get the SIM state for the slot index * @return SIM state as the ordinal of IccCardConstants.State Loading Loading
api/system-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -7653,10 +7653,13 @@ package android.telephony { public class SubscriptionManager { method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSubscriptionEnabled(int); method public void requestEmbeddedSubscriptionInfoListRefresh(); method public void requestEmbeddedSubscriptionInfoListRefresh(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultDataSubId(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultSmsSubId(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int, boolean); field public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI; field public static final int PROFILE_CLASS_DEFAULT = -1; // 0xffffffff field public static final int PROFILE_CLASS_OPERATIONAL = 2; // 0x2 Loading
core/java/android/provider/Settings.java +13 −0 Original line number Diff line number Diff line Loading @@ -13785,6 +13785,19 @@ public final class Settings { public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1", "user_preferred_sub2","user_preferred_sub3"}; /** * Which subscription is enabled for a physical slot. * @hide */ public static final String ENABLED_SUBSCRIPTION_FOR_SLOT = "enabled_subscription_for_slot"; /** * Whether corresponding logical modem is enabled for a physical slot. * The value 1 - enable, 0 - disable * @hide */ public static final String MODEM_STACK_ENABLED_FOR_SLOT = "modem_stack_enabled_for_slot"; /** * Whether to enable new contacts aggregator or not. * The value 1 - enable, 0 - disable
core/tests/coretests/src/android/provider/SettingsBackupTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -563,7 +563,9 @@ public class SettingsBackupTest { Settings.Global.APPOP_HISTORY_BASE_INTERVAL_MILLIS, Settings.Global.ENABLE_RADIO_BUG_DETECTION, Settings.Global.RADIO_BUG_WAKELOCK_TIMEOUT_COUNT_THRESHOLD, Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD); Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD, Settings.Global.ENABLED_SUBSCRIPTION_FOR_SLOT, Settings.Global.MODEM_STACK_ENABLED_FOR_SLOT); private static final Set<String> BACKUP_BLACKLISTED_SECURE_SETTINGS = newHashSet( Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE, Loading
telephony/java/android/telephony/SubscriptionManager.java +89 −0 Original line number Diff line number Diff line Loading @@ -2859,6 +2859,95 @@ public class SubscriptionManager { } } /** * Enabled or disable a subscription. This is currently used in the settings page. * * <p> * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required * * @param enable whether user is turning it on or off. * @param subscriptionId Subscription to be enabled or disabled. * It could be a eSIM or pSIM subscription. * * @return whether the operation is successful. * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int subscriptionId, boolean enable) { if (VDBG) { logd("setSubscriptionActivated subId= " + subscriptionId + " enable " + enable); } try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { return iSub.setSubscriptionEnabled(enable, subscriptionId); } } catch (RemoteException ex) { // ignore it } return false; } /** * Returns whether the subscription is enabled or not. This is different from activated * or deactivated for two aspects. 1) For when user disables a physical subscription, we * actually disable the modem because we can't switch off the subscription. 2) For eSIM, * user may enable one subscription but the system may activate another temporarily. In this * case, user enabled one is different from current active one. * @param subscriptionId The subscription it asks about. * @return whether it's enabled or not. {@code true} if user set this subscription enabled * earlier, or user never set subscription enable / disable on this slot explicitly, and * this subscription is currently active. Otherwise, it returns {@code false}. * * @hide */ @SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSubscriptionEnabled(int subscriptionId) { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { return iSub.isSubscriptionEnabled(subscriptionId); } } catch (RemoteException ex) { // ignore it } return false; } /** * Get which subscription is enabled on this slot. See {@link #isSubscriptionEnabled(int)} * for more details. * * @param slotIndex which slot it asks about. * @return which subscription is enabled on this slot. If there's no enabled subscription * in this slot, it will return {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}. * * @hide */ @SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int slotIndex) { int subId = INVALID_SUBSCRIPTION_ID; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { subId = iSub.getEnabledSubscriptionId(slotIndex); } } catch (RemoteException ex) { // ignore it } if (VDBG) logd("getEnabledSubscriptionId, subId = " + subId); return subId; } private interface CallISubMethodHelper { int callMethod(ISub iSub) throws RemoteException; } Loading
telephony/java/com/android/internal/telephony/ISub.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,11 @@ interface ISub { String getSubscriptionProperty(int subId, String propKey, String callingPackage); boolean setSubscriptionEnabled(boolean enable, int subId); boolean isSubscriptionEnabled(int subId); int getEnabledSubscriptionId(int slotIndex); /** * Get the SIM state for the slot index * @return SIM state as the ordinal of IccCardConstants.State Loading