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

Commit 314d44fe authored by Matt Pietal's avatar Matt Pietal
Browse files

Scrims - Don't blend with bouncer when shade is collapsing

In the case of having transitioned back to KEYGUARD state, never blend
with the bouncer scrims unless the bouncer is actively in
transit. This prevents the scrim from flashing after collapsing the
shade over lockscreen.

Fixes: 248405303
Test: atest ScrimControllerTest
Test: manually display shade, lockscreen, bouncer and change dark modes
Change-Id: I645115abeb09822a99508b9d9f1fc974b7ce31be
parent a9094c95
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -895,7 +895,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump

        float stateBehind = mClipsQsScrim ? state.getNotifAlpha() : state.getBehindAlpha();
        float behindAlpha;
        int behindTint;
        int behindTint = state.getBehindTint();
        if (mDarkenWhileDragging) {
            behindAlpha = MathUtils.lerp(mDefaultScrimAlpha, stateBehind,
                    interpolatedFract);
@@ -903,6 +903,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            behindAlpha = MathUtils.lerp(0 /* start */, stateBehind,
                    interpolatedFract);
        }
        if (mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()) {
            if (mClipsQsScrim) {
                behindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getNotifTint(),
                    state.getNotifTint(), interpolatedFract);
@@ -910,6 +911,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
                behindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
                    state.getBehindTint(), interpolatedFract);
            }
        }
        if (mQsExpansion > 0) {
            behindAlpha = MathUtils.lerp(behindAlpha, mDefaultScrimAlpha, mQsExpansion);
            float tintProgress = mQsExpansion;
+11 −0
Original line number Diff line number Diff line
@@ -1436,6 +1436,17 @@ public class ScrimControllerTest extends SysuiTestCase {
        assertAlphaAfterExpansion(mNotificationsScrim, alpha, expansion);
    }

    @Test
    public void behindTint_inKeyguardState_bouncerNotActive_usesKeyguardBehindTint() {
        when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(false);
        mScrimController.setClipsQsScrim(false);

        mScrimController.transitionTo(ScrimState.KEYGUARD);
        finishAnimationsImmediately();
        assertThat(mScrimBehind.getTint())
                .isEqualTo(ScrimState.KEYGUARD.getBehindTint());
    }

    @Test
    public void testNotificationTransparency_followsTransitionToFullShade() {
        mScrimController.transitionTo(SHADE_LOCKED);