Fix user id is not used correctly when fetching app info

FIXES: 73994288
Test: m -j RunSettingsRoboTest
Test: Install an app in work profile, set it to be restricted,
      observe that the app is rendered properly in restricted app list

Change-Id: Ic8a79eb3d0a675f9d1cae3125e8006739e492966
This commit is contained in:
Tony Mak
2018-03-19 15:37:21 +00:00
parent 8aff2f8fe7
commit 4e29281b99
4 changed files with 15 additions and 9 deletions

View File

@@ -131,8 +131,8 @@ public class RestrictedAppDetails extends DashboardFragment {
final CheckBoxPreference checkBoxPreference = new AppCheckBoxPreference(context);
final AppInfo appInfo = mAppInfos.get(i);
try {
final ApplicationInfo applicationInfo = mPackageManager.getApplicationInfo(
appInfo.packageName, 0 /* flags */);
final ApplicationInfo applicationInfo = mPackageManager.getApplicationInfoAsUser(
appInfo.packageName, 0 /* flags */, UserHandle.getUserId(appInfo.uid));
checkBoxPreference.setChecked(true);
checkBoxPreference.setTitle(mPackageManager.getApplicationLabel(applicationInfo));
checkBoxPreference.setIcon(