Various icon cache fixes

> Multiple instances of LauncherIcon created when
    LauncherIcons refers IconCache which in turn creates new LauncherIcons
> Widget icons are never cached as they were using low res icons
> Shortcut drag icons are not loaded synchronously
    when using PinItemRequest flow
> Wrong lastUpdatedTime is used in iconCache for shortcuts
> IconUpdateHandler does not ignore managedUser promise icons

Change-Id: Ie7eed68a30fad11d1861b6c70c380953a15ae1cf
This commit is contained in:
Sunny Goyal
2020-02-06 11:28:01 -08:00
parent a0912d502a
commit 18204e4eea
24 changed files with 250 additions and 281 deletions

View File

@@ -23,7 +23,6 @@ import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -89,12 +88,7 @@ public class ShortcutsChangedTask extends BaseModelUpdateTask {
}
for (final WorkspaceItemInfo workspaceItemInfo : workspaceItemInfos) {
workspaceItemInfo.updateFromDeepShortcutInfo(fullDetails, context);
// If the shortcut is pinned but no longer has an icon in the system,
// keep the current icon instead of reverting to the default icon.
LauncherIcons li = LauncherIcons.obtain(context);
workspaceItemInfo.bitmap = li.createShortcutIcon(
fullDetails, true, () -> workspaceItemInfo);
li.recycle();
app.getIconCache().getShortcutIcon(workspaceItemInfo, fullDetails);
updatedWorkspaceItemInfos.add(workspaceItemInfo);
}
}