Merge "Fix a bug in UserSystemPackageInstaller#installWhitelistedSystemPackages" into tm-qpr-dev am: 654f1a6b6d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19244059 Change-Id: I17cbe43013779fccd4a94c351f62be7f703d4df1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -219,38 +219,21 @@ class UserSystemPackageInstaller {
|
|||||||
|
|
||||||
// Install/uninstall system packages per user.
|
// Install/uninstall system packages per user.
|
||||||
for (int userId : mUm.getUserIds()) {
|
for (int userId : mUm.getUserIds()) {
|
||||||
final Set<String> userWhitelist = getInstallablePackagesForUserId(userId);
|
final Set<String> userAllowlist = getInstallablePackagesForUserId(userId);
|
||||||
|
|
||||||
// If null, run for all packages
|
pmInt.forEachPackageState(packageState -> {
|
||||||
if (userWhitelist == null) {
|
if (packageState.getPkg() == null) {
|
||||||
pmInt.forEachPackageState(packageState -> {
|
return;
|
||||||
if (packageState.getPkg() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final boolean install = !packageState.getTransientState()
|
|
||||||
.isHiddenUntilInstalled();
|
|
||||||
if (packageState.getUserStateOrDefault(userId).isInstalled() != install
|
|
||||||
&& shouldChangeInstallationState(packageState, install, userId,
|
|
||||||
isFirstBoot, isConsideredUpgrade, preExistingPackages)) {
|
|
||||||
changesToCommit.add(userId, packageState.getPackageName(), install);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
for (String packageName : userWhitelist) {
|
|
||||||
PackageStateInternal packageState = pmInt.getPackageStateInternal(packageName);
|
|
||||||
if (packageState.getPkg() == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean install = !packageState.getTransientState()
|
|
||||||
.isHiddenUntilInstalled();
|
|
||||||
if (packageState.getUserStateOrDefault(userId).isInstalled() != install
|
|
||||||
&& shouldChangeInstallationState(packageState, install, userId,
|
|
||||||
isFirstBoot, isConsideredUpgrade, preExistingPackages)) {
|
|
||||||
changesToCommit.add(userId, packageState.getPackageName(), install);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
boolean install = (userAllowlist == null
|
||||||
|
|| userAllowlist.contains(packageState.getPackageName()))
|
||||||
|
&& !packageState.getTransientState().isHiddenUntilInstalled();
|
||||||
|
if (packageState.getUserStateOrDefault(userId).isInstalled() != install
|
||||||
|
&& shouldChangeInstallationState(packageState, install, userId,
|
||||||
|
isFirstBoot, isConsideredUpgrade, preExistingPackages)) {
|
||||||
|
changesToCommit.add(userId, packageState.getPackageName(), install);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pmInt.commitPackageStateMutation(null, packageStateMutator -> {
|
pmInt.commitPackageStateMutation(null, packageStateMutator -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user