summaryrefslogtreecommitdiffstats
path: root/services/core
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-05-03 16:49:04 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-05-04 13:31:39 -0700
commit82a138ea275bb4f29706251604d0be5e6e38a007 (patch)
treebc1d3507d469b588895211618efc6adca4133de9 /services/core
parent5d52a18c9cc91182a754deeb699ac0a62413b5ce (diff)
downloadframeworks_base-82a138ea275bb4f29706251604d0be5e6e38a007.zip
frameworks_base-82a138ea275bb4f29706251604d0be5e6e38a007.tar.gz
frameworks_base-82a138ea275bb4f29706251604d0be5e6e38a007.tar.bz2
pms: Skip reinstall of prebundles correctly per user.
If you created a new user after uninstalling a few prebundled apps, switched to the said user, and rebooted, you would have your uninstalled prebundles reinstalled unconditionally. This is due to peekPackageLPr's implementation of checking for package settings not being per user, while the checks for wasPrebundledPackageInstalledLPr and shouldPrebundledPackageBeInstalled are. Now, key off of whether any package settings exist, is currently installed for the user, and if it was ever installed before before attempting the parsing process. TICKET: CYNGNOS-2709 Change-Id: Ie3e1420cfbaedb9951d55e2a3b868a6fdd5e54c2
Diffstat (limited to 'services/core')
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index eb9a192..dfdf6c7 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -5854,12 +5854,15 @@ public class PackageManagerService extends IPackageManager.Stub {
}
synchronized (mPackages) {
if (DEBUG_PREBUNDLED_SCAN) Log.d(TAG,
- "Marking prebundled packages for user " + prebundledUserId);
+ "Marking prebundled package " + pkg.packageName +
+ " for user " + prebundledUserId);
mSettings.markPrebundledPackageInstalledLPr(prebundledUserId,
pkg.packageName);
// do this for every other user
for (UserInfo userInfo : sUserManager.getUsers(true)) {
if (userInfo.id == prebundledUserId) continue;
+ if (DEBUG_PREBUNDLED_SCAN) Log.d(TAG,
+ "Marking for secondary user " + userInfo.id);
mSettings.markPrebundledPackageInstalledLPr(userInfo.id,
pkg.packageName);
}
@@ -5991,14 +5994,15 @@ public class PackageManagerService extends IPackageManager.Stub {
if ((parseFlags & PackageParser.PARSE_IS_PREBUNDLED_DIR) != 0) {
synchronized (mPackages) {
PackageSetting existingSettings = mSettings.peekPackageLPr(pkg.packageName);
- if (mSettings.wasPrebundledPackageInstalledLPr(user.getIdentifier()
- , pkg.packageName) && existingSettings == null) {
- // The prebundled app was installed at some point in time, but now it is
- // gone. Assume that the user uninstalled it intentionally: do not reinstall.
+ boolean isInstalledForUser = (existingSettings != null
+ && existingSettings.getInstalled(user.getIdentifier()));
+ if (mSettings.wasPrebundledPackageInstalledLPr(user.getIdentifier(),
+ pkg.packageName) && !isInstalledForUser) {
+ // The prebundled app was installed at some point for the user and isn't
+ // currently installed for the user, skip reinstalling it
throw new PackageManagerException(INSTALL_FAILED_UNINSTALLED_PREBUNDLE,
"skip reinstall for " + pkg.packageName);
- } else if (existingSettings == null &&
- !mSettings.shouldPrebundledPackageBeInstalled(mContext.getResources(),
+ } else if (!mSettings.shouldPrebundledPackageBeInstalled(mContext.getResources(),
pkg.packageName, mCustomResources)) {
// The prebundled app is not needed for the default mobile country code,
// skip installing it