Revert "fetch and update shortcut icons in background thread"

This reverts commit 4ec390e490.

Reason for revert: the code change introduces significant delay when saving deep shortcut icons in cache.

Bug: 142514365
Change-Id: If7a69844aba7f32690ff347f2db11f0a8041b9e4
This commit is contained in:
Pinyao Ting
2019-10-16 19:50:29 +00:00
parent 4ec390e490
commit 01c80d7a00
5 changed files with 27 additions and 66 deletions

View File

@@ -17,7 +17,6 @@
package com.android.launcher3.pm;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import static com.android.launcher3.util.ShortcutUtil.fetchAndUpdateShortcutIconAsync;
import android.annotation.TargetApi;
import android.content.Context;
@@ -30,7 +29,9 @@ import android.os.Parcelable;
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.LauncherIcons;
public class PinRequestHelper {
@@ -80,7 +81,11 @@ public class PinRequestHelper {
ShortcutInfo si = request.getShortcutInfo();
WorkspaceItemInfo info = new WorkspaceItemInfo(si, context);
// Apply the unbadged icon and fetch the actual icon asynchronously.
fetchAndUpdateShortcutIconAsync(context, info, si, false);
LauncherIcons li = LauncherIcons.obtain(context);
info.applyFrom(li.createShortcutIcon(si, false /* badged */));
li.recycle();
LauncherAppState.getInstance(context).getModel()
.updateAndBindWorkspaceItem(info, si);
return info;
} else {
return null;