Have a userId? use it.

Test: manual; upgrade an app on a secondary user and validate
policy xml.

Change-Id: I68a9f4ad541725817344ea295b2589efd31443a4
This commit is contained in:
Julia Reynolds
2016-11-04 12:40:13 -04:00
parent 1e1fd76a67
commit ec00da9714
2 changed files with 5 additions and 7 deletions

View File

@@ -760,7 +760,7 @@ public class NotificationManagerService extends SystemService {
mListeners.onPackagesChanged(removingPackage, pkgList);
mRankerServices.onPackagesChanged(removingPackage, pkgList);
mConditionProviders.onPackagesChanged(removingPackage, pkgList);
mRankingHelper.onPackagesChanged(removingPackage, pkgList);
mRankingHelper.onPackagesChanged(removingPackage, changeUserId, pkgList);
}
}
};

View File

@@ -716,9 +716,8 @@ public class RankingHelper implements RankingConfig {
return packageBans;
}
public void onPackagesChanged(boolean removingPackage, String[] pkgList) {
if (removingPackage || pkgList == null || pkgList.length == 0
|| mRestoredWithoutUids.isEmpty()) {
public void onPackagesChanged(boolean removingPackage, int changeUserId, String[] pkgList) {
if (removingPackage || pkgList == null || pkgList.length == 0) {
return; // nothing to do
}
boolean updated = false;
@@ -726,8 +725,7 @@ public class RankingHelper implements RankingConfig {
final Record r = mRestoredWithoutUids.get(pkg);
if (r != null) {
try {
//TODO: http://b/22388012
r.uid = mPm.getPackageUidAsUser(r.pkg, UserHandle.USER_SYSTEM);
r.uid = mPm.getPackageUidAsUser(r.pkg, changeUserId);
mRestoredWithoutUids.remove(pkg);
mRecords.put(recordKey(r.pkg, r.uid), r);
updated = true;
@@ -737,7 +735,7 @@ public class RankingHelper implements RankingConfig {
}
try {
Record fullRecord = getRecord(pkg,
mPm.getPackageUidAsUser(pkg, UserHandle.USER_SYSTEM));
mPm.getPackageUidAsUser(pkg, changeUserId));
if (fullRecord != null) {
clampDefaultChannel(fullRecord);
}