Adapt to behavior change in MATCH_UNINSTALLED_PACKAGES

Don't use the PM flag to reach across users.
If retrieving labels, etc., use MATCH_ANY_USER, since
several Settings screens show work profile apps as well.

Bug: 31000380
Test: Manual test of affected screens
Change-Id: Ib6f981ae8443f640276d395c37247c8c0b610894
This commit is contained in:
Amith Yamasani
2016-11-01 15:49:21 -07:00
parent 7aad8a97a4
commit 21556cdba1
10 changed files with 23 additions and 22 deletions

View File

@@ -420,7 +420,7 @@ public class RunningState {
try {
ApplicationInfo ai = pm.getApplicationInfo(mProcessName,
PackageManager.GET_UNINSTALLED_PACKAGES);
PackageManager.MATCH_ANY_USER);
if (ai.uid == mUid) {
mDisplayLabel = ai.loadLabel(pm);
mLabel = mDisplayLabel.toString();
@@ -438,7 +438,7 @@ public class RunningState {
if (pkgs.length == 1) {
try {
ApplicationInfo ai = pm.getApplicationInfo(pkgs[0],
PackageManager.GET_UNINSTALLED_PACKAGES);
PackageManager.MATCH_ANY_USER);
mDisplayLabel = ai.loadLabel(pm);
mLabel = mDisplayLabel.toString();
mPackageInfo = ai;
@@ -480,7 +480,7 @@ public class RunningState {
// Finally... whatever, just pick the first package's name.
try {
ApplicationInfo ai = pm.getApplicationInfo(pkgs[0],
PackageManager.GET_UNINSTALLED_PACKAGES);
PackageManager.MATCH_ANY_USER);
mDisplayLabel = ai.loadLabel(pm);
mLabel = mDisplayLabel.toString();
mPackageInfo = ai;
@@ -500,7 +500,7 @@ public class RunningState {
si.mRunningService = service;
try {
si.mServiceInfo = ActivityThread.getPackageManager().getServiceInfo(
service.service, PackageManager.GET_UNINSTALLED_PACKAGES,
service.service, PackageManager.MATCH_UNINSTALLED_PACKAGES,
UserHandle.getUserId(service.uid));
if (si.mServiceInfo == null) {