Loading services/core/java/com/android/server/am/ActivityManagerService.java +8 −3 Original line number Diff line number Diff line Loading @@ -18362,10 +18362,15 @@ public final class ActivityManagerService extends ActivityManagerNative for (int j = 0; j < activitiesSize; j++) { final ActivityRecord r = app.activities.get(j); if (r.app != app) { Slog.w(TAG, "Wtf, activity " + r + " in proc activity list not using proc " + app + "?!? Using " + r.app + " instead."); Log.wtf(TAG, "Found activity " + r + " in proc activity list using " + r.app + " instead of expected " + app); if (r.app == null || (r.app.uid == app.uid)) { // Only fix things up when they look sane r.app = app; } else { continue; } } if (r.visible) { // App has a visible activity; only upgrade adjustment. if (adj > ProcessList.VISIBLE_APP_ADJ) { services/core/java/com/android/server/pm/PackageManagerService.java +30 −0 Original line number Diff line number Diff line Loading @@ -2906,6 +2906,11 @@ public class PackageManagerService extends IPackageManager.Stub { throw new SecurityException("Package " + packageName + " was not found!"); } if (!ps.getInstalled(userId)) { throw new SecurityException( "Package " + packageName + " was not installed for user " + userId + "!"); } if (mSafeMode && !ps.isSystem()) { throw new SecurityException("Package " + packageName + " not a system app!"); } Loading Loading @@ -13147,6 +13152,7 @@ public class PackageManagerService extends IPackageManager.Stub { final PackageParser.Package oldPackage; final String pkgName = pkg.packageName; final int[] allUsers; final boolean weFroze; // First find the old package info and check signatures synchronized(mPackages) { Loading Loading @@ -13179,8 +13185,32 @@ public class PackageManagerService extends IPackageManager.Stub { // In case of rollback, remember per-user/profile install state allUsers = sUserManager.getUserIds(); // 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; } } try { replacePackageDirtyLI(pkg, oldPackage, parseFlags, scanFlags, user, allUsers, installerPackageName, res); } finally { // Regardless of success or failure of upgrade steps above, always // unfreeze the package if we froze it if (weFroze) { unfreezePackage(pkgName); } } } private void replacePackageDirtyLI(PackageParser.Package pkg, PackageParser.Package oldPackage, int parseFlags, int scanFlags, UserHandle user, int[] allUsers, String installerPackageName, PackageInstalledInfo res) { // Update what is removed res.removedInfo = new PackageRemovedInfo(); res.removedInfo.uid = oldPackage.applicationInfo.uid; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +8 −3 Original line number Diff line number Diff line Loading @@ -18362,10 +18362,15 @@ public final class ActivityManagerService extends ActivityManagerNative for (int j = 0; j < activitiesSize; j++) { final ActivityRecord r = app.activities.get(j); if (r.app != app) { Slog.w(TAG, "Wtf, activity " + r + " in proc activity list not using proc " + app + "?!? Using " + r.app + " instead."); Log.wtf(TAG, "Found activity " + r + " in proc activity list using " + r.app + " instead of expected " + app); if (r.app == null || (r.app.uid == app.uid)) { // Only fix things up when they look sane r.app = app; } else { continue; } } if (r.visible) { // App has a visible activity; only upgrade adjustment. if (adj > ProcessList.VISIBLE_APP_ADJ) {
services/core/java/com/android/server/pm/PackageManagerService.java +30 −0 Original line number Diff line number Diff line Loading @@ -2906,6 +2906,11 @@ public class PackageManagerService extends IPackageManager.Stub { throw new SecurityException("Package " + packageName + " was not found!"); } if (!ps.getInstalled(userId)) { throw new SecurityException( "Package " + packageName + " was not installed for user " + userId + "!"); } if (mSafeMode && !ps.isSystem()) { throw new SecurityException("Package " + packageName + " not a system app!"); } Loading Loading @@ -13147,6 +13152,7 @@ public class PackageManagerService extends IPackageManager.Stub { final PackageParser.Package oldPackage; final String pkgName = pkg.packageName; final int[] allUsers; final boolean weFroze; // First find the old package info and check signatures synchronized(mPackages) { Loading Loading @@ -13179,8 +13185,32 @@ public class PackageManagerService extends IPackageManager.Stub { // In case of rollback, remember per-user/profile install state allUsers = sUserManager.getUserIds(); // 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; } } try { replacePackageDirtyLI(pkg, oldPackage, parseFlags, scanFlags, user, allUsers, installerPackageName, res); } finally { // Regardless of success or failure of upgrade steps above, always // unfreeze the package if we froze it if (weFroze) { unfreezePackage(pkgName); } } } private void replacePackageDirtyLI(PackageParser.Package pkg, PackageParser.Package oldPackage, int parseFlags, int scanFlags, UserHandle user, int[] allUsers, String installerPackageName, PackageInstalledInfo res) { // Update what is removed res.removedInfo = new PackageRemovedInfo(); res.removedInfo.uid = oldPackage.applicationInfo.uid;