diff --git a/src/com/android/launcher3/icons/CacheableShortcutInfo.kt b/src/com/android/launcher3/icons/CacheableShortcutInfo.kt index a78da2312e..225e12f47a 100644 --- a/src/com/android/launcher3/icons/CacheableShortcutInfo.kt +++ b/src/com/android/launcher3/icons/CacheableShortcutInfo.kt @@ -112,7 +112,9 @@ object CacheableShortcutCachingLogic : CachingLogic { ?.let { d -> li.createBadgedIconBitmap( d, - IconOptions().setExtractedColor(Themes.getColorAccent(context)), + IconOptions() + .setExtractedColor(Themes.getColorAccent(context)) + .setSourceHint(getSourceHint(info, cache)), ) } ?: BitmapInfo.LOW_RES_INFO } diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java index 88a60ea38d..9f99e8f00a 100644 --- a/src/com/android/launcher3/icons/IconCache.java +++ b/src/com/android/launcher3/icons/IconCache.java @@ -594,7 +594,8 @@ public class IconCache extends BaseIconCache { @VisibleForTesting synchronized boolean isItemInDb(ComponentKey cacheKey) { - return getEntryFromDBLocked(cacheKey, new CacheEntry(), DEFAULT_LOOKUP_FLAG); + return getEntryFromDBLocked(cacheKey, new CacheEntry(), DEFAULT_LOOKUP_FLAG, + LauncherActivityCachingLogic.INSTANCE); } /** diff --git a/tests/multivalentTests/src/com/android/launcher3/icons/mono/MonoIconThemeControllerTest.kt b/tests/multivalentTests/src/com/android/launcher3/icons/mono/MonoIconThemeControllerTest.kt index 4af564e009..12c14fb3a2 100644 --- a/tests/multivalentTests/src/com/android/launcher3/icons/mono/MonoIconThemeControllerTest.kt +++ b/tests/multivalentTests/src/com/android/launcher3/icons/mono/MonoIconThemeControllerTest.kt @@ -16,9 +16,11 @@ package com.android.launcher3.icons.mono +import android.content.ComponentName import android.graphics.Color import android.graphics.drawable.AdaptiveIconDrawable import android.graphics.drawable.ColorDrawable +import android.os.Process import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule @@ -29,6 +31,9 @@ import androidx.test.filters.SmallTest import com.android.launcher3.Flags import com.android.launcher3.icons.BaseIconFactory import com.android.launcher3.icons.BitmapInfo +import com.android.launcher3.icons.SourceHint +import com.android.launcher3.icons.cache.LauncherActivityCachingLogic +import com.android.launcher3.util.ComponentKey import com.android.launcher3.util.LauncherMultivalentJUnit.Companion.isRunningInRobolectric import org.junit.Assert.assertNotNull import org.junit.Assert.assertNull @@ -45,6 +50,12 @@ class MonoIconThemeControllerTest { private val iconFactory = BaseIconFactory(context, DisplayMetrics.DENSITY_MEDIUM, 30) + private val sourceHint = + SourceHint( + key = ComponentKey(ComponentName("a", "a"), Process.myUserHandle()), + logic = LauncherActivityCachingLogic, + ) + @Test fun `createThemedBitmap when mono drawable is present`() { val icon = AdaptiveIconDrawable(ColorDrawable(Color.BLACK), null, ColorDrawable(Color.RED)) @@ -81,7 +92,8 @@ class MonoIconThemeControllerTest { val themeBitmap = MonoIconThemeController().createThemedBitmap(icon, iconInfo, iconFactory)!! assertNotNull( - MonoIconThemeController().decode(themeBitmap.serialize(), iconInfo, iconFactory) + MonoIconThemeController() + .decode(themeBitmap.serialize(), iconInfo, iconFactory, sourceHint) ) } @@ -90,7 +102,10 @@ class MonoIconThemeControllerTest { ensureBitmapSerializationSupported() val icon = AdaptiveIconDrawable(ColorDrawable(Color.BLACK), null, ColorDrawable(Color.RED)) val iconInfo = iconFactory.createBadgedIconBitmap(icon) - assertNull(MonoIconThemeController().decode(byteArrayOf(1, 1, 1, 1), iconInfo, iconFactory)) + assertNull( + MonoIconThemeController() + .decode(byteArrayOf(1, 1, 1, 1), iconInfo, iconFactory, sourceHint) + ) } @Test