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

Commit cbda63c5 authored by William Xiao's avatar William Xiao
Browse files

Fix blurred shade not having scrims on dream and hub

ScrimState parameters are not set correctly to enable the new blurred
shade to show scrims. Updated to match existing system spaces.

Bug: 371635271
Fixed: 371635271
Test: N/A, manually verified on device
Flag: com.android.systemui.notification_shade_blur
Change-Id: I4cdd470d81f90a4a64651888e1af01beef44c4c0
parent aa8beeae
Loading
Loading
Loading
Loading
+58 −25
Original line number Diff line number Diff line
@@ -28,10 +28,10 @@ import com.android.systemui.scrim.ScrimView;
import com.android.systemui.shade.ui.ShadeColors;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;

import java.util.function.Supplier;

import kotlinx.coroutines.ExperimentalCoroutinesApi;

import java.util.function.Supplier;

/**
 * Possible states of the ScrimController state machine.
 */
@@ -340,6 +340,17 @@ public enum ScrimState {
    DREAMING {
        @Override
        public void prepare(ScrimState previousState) {
            if (Flags.notificationShadeBlur()) {
                // Scrim parameters should match SHADE_LOCKED like other activities occluding
                // keyguard.
                mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(),
                        mIsBlurSupported.get());
                mBehindAlpha = Color.alpha(mBehindTint) / 255.0f;
                mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(),
                        mIsBlurSupported.get());
                mNotifAlpha = Color.alpha(mNotifTint) / 255.0f;
                mFrontAlpha = 0.0f;
            } else {
                mFrontTint = Color.TRANSPARENT;
                mBehindTint = mBackgroundColor;
                mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT;
@@ -354,6 +365,7 @@ public enum ScrimState {
                    updateScrimColor(mScrimBehind, 1f /* alpha */, mBackgroundColor);
                }
            }
        }
    },

    /**
@@ -364,6 +376,15 @@ public enum ScrimState {
    GLANCEABLE_HUB {
        @Override
        public void prepare(ScrimState previousState) {
            if (Flags.notificationShadeBlur()) {
                // Scrim parameters should match KEYGUARD as we're showing on top of keyguard.
                mBehindTint = Color.TRANSPARENT;
                mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(),
                        mIsBlurSupported.get());
                mBehindAlpha = 0.0f;
                mNotifAlpha = 0.0f;
                mFrontAlpha = 0.0f;
            } else {
                // No scrims should be visible by default in this state.
                mBehindAlpha = 0;
                mNotifAlpha = 0;
@@ -373,6 +394,7 @@ public enum ScrimState {
                mBehindTint = mBackgroundColor;
                mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT;
            }
        }
    },

    /**
@@ -386,6 +408,16 @@ public enum ScrimState {
    GLANCEABLE_HUB_OVER_DREAM {
        @Override
        public void prepare(ScrimState previousState) {
            if (Flags.notificationShadeBlur()) {
                // Scrim parameters should match DREAM as hub is showing while on top of the dream.
                mBehindTint = ShadeColors.shadePanel(mScrimBehind.getResources(),
                        mIsBlurSupported.get());
                mBehindAlpha = Color.alpha(mBehindTint) / 255.0f;
                mNotifTint = ShadeColors.notificationScrim(mScrimBehind.getResources(),
                        mIsBlurSupported.get());
                mNotifAlpha = Color.alpha(mNotifTint) / 255.0f;
                mFrontAlpha = 0.0f;
            } else {
                // No scrims should be visible by default in this state.
                mBehindAlpha = 0;
                mNotifAlpha = 0;
@@ -395,6 +427,7 @@ public enum ScrimState {
                mBehindTint = mBackgroundColor;
                mNotifTint = mClipQsScrim ? mBackgroundColor : Color.TRANSPARENT;
            }
        }
    };

    boolean mBlankScreen = false;