From 47fb83a1e256e5137b9830e044bf2acdf89e2ee0 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 25 May 2016 16:12:02 -0700 Subject: [PATCH] Fix issue #28964589: Binding dies when (unrelated) component is disabled in package We go through the same path for uninstalling and changing an app... both of which would do a full force stop. That is only appropriate for uninstalling; for changing, we should just be killing its processes. Change-Id: Ia87750d96d3e3eb7ee30841429eb926c20c5ad78 --- .../server/am/ActivityManagerService.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index a8a8553c9d3f5..007a7f12ea21f 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -17520,13 +17520,13 @@ public final class ActivityManagerService extends ActivityManagerNative final boolean killProcess = !intent.getBooleanExtra(Intent.EXTRA_DONT_KILL_APP, false); final boolean fullUninstall = removed && !replacing; - if (killProcess) { - forceStopPackageLocked(ssp, UserHandle.getAppId( - intent.getIntExtra(Intent.EXTRA_UID, -1)), - false, true, true, false, fullUninstall, userId, - removed ? "pkg removed" : "pkg changed"); - } if (removed) { + if (killProcess) { + forceStopPackageLocked(ssp, UserHandle.getAppId( + intent.getIntExtra(Intent.EXTRA_UID, -1)), + false, true, true, false, fullUninstall, userId, + removed ? "pkg removed" : "pkg changed"); + } final int cmd = killProcess ? IApplicationThread.PACKAGE_REMOVED : IApplicationThread.PACKAGE_REMOVED_DONT_KILL; @@ -17543,6 +17543,12 @@ public final class ActivityManagerService extends ActivityManagerNative mBatteryStatsService.notePackageUninstalled(ssp); } } else { + if (killProcess) { + killPackageProcessesLocked(ssp, UserHandle.getAppId( + intent.getIntExtra(Intent.EXTRA_UID, -1)), + userId, ProcessList.INVALID_ADJ, + false, true, true, false, "change " + ssp); + } cleanupDisabledPackageComponentsLocked(ssp, userId, killProcess, intent.getStringArrayExtra( Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST));