Fix app icons on some Settings screens

App icons appeared as the default icon and sometimes without the corp badge on
Data Usage and Battery screens for applications that were only installed for
the managed profile. This CL fixes the issue.

Bug:16705204
Change-Id: I778d36554feb19f28f3cb9321a291cab3d3e17bb
This commit is contained in:
Zoltan Szatmary-Ban
2014-08-07 14:02:41 +01:00
parent f8be13d8ca
commit 3aaf0eb457
4 changed files with 68 additions and 21 deletions

View File

@@ -203,6 +203,11 @@ public class RecentLocationApps {
IPackageManager ipm = AppGlobals.getPackageManager();
ApplicationInfo appInfo =
ipm.getApplicationInfo(packageName, PackageManager.GET_META_DATA, userId);
if (appInfo == null) {
Log.w(TAG, "Null application info retrieved for package " + packageName
+ ", userId " + userId);
return null;
}
Resources res = mActivity.getResources();
final UserHandle userHandle = new UserHandle(userId);
@@ -214,7 +219,8 @@ public class RecentLocationApps {
appLabel, highBattery, badgedAppLabel,
new PackageEntryClickedListener(packageName));
} catch (RemoteException e) {
Log.w(TAG, "Error while retrieving application info", e);
Log.w(TAG, "Error while retrieving application info for package " + packageName
+ ", userId " + userId, e);
}
return preference;