Merge "loadUnbadgedItemIcon doesn't crash from getUserIcon" into qt-dev

am: 14a34b9efb

Change-Id: I96167fe68786a5269d2178d74c3bb4ffa1afca1c
This commit is contained in:
Adam Bookatz
2019-06-06 11:05:58 -07:00
committed by android-build-merger
2 changed files with 6 additions and 7 deletions

View File

@@ -2754,12 +2754,11 @@ public class ApplicationPackageManager extends PackageManager {
public Drawable loadUnbadgedItemIcon(@NonNull PackageItemInfo itemInfo, public Drawable loadUnbadgedItemIcon(@NonNull PackageItemInfo itemInfo,
@Nullable ApplicationInfo appInfo) { @Nullable ApplicationInfo appInfo) {
if (itemInfo.showUserIcon != UserHandle.USER_NULL) { if (itemInfo.showUserIcon != UserHandle.USER_NULL) {
Bitmap bitmap = getUserManager().getUserIcon(itemInfo.showUserIcon); // Indicates itemInfo is for a different user (e.g. a profile's parent), so use a
if (bitmap == null) { // generic user icon (users generally lack permission to view each other's actual icons)
return UserIcons.getDefaultUserIcon( int targetUserId = itemInfo.showUserIcon;
mContext.getResources(), itemInfo.showUserIcon, /* light= */ false); return UserIcons.getDefaultUserIcon(
} mContext.getResources(), targetUserId, /* light= */ false);
return new BitmapDrawable(bitmap);
} }
Drawable dr = null; Drawable dr = null;
if (itemInfo.packageName != null) { if (itemInfo.packageName != null) {

View File

@@ -159,7 +159,7 @@ public class PackageItemInfo {
public Bundle metaData; public Bundle metaData;
/** /**
* If different of UserHandle.USER_NULL, The icon of this item will be the one of that user. * If different of UserHandle.USER_NULL, The icon of this item will represent that user.
* @hide * @hide
*/ */
public int showUserIcon; public int showUserIcon;