disallow changing from multi-sim to single-sim for carrier apps

Bug: 125122645
Test: build
Change-Id: I511d95772c3b662279d6dc008bdb58ffc45398cb
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7ba44db..ee653b1 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6645,12 +6645,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 {
             mPhoneConfigurationManager.switchMultiSimConfig(numOfSims);