From 99b958d581be5abc4812d6fbf9fb6b31b051928d Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 18 Apr 2022 17:29:07 +0000 Subject: [PATCH] [Scrim] Remove notif scrim flicker on unlock We just keep notif scrim alpha to 0 when we are on keyguard and we are not transitioning to full shade. This will prevent the notification shade from showing when tracking on the lockscreen. Bug: 201040592 Test: Manual on devices of multiple form factors: Launch notif from LS - portrait and landscape Launch UserSwitcher From LS - portrait and landscape Show pin bouncer in LS Swipe to unlock - portrait and landscape Change-Id: I0cfa7cd40b69c5c9ea7eeb708f1a073f307918cb --- .../systemui/statusbar/phone/ScrimController.java | 6 +++++- .../statusbar/phone/ScrimControllerTest.java | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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 8c1ed19a8dcc4..35aee66452893 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -850,7 +850,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump // At the end of a launch animation over the lockscreen, the state is either KEYGUARD or // SHADE_LOCKED and this code is called. We have to set the notification alpha to 0 // otherwise there is a flicker to its previous value. - if (mKeyguardOccluded) { + boolean hideNotificationScrim = (mState == ScrimState.KEYGUARD + && mTransitionToFullShadeProgress == 0 + && mQsExpansion == 0 + && !mClipsQsScrim); + if (mKeyguardOccluded || hideNotificationScrim) { mNotificationsAlpha = 0; } if (mUnOcclusionAnimationRunning && mState == ScrimState.KEYGUARD) { 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 ff2c05b041601..dce520c0973df 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 @@ -1270,6 +1270,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_unnocclusionAnimating_bouncerActive_usesKeyguardNotifAlpha() { when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true); + mScrimController.setClipsQsScrim(true); mScrimController.transitionTo(ScrimState.KEYGUARD); mScrimController.setUnocclusionAnimationRunning(true); @@ -1312,6 +1313,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_inKeyguardState_bouncerActive_usesInvertedBouncerInterpolator() { when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true); + mScrimController.setClipsQsScrim(true); mScrimController.transitionTo(ScrimState.KEYGUARD); @@ -1331,6 +1333,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_inKeyguardState_bouncerNotActive_usesInvertedShadeInterpolator() { when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(false); + mScrimController.setClipsQsScrim(true); mScrimController.transitionTo(ScrimState.KEYGUARD); @@ -1478,6 +1481,15 @@ public class ScrimControllerTest extends SysuiTestCase { mNotificationsScrim, TRANSPARENT)); } + @Test + public void notificationAlpha_inKeyguardState_bouncerNotActive_clipsQsScrimFalse() { + mScrimController.setClipsQsScrim(false); + mScrimController.transitionTo(ScrimState.KEYGUARD); + + float expansion = 0.8f; + assertAlphaAfterExpansion(mNotificationsScrim, 0f, expansion); + } + private void assertAlphaAfterExpansion(ScrimView scrim, float expectedAlpha, float expansion) { mScrimController.setRawPanelExpansionFraction(expansion); finishAnimationsImmediately();