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
This commit is contained in:
Matt Pietal
2022-11-10 13:33:39 +00:00
parent a9094c9563
commit 314d44fec2
2 changed files with 18 additions and 5 deletions

View File

@@ -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,12 +903,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
behindAlpha = MathUtils.lerp(0 /* start */, stateBehind,
interpolatedFract);
}
if (mClipsQsScrim) {
behindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getNotifTint(),
if (mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()) {
if (mClipsQsScrim) {
behindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getNotifTint(),
state.getNotifTint(), interpolatedFract);
} else {
behindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
} else {
behindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
state.getBehindTint(), interpolatedFract);
}
}
if (mQsExpansion > 0) {
behindAlpha = MathUtils.lerp(behindAlpha, mDefaultScrimAlpha, mQsExpansion);

View File

@@ -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);