diff options
author | Todd Kennedy <toddke@google.com> | 2015-07-28 13:52:49 -0700 |
---|---|---|
committer | Todd Kennedy <toddke@google.com> | 2015-07-28 13:52:49 -0700 |
commit | 6b0c8315e4c0db24522675c05ecd6a0b9bfb6d9e (patch) | |
tree | d0719bb3fddf49eb9a9c069c2477f6a0eecdfaa0 /services | |
parent | 602611375b11805f74ae52f5d62a944c74f967d6 (diff) | |
download | frameworks_base-6b0c8315e4c0db24522675c05ecd6a0b9bfb6d9e.zip frameworks_base-6b0c8315e4c0db24522675c05ecd6a0b9bfb6d9e.tar.gz frameworks_base-6b0c8315e4c0db24522675c05ecd6a0b9bfb6d9e.tar.bz2 |
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
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 48 |
1 files 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 b719b16..b7756ac 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<clientLibPkgs.size(); i++) { @@ -11770,7 +11779,6 @@ public class PackageManagerService extends IPackageManager.Stub { final String pkgName = pkg.packageName; final int[] allUsers; final boolean[] perUserInstalled; - final boolean weFroze; // First find the old package info and check signatures synchronized(mPackages) { @@ -11800,35 +11808,15 @@ public class PackageManagerService extends IPackageManager.Stub { for (int i = 0; i < allUsers.length; i++) { perUserInstalled[i] = ps != null ? ps.getInstalled(allUsers[i]) : false; } - - // Mark the app as frozen to prevent launching during the upgrade - // process, and then kill all running instances - if (!ps.frozen) { - ps.frozen = true; - weFroze = true; - } else { - weFroze = false; - } } - // Now that we're guarded by frozen state, kill app during upgrade - killApplication(pkgName, oldPackage.applicationInfo.uid, "replace pkg"); - - try { - boolean sysPkg = (isSystemApp(oldPackage)); - if (sysPkg) { - replaceSystemPackageLI(oldPackage, pkg, parseFlags, scanFlags, - user, allUsers, perUserInstalled, installerPackageName, volumeUuid, res); - } else { - replaceNonSystemPackageLI(oldPackage, pkg, parseFlags, scanFlags, - user, allUsers, perUserInstalled, installerPackageName, volumeUuid, res); - } - } finally { - // Regardless of success or failure of upgrade steps above, always - // unfreeze the package if we froze it - if (weFroze) { - unfreezePackage(pkgName); - } + boolean sysPkg = (isSystemApp(oldPackage)); + if (sysPkg) { + replaceSystemPackageLI(oldPackage, pkg, parseFlags, scanFlags, + user, allUsers, perUserInstalled, installerPackageName, volumeUuid, res); + } else { + replaceNonSystemPackageLI(oldPackage, pkg, parseFlags, scanFlags, + user, allUsers, perUserInstalled, installerPackageName, volumeUuid, res); } } @@ -11958,6 +11946,8 @@ public class PackageManagerService extends IPackageManager.Stub { } } + killApplication(packageName, oldPkg.applicationInfo.uid, "replace sys pkg"); + res.removedInfo.uid = oldPkg.applicationInfo.uid; res.removedInfo.removedPackage = packageName; // Remove existing system package @@ -12347,7 +12337,7 @@ public class PackageManagerService extends IPackageManager.Stub { startIntentFilterVerifications(args.user.getIdentifier(), replace, pkg); if (replace) { - replacePackageLI(pkg, parseFlags, scanFlags, args.user, + replacePackageLI(pkg, parseFlags, scanFlags | SCAN_REPLACING, args.user, installerPackageName, volumeUuid, res); } else { installNewPackageLI(pkg, parseFlags, scanFlags | SCAN_DELETE_DATA_ON_FAILURES, |