Ensuring that ShortcutInfo always has an icon
> Making iconBitmap public instead of a getter (similar to AppInfo)
> Removing getIcon() which can lead to IO on UI thread
> Removing updateIcon and handling the update at the caller
Bug: 21325319
Change-Id: I6a49b9043f974e9629ea25e77012d97cc04c0594
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index accc3cd..35d34a3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1424,7 +1424,7 @@
public View createShortcut(ViewGroup parent, ShortcutInfo info) {
BubbleTextView favorite = (BubbleTextView) getLayoutInflater().inflate(R.layout.app_icon,
parent, false);
- favorite.applyFromShortcutInfo(info, mIconCache);
+ favorite.applyFromShortcutInfo(info);
favorite.setCompoundDrawablePadding(mDeviceProfile.iconDrawablePaddingPx);
favorite.setOnClickListener(this);
favorite.setOnFocusChangeListener(mFocusHandler);
@@ -2108,8 +2108,7 @@
cellX, cellY);
// Create the view
- FolderIcon newFolder =
- FolderIcon.fromXml(R.layout.folder_icon, this, layout, folderInfo, mIconCache);
+ FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this, layout, folderInfo);
mWorkspace.addInScreen(newFolder, folderInfo);
// Force measure the new folder icon
CellLayout parent = mWorkspace.getParentCellLayoutForView(newFolder);
@@ -3346,7 +3345,7 @@
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER: {
view = FolderIcon.fromXml(R.layout.folder_icon, this,
(ViewGroup) workspace.getChildAt(workspace.getCurrentPage()),
- (FolderInfo) item, mIconCache);
+ (FolderInfo) item);
break;
}
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET: {
@@ -4037,13 +4036,6 @@
return new AppInfo(this, activityInfo, user, mIconCache);
}
- // TODO: This method should be a part of LauncherSearchCallback
- public ItemInfo createShortcutDragInfo(Intent shortcutIntent, CharSequence caption,
- Bitmap icon) {
- return new ShortcutInfo(shortcutIntent, caption, caption, icon,
- UserHandleCompat.myUserHandle());
- }
-
protected void moveWorkspaceToDefaultScreen() {
mWorkspace.moveToDefaultScreen(false);
}