Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ec7d2a0 authored by Sihua Ma's avatar Sihua Ma
Browse files

Exclude dynamic shortcuts from being force themed

Test: Manual
Bug: 397501448
Flag: com.android.launcher3.force_monochrome_app_icons
Change-Id: I0899b1fcb9897c8196b435f5017f05456f8fece9
parent aa821005
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -59,4 +59,5 @@ data class SourceHint(
    val key: ComponentKey,
    val logic: CachingLogic<*>,
    val freshnessId: String? = null,
    val isFileDrawable: Boolean = false,
)
+1 −1
Original line number Diff line number Diff line
@@ -641,7 +641,7 @@ constructor(
            ComponentKey(ComponentName(packageName, packageName + EMPTY_CLASS_NAME), user)

        // Ensures themed bitmaps in the icon cache are invalidated
        @JvmField val RELEASE_VERSION = if (Flags.forceMonochromeAppIcons()) 6 else 5
        @JvmField val RELEASE_VERSION = if (Flags.forceMonochromeAppIcons()) 8 else 7

        @JvmField val TABLE_NAME = "icons"
        @JvmField val COLUMN_ROWID = "rowid"
+7 −3
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class MonoIconThemeController(
        factory: BaseIconFactory,
        sourceHint: SourceHint?,
    ): ThemedBitmap? {
        val mono = getMonochromeDrawable(icon, info)
        val mono = getMonochromeDrawable(icon, info, sourceHint?.isFileDrawable ?: false)
        if (mono != null) {
            val scale =
                factory.normalizer.getScale(AdaptiveIconDrawable(ColorDrawable(Color.BLACK), null))
@@ -71,12 +71,16 @@ class MonoIconThemeController(
     *
     * @param base the original icon
     */
    private fun getMonochromeDrawable(base: AdaptiveIconDrawable, info: BitmapInfo): Drawable? {
    private fun getMonochromeDrawable(
        base: AdaptiveIconDrawable,
        info: BitmapInfo,
        isFileDrawable: Boolean,
    ): Drawable? {
        val mono = base.monochrome
        if (mono != null) {
            return ClippedMonoDrawable(mono)
        }
        if (Flags.forceMonochromeAppIcons()) {
        if (Flags.forceMonochromeAppIcons() && !isFileDrawable) {
            return MonochromeIconFactory(info.icon.width).wrap(base)
        }
        return null