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

Commit 8553c981 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix an issue where forced theme icon will show blank" into main

parents 312ee292 480028b1
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.graphics.Bitmap.Config.HARDWARE
import android.graphics.BlendMode.SRC_IN
import android.graphics.BlendModeColorFilter
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Path
import android.graphics.Rect
import android.graphics.drawable.AdaptiveIconDrawable
@@ -151,11 +152,18 @@ class MonoIconThemeController(
        private val shapePath: Path,
        private val iconScale: Float,
    ) : InsetDrawable(base, -AdaptiveIconDrawable.getExtraInsetFraction()) {
        // TODO(b/399666950): remove this after launcher icon shapes is fully enabled
        private val mCrop = AdaptiveIconDrawable(ColorDrawable(Color.BLACK), null)

        override fun draw(canvas: Canvas) {
            mCrop.bounds = bounds
            val saveCount = canvas.save()
            if (Flags.enableLauncherIconShapes()) {
                canvas.clipPath(shapePath)
            canvas.scale(iconScale, iconScale, canvas.width / 2f, canvas.height / 2f)
                canvas.scale(iconScale, iconScale, bounds.width() / 2f, bounds.height() / 2f)
            } else {
                canvas.clipPath(mCrop.iconMask)
            }
            super.draw(canvas)
            canvas.restoreToCount(saveCount)
        }