Install for all on replace

Prior to this change, installing for all users that results in a replace
will only install for currently installed users. This change ensures
that when USER_ALL is defined, that we properly update settings for all
users.

Change-Id: Ie2aae958d012e60e002aef84c90c5573bc06b158
Fixes: 64472557
Test: manual - adb install for single user, replace for all works
This commit is contained in:
Patrick Baumann
2018-02-07 09:05:12 -08:00
parent b6276fe5a3
commit dccef33d90

View File

@@ -16610,6 +16610,12 @@ public class PackageManagerService extends IPackageManager.Stub
if (userId != UserHandle.USER_ALL) {
ps.setInstalled(true, userId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId, installerPackageName);
} else {
for (int currentUserId : sUserManager.getUserIds()) {
ps.setInstalled(true, currentUserId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, currentUserId,
installerPackageName);
}
}
// When replacing an existing package, preserve the original install reason for all