Moving icon generation out of ShortcutInfo constructor so that it
can be created on the UI thread
Change-Id: If84e52041eb4ab20807f5cfd4b7f31d7b5f381ed
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 2fc1502..247a295 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -49,6 +49,7 @@
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
+import com.android.launcher3.graphics.LauncherIcons;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.AddWorkspaceItemsTask;
import com.android.launcher3.model.BgDataModel;
@@ -1330,6 +1331,8 @@
continue;
}
info = new ShortcutInfo(pinnedShortcut, context);
+ info.iconBitmap = LauncherIcons
+ .createShortcutIcon(pinnedShortcut, context);
intent = info.intent;
} else {
// Create a shortcut info in disabled mode for now.
@@ -2201,6 +2204,17 @@
}
}
+ public void updateAndBindShortcutInfo(final ShortcutInfo si, final ShortcutInfoCompat info) {
+ updateAndBindShortcutInfo(new Provider<ShortcutInfo>() {
+ @Override
+ public ShortcutInfo get() {
+ si.updateFromDeepShortcutInfo(info, mApp.getContext());
+ si.iconBitmap = LauncherIcons.createShortcutIcon(info, mApp.getContext());
+ return si;
+ }
+ });
+ }
+
/**
* Utility method to update a shortcut on the background thread.
*/