From 6b0c8315e4c0db24522675c05ecd6a0b9bfb6d9e Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Tue, 28 Jul 2015 13:52:49 -0700 Subject: [PATCH] Partially revert package freezing On the Nexus Player, upgrading the launcher would cause multiple, simultaneous processes to be running. In order to prevent this regression, revert the portion of ag/682591 dealing with package upgrades. Bug: 21123444 Change-Id: I7a4cf98c7e28fc9893b1c0358d3a98702d94c039 --- .../server/pm/PackageManagerService.java | 48 ++++++++----------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index b719b16c1a39b..b7756acd957be 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -323,6 +323,7 @@ public class PackageManagerService extends IPackageManager.Stub { static final int SCAN_BOOTING = 1<<8; static final int SCAN_TRUSTED_OVERLAY = 1<<9; static final int SCAN_DELETE_DATA_ON_FAILURES = 1<<10; + static final int SCAN_REPLACING = 1<<11; static final int SCAN_REQUIRE_KNOWN = 1<<12; static final int SCAN_MOVE = 1<<13; static final int SCAN_INITIAL = 1<<14; @@ -7133,6 +7134,14 @@ public class PackageManagerService extends IPackageManager.Stub { } } + // Request the ActivityManager to kill the process(only for existing packages) + // so that we do not end up in a confused state while the user is still using the older + // version of the application while the new one gets installed. + if ((scanFlags & SCAN_REPLACING) != 0) { + killApplication(pkg.applicationInfo.packageName, + pkg.applicationInfo.uid, "replace pkg"); + } + // Also need to kill any apps that are dependent on the library. if (clientLibPkgs != null) { for (int i=0; i