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

Commit e5961aff authored by Rahul Banerjee's avatar Rahul Banerjee Committed by Android (Google) Code Review
Browse files

Merge "Decouple shade scrim from Dual Shade color" into main

parents 092e0cb7 ef8b578c
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() {