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

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

Fix shade blur out of sync with dark/light theme

Bug: 398901531
Flag: com.android.systemui.notification_shade_blur
Test: Manual (toggle dark theme with shade pulled down)

Change-Id: I22a497716fc3b4b88c0c1b200a1ee592dadd00fa
parent 6e211a64
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.content.Context;
import android.graphics.Color;
import android.os.Handler;
import android.util.Log;
@@ -226,6 +227,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump

    private ScrimState mState = ScrimState.UNINITIALIZED;

    private Context mContext;

    private ScrimView mScrimInFront;
    private ScrimView mNotificationsScrim;
    private ScrimView mScrimBehind;
@@ -365,7 +368,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            @Main CoroutineDispatcher mainDispatcher,
            LargeScreenShadeInterpolator largeScreenShadeInterpolator,
            BlurConfig blurConfig,
            @Main Context context,
            Lazy<WindowRootViewBlurInteractor> windowRootViewBlurInteractor) {
        mContext = context;
        mScrimStateListener = lightBarController::setScrimState;
        mLargeScreenShadeInterpolator = largeScreenShadeInterpolator;
        mBlurConfig = blurConfig;
@@ -1627,16 +1632,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump

    private void updateThemeColors() {
        if (mScrimBehind == null) return;
        int background = mScrimBehind.getContext().getColor(
        int background = mContext.getColor(
                com.android.internal.R.color.materialColorSurfaceDim);
        int accent = mScrimBehind.getContext().getColor(
        int accent = mContext.getColor(
                com.android.internal.R.color.materialColorPrimary);
        mColors.setMainColor(background);
        mColors.setSecondaryColor(accent);
        final boolean isBackgroundLight = !ContrastColorUtil.isColorDark(background);
        mColors.setSupportsDarkText(isBackgroundLight);

        int surface = mScrimBehind.getContext().getColor(
        int surface = mContext.getColor(
                com.android.internal.R.color.materialColorSurface);
        for (ScrimState state : ScrimState.values()) {
            state.setSurfaceColor(surface);
+2 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@ public class ScrimControllerTest extends SysuiTestCase {
                mKosmos.getTestDispatcher(),
                mLinearLargeScreenShadeInterpolator,
                new BlurConfig(0.0f, 0.0f),
                mContext,
                mKosmos::getWindowRootViewBlurInteractor);
        mScrimController.setScrimVisibleListener(visible -> mScrimVisibility = visible);
        mScrimController.attachViews(mScrimBehind, mNotificationsScrim, mScrimInFront);
@@ -1247,6 +1248,7 @@ public class ScrimControllerTest extends SysuiTestCase {
                mKosmos.getTestDispatcher(),
                mLinearLargeScreenShadeInterpolator,
                new BlurConfig(0.0f, 0.0f),
                mContext,
                mKosmos::getWindowRootViewBlurInteractor);
        mScrimController.setScrimVisibleListener(visible -> mScrimVisibility = visible);
        mScrimController.attachViews(mScrimBehind, mNotificationsScrim, mScrimInFront);