diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java index 5ece4a62dd..7ba2317868 100644 --- a/src/com/android/launcher3/icons/IconCache.java +++ b/src/com/android/launcher3/icons/IconCache.java @@ -16,6 +16,7 @@ package com.android.launcher3.icons; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import static com.android.launcher3.widget.WidgetSections.NO_CATEGORY; @@ -340,14 +341,15 @@ public class IconCache extends BaseIconCache { Map, List>> iconLoadSubsectionsMap = iconRequestInfos.stream() .filter(iconRequest -> { - if (iconRequest.itemInfo.getTargetComponent() != null) { - return true; + if (iconRequest.itemInfo.getTargetComponent() == null) { + Log.i(TAG, + "Skipping Item info with null component name: " + + iconRequest.itemInfo); + iconRequest.itemInfo.bitmap = getDefaultIcon( + iconRequest.itemInfo.user); + return false; } - Log.i(TAG, - "Skipping Item info with null component name: " - + iconRequest.itemInfo); - iconRequest.itemInfo.bitmap = getDefaultIcon(iconRequest.itemInfo.user); - return false; + return true; }) .collect(groupingBy(iconRequest -> Pair.create(iconRequest.itemInfo.user, iconRequest.useLowResIcon))); @@ -356,6 +358,17 @@ public class IconCache extends BaseIconCache { iconLoadSubsectionsMap.forEach((sectionKey, filteredList) -> { Map>> duplicateIconRequestsMap = filteredList.stream() + .filter(iconRequest -> { + // Filter out icons that should not share the same bitmap and title + if (iconRequest.itemInfo.itemType == ITEM_TYPE_DEEP_SHORTCUT) { + Log.e(TAG, + "Skipping Item info for deep shortcut: " + + iconRequest.itemInfo, + new IllegalStateException()); + return false; + } + return true; + }) .collect(groupingBy(iconRequest -> iconRequest.itemInfo.getTargetComponent())); diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index b9fa21d10d..f1c5d59fc8 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -615,7 +615,13 @@ public class LoaderTask implements Runnable { } if (info != null) { - iconRequestInfos.add(c.createIconRequestInfo(info, useLowResIcon)); + if (info.itemType + != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { + // Skip deep shortcuts; their title and icons have already been + // loaded above. + iconRequestInfos.add( + c.createIconRequestInfo(info, useLowResIcon)); + } c.applyCommonProperties(info);