[coastguard skipped] Merge sparse cherrypicks from sparse-10316531-L99500000961260703 into tm-qpr3-release.

COASTGUARD_SKIP: I2ee30dfa5e4170272b5353f270a69b38750a0bd5
COASTGUARD_SKIP: I3e40b22e7022dea212a7d24559dbaaa345874176
COASTGUARD_SKIP: I835dd545a01eb2fd7990e0fd5ad51bac0e4b1f33

Change-Id: I2bb2ef5bc2b5dd0659bebcd1a50701d53cc0a935
diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java
index bc57f66..3c63f26 100644
--- a/src/com/android/launcher3/icons/IconCache.java
+++ b/src/com/android/launcher3/icons/IconCache.java
@@ -100,7 +100,6 @@
     private final UserCache mUserManager;
     private final InstantAppResolver mInstantAppResolver;
     private final IconProvider mIconProvider;
-    private final HandlerRunnable mCancelledRunnable;
 
     private final SparseArray<BitmapInfo> mWidgetCategoryBitmapInfos;
 
@@ -122,10 +121,6 @@
         mInstantAppResolver = InstantAppResolver.newInstance(mContext);
         mIconProvider = iconProvider;
         mWidgetCategoryBitmapInfos = new SparseArray<>();
-
-        mCancelledRunnable = new HandlerRunnable(
-                mWorkerHandler, () -> null, MAIN_EXECUTOR, c -> { });
-        mCancelledRunnable.cancel();
     }
 
     @Override
@@ -181,30 +176,23 @@
     public HandlerRunnable updateIconInBackground(final ItemInfoUpdateReceiver caller,
             final ItemInfoWithIcon info) {
         Preconditions.assertUIThread();
-        Supplier<ItemInfoWithIcon> task;
-        if (info instanceof AppInfo || info instanceof WorkspaceItemInfo) {
-            task = () -> {
-                getTitleAndIcon(info, false);
-                return info;
-            };
-        } else if (info instanceof PackageItemInfo) {
-            task = () -> {
-                getTitleAndIconForApp((PackageItemInfo) info, false);
-                return info;
-            };
-        } else {
-            Log.i(TAG, "Icon update not supported for "
-                    + info == null ? "null" : info.getClass().getName());
-            return mCancelledRunnable;
-        }
-
         if (mPendingIconRequestCount <= 0) {
             MODEL_EXECUTOR.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
         }
         mPendingIconRequestCount++;
 
         HandlerRunnable<ItemInfoWithIcon> request = new HandlerRunnable<>(mWorkerHandler,
-                task, MAIN_EXECUTOR, caller::reapplyItemInfo, this::onIconRequestEnd);
+                () -> {
+                    if (info instanceof AppInfo || info instanceof WorkspaceItemInfo) {
+                        getTitleAndIcon(info, false);
+                    } else if (info instanceof PackageItemInfo) {
+                        getTitleAndIconForApp((PackageItemInfo) info, false);
+                    }
+                    return info;
+                },
+                MAIN_EXECUTOR,
+                caller::reapplyItemInfo,
+                this::onIconRequestEnd);
         Utilities.postAsyncCallback(mWorkerHandler, request);
         return request;
     }