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/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 51cd052..0c1a156 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -155,13 +155,12 @@
setAccessibilityDelegate(mLauncher.getAccessibilityDelegate());
}
- public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache) {
- applyFromShortcutInfo(info, iconCache, false);
+ public void applyFromShortcutInfo(ShortcutInfo info) {
+ applyFromShortcutInfo(info, false);
}
- public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache,
- boolean promiseStateChanged) {
- applyIconAndLabel(info.getIcon(iconCache), info);
+ public void applyFromShortcutInfo(ShortcutInfo info, boolean promiseStateChanged) {
+ applyIconAndLabel(info.iconBitmap, info);
setTag(info);
if (promiseStateChanged || info.isPromise()) {
applyState(promiseStateChanged);
@@ -557,8 +556,7 @@
if (info instanceof AppInfo) {
applyFromApplicationInfo((AppInfo) info);
} else if (info instanceof ShortcutInfo) {
- applyFromShortcutInfo((ShortcutInfo) info,
- LauncherAppState.getInstance().getIconCache());
+ applyFromShortcutInfo((ShortcutInfo) info);
if ((info.rank < FolderIcon.NUM_ITEMS_IN_PREVIEW) && (info.container >= 0)) {
View folderIcon =
mLauncher.getWorkspace().getHomescreenIconByItemId(info.container);