Fix profile owners uid logic

Use uid instead of userId

Bug: 268159214
Test: Set up a profile owner with TestDPC
Change-Id: I69b2a767d9e0bfe2213998305b3f120ecb3ce549
This commit is contained in:
Alex Johnston
2023-05-23 11:34:31 +00:00
parent 39169f8115
commit 8d54cb871e

View File

@@ -204,7 +204,15 @@ class Owners {
@GuardedBy("mData")
Set<Integer> getProfileOwnerUidsLocked() {
return mData.mProfileOwners.keySet();
Set<Integer> uids = new ArraySet<>();
for (int i = 0; i < mData.mProfileOwners.size(); i++) {
int userId = mData.mProfileOwners.keyAt(i);
OwnerInfo info = mData.mProfileOwners.valueAt(i);
uids.add(mPackageManagerInternal.getPackageUid(info.packageName,
PackageManager.MATCH_ALL | PackageManager.MATCH_KNOWN_PACKAGES,
userId));
}
return uids;
}
String getDeviceOwnerPackageName() {