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

Commit ef8b578c authored by Rahul Banerjee's avatar Rahul Banerjee
Browse files

Decouple shade scrim from Dual Shade color

Bug: 406043695
Test: Manual (build, flash, verify with lt/dt)
Flag: com.android.systemui.notification_shade_blur
Change-Id: Ia923be1cc1fc0be5350982283312c8a1c57c3715
parent 5f64c533
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -205,7 +205,11 @@ object OverlayShade {
        val PanelBackground: Color
            @Composable
            @ReadOnlyComposable
            get() = Color(shadePanel(LocalContext.current, Flags.notificationShadeBlur()))
            get() = Color(shadePanel(
                context = LocalContext.current,
                blurSupported = Flags.notificationShadeBlur(),
                withScrim = false
            ))
    }

    object Dimensions {
+5 −1
Original line number Diff line number Diff line
@@ -194,7 +194,11 @@ constructor(
                bouncerBehindAlpha = 1.0f,
            )
        val shadeNotifAlpha = colorAlpha(notificationScrim(context, isBlurCurrentlySupported))
        val shadeBehindAlpha = colorAlpha(shadePanel(context, isBlurCurrentlySupported))
        val shadeBehindAlpha = colorAlpha(shadePanel(
            context = context,
            blurSupported = isBlurCurrentlySupported,
            withScrim = true
        ))
        val bouncerBehindAlpha =
            if (isBlurCurrentlySupported) ScrimController.TRANSPARENT_BOUNCER_SCRIM_ALPHA else 1.0f
        return when {
+16 −4
Original line number Diff line number Diff line
@@ -21,12 +21,24 @@ import com.android.internal.graphics.ColorUtils
import com.android.systemui.res.R

object ShadeColors {
    /**
     * Calculate notification shade panel color.
     * @param context Context to resolve colors.
     * @param blurSupported Whether blur is enabled (can be off due to battery saver)
     * @param withScrim Whether to composite a scrim when blur is enabled (used by legacy shade).
     * @return color for the shade panel.
     */
    @JvmStatic
    fun shadePanel(context: Context, blurSupported: Boolean): Int {
    fun shadePanel(context: Context, blurSupported: Boolean, withScrim: Boolean): Int {
        return if (blurSupported) {
            if (withScrim) {
                ColorUtils.compositeColors(
                    shadePanelStandard(context),
                    shadePanelScrimBehind(context))
            } else {
                shadePanelStandard(context)
            }

        } else {
            shadePanelFallback(context)
        }
+1 −1
Original line number Diff line number Diff line
@@ -1647,7 +1647,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
    }

    private int getShadePanelColor() {
        return ShadeColors.shadePanel(mContext, isBlurCurrentlySupported());
        return ShadeColors.shadePanel(mContext, isBlurCurrentlySupported(), true);
    }

    private void onThemeChanged() {