Don't kill carrier app when enabling it.
Jeff Davidson [Tue, 7 Jul 2015 02:34:37 +0000 (19:34 -0700)]
There's no reason to do this, and if the app is running it will cause
it to suddenly close despite already being enabled.

Bug: 22306627
Change-Id: Ic37ad74f92d50d49b329b8fb70ea171ff447091b

src/java/com/android/internal/telephony/CarrierAppUtils.java
tests/telephonytests/src/com/android/internal/telephony/CarrierAppUtilsTest.java

index bf306dd..ea8ff94 100644 (file)
@@ -96,8 +96,8 @@ public final class CarrierAppUtils {
                                 + userId);
                         enabledCarrierPackages.add(ai.packageName);
                         packageManager.setApplicationEnabledSetting(packageName,
-                                PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0, userId,
-                                callingPackage);
+                                PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+                                PackageManager.DONT_KILL_APP, userId, callingPackage);
                     } else if (ai.enabledSetting ==
                             PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
                         // If we're already enabled, don't bother re-enabling, but treat the app as
index d14a987..ad35019 100644 (file)
@@ -155,8 +155,8 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase {
         CarrierAppUtils.disableCarrierAppsUntilPrivileged(CALLING_PACKAGE, mPackageManager,
                 mTelephonyManager, USER_ID, CARRIER_APPS);
         Mockito.verify(mPackageManager).setApplicationEnabledSetting(
-                CARRIER_APP, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0, USER_ID,
-                CALLING_PACKAGE);
+                CARRIER_APP, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+                PackageManager.DONT_KILL_APP, USER_ID, CALLING_PACKAGE);
         Mockito.verify(mPackageManager).grantDefaultPermissionsToEnabledCarrierApps(
                 new String[] {appInfo.packageName}, USER_ID);
     }
@@ -175,8 +175,8 @@ public class CarrierAppUtilsTest extends InstrumentationTestCase {
         CarrierAppUtils.disableCarrierAppsUntilPrivileged(CALLING_PACKAGE, mPackageManager,
                 mTelephonyManager, USER_ID, CARRIER_APPS);
         Mockito.verify(mPackageManager).setApplicationEnabledSetting(
-                CARRIER_APP, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0, USER_ID,
-                CALLING_PACKAGE);
+                CARRIER_APP, PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+                PackageManager.DONT_KILL_APP, USER_ID, CALLING_PACKAGE);
         Mockito.verify(mPackageManager).grantDefaultPermissionsToEnabledCarrierApps(
                 new String[] {appInfo.packageName}, USER_ID);
     }