Merge "During update enable system apps for requested users only" into nyc-dev am: aa72470acb

am: 6d2e344759

* commit '6d2e344759c82c9de9426b7c449e91bd9ec409af':
  During update enable system apps for requested users only
This commit is contained in:
Fyodor Kupolov
2016-02-12 01:05:14 +00:00
committed by android-build-merger

View File

@@ -13256,16 +13256,19 @@ public class PackageManagerService extends IPackageManager.Stub {
// of the package implies that the user actually wants to run that new code,
// so we enable the package.
PackageSetting ps = mSettings.mPackages.get(pkgName);
final int userId = user.getIdentifier();
if (ps != null) {
if (isSystemApp(newPackage)) {
// NB: implicit assumption that system package upgrades apply to all users
if (DEBUG_INSTALL) {
Slog.d(TAG, "Implicitly enabling system package on upgrade: " + pkgName);
}
// Enable system package for requested users
if (res.origUsers != null) {
for (int userHandle : res.origUsers) {
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT,
userHandle, installerPackageName);
for (int origUserId : res.origUsers) {
if (userId == UserHandle.USER_ALL || userId == origUserId) {
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT,
origUserId, installerPackageName);
}
}
}
// Also convey the prior install/uninstall state
@@ -13283,7 +13286,6 @@ public class PackageManagerService extends IPackageManager.Stub {
}
// It's implied that when a user requests installation, they want the app to be
// installed and enabled.
int userId = user.getIdentifier();
if (userId != UserHandle.USER_ALL) {
ps.setInstalled(true, userId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId, installerPackageName);