When restrict, use uid inside AppInfo

Before this CL, we use packageManager to get uid for battery
restriction. However it may not be correct all the time.

For example, RestrictedAppDetails will be opened as main user
however inside we also show work profile apps, in this case
we can't get correct uid by only using normal API in PackageManager.

This CL change it to use uid from AppInfo, which is correct all
the time.

Bug: 79992590
Test: RunSettingsRoboTests
Change-Id: Id33a5f6409d6bace0d756e5ac06432acb8b2cf65
This commit is contained in:
Lei Yu
2018-05-21 13:15:24 -07:00
parent 8075586a2e
commit d06d1165eb
5 changed files with 19 additions and 9 deletions

View File

@@ -129,6 +129,7 @@ public class BackgroundActivityPreferenceController extends AbstractPreferenceCo
@VisibleForTesting
void showDialog(boolean restricted) {
final AppInfo appInfo = new AppInfo.Builder()
.setUid(mUid)
.setPackageName(mTargetPackage)
.build();
BatteryTip tip = restricted