disallow changing from multi-sim to single-sim for carrier apps
Bug: 125122645
Test: build
Change-Id: I511d95772c3b662279d6dc008bdb58ffc45398cb
Merged-In: I511d95772c3b662279d6dc008bdb58ffc45398cb
(cherry picked from commit 1731878a79c774bec34e1c6056fb653e75b9ced6)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 8bc8ce0..fd484f0 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6616,12 +6616,19 @@
/**
* Switch configs to enable multi-sim or switch back to single-sim
+ * Note: Switch from multi-sim to single-sim is only possible with MODIFY_PHONE_STATE
+ * permission, but the other way around is possible with either MODIFY_PHONE_STATE
+ * or carrier privileges
* @param numOfSims number of active sims we want to switch to
*/
@Override
public void switchMultiSimConfig(int numOfSims) {
- TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
- mApp, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, "switchMultiSimConfig");
+ if (numOfSims == 1) {
+ enforceModifyPermission();
+ } else {
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, "switchMultiSimConfig");
+ }
final long identity = Binder.clearCallingIdentity();
try {