From 314d44fec26a423b0b12fdaf08c419742597890d Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Thu, 10 Nov 2022 13:33:39 +0000 Subject: [PATCH] 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 --- .../systemui/statusbar/phone/ScrimController.java | 12 +++++++----- .../statusbar/phone/ScrimControllerTest.java | 11 +++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 86e27aba65f09..d54a8638f2e9e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -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); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java index df48e1d43584a..808abc8e9de56 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java @@ -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);