Fetch package uid under the corresponding user handle.

- Make 3p-app usage entry under work profile selectable:
[Before] https://screenshot.googleplex.com/AuD3Q8hrepmxaoS
[After]  https://screenshot.googleplex.com/ACrXLcV2RYYv9aA

Bug: 346982931
Fix: 346982931
Test: atest BatteryDiffEntryTest
Flag: EXEMPT bug fix
Change-Id: Ib54df4c6d343dd32057e741b448596357ec2c12f
This commit is contained in:
mxyyiyi
2024-06-26 16:50:28 +08:00
parent 69f686828b
commit 7ff146a34a
2 changed files with 7 additions and 3 deletions

View File

@@ -422,7 +422,8 @@ public class BatteryDiffEntry {
return;
}
final boolean isValidPackage =
BatteryUtils.getInstance(mContext).getPackageUid(getPackageName())
BatteryUtils.getInstance(mContext)
.getPackageUidAsUser(getPackageName(), (int) mUserId)
!= BatteryUtils.UID_NULL;
if (!isValidPackage) {
mValidForRestriction = false;