From 051bd9755921d1466ee6ae3a0dafc1daa20176b8 Mon Sep 17 00:00:00 2001 From: Beverly Date: Thu, 3 Nov 2022 18:33:54 +0000 Subject: [PATCH] Update alternate bouncer scrim values Even when QS isn't clipped, the behind alpha should be 1f for AUTH_SCRIMMED_SHADE. Test: pull down notification shade on LS, then tap a notification with intent => see alternate bouncer with the correct scrim values Test: on the LS, double tap the power button to open the camera app. Pull down the shade and then tap on a notification with intent => see alternate bouncer with the correct scrim values Test: atest ScrimControllerTest Bug: 237362467 Change-Id: Ib68d8c9d0bb16a486b9940ba103cb10c6587872b Change-Id: Id07fd3294a1dc807febe1ef04fc033def56fe30f --- .../statusbar/phone/ScrimController.java | 10 +------ .../systemui/statusbar/phone/ScrimState.java | 5 +++- .../statusbar/phone/ScrimControllerTest.java | 30 ++++++++++++++++++- 3 files changed, 34 insertions(+), 11 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 cf3a48cf50001..e744c7932c47e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -820,15 +820,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mNotificationsAlpha = KEYGUARD_SCRIM_ALPHA; } } else if (mState == ScrimState.AUTH_SCRIMMED_SHADE) { - float behindFraction = getInterpolatedFraction(); - behindFraction = (float) Math.pow(behindFraction, 0.8f); - - mBehindAlpha = behindFraction * mDefaultScrimAlpha; - mNotificationsAlpha = mBehindAlpha; - if (mClipsQsScrim) { - mBehindAlpha = 1; - mBehindTint = Color.BLACK; - } + mNotificationsAlpha = (float) Math.pow(getInterpolatedFraction(), 0.8f); } else if (mState == ScrimState.KEYGUARD || mState == ScrimState.SHADE_LOCKED || mState == ScrimState.PULSING) { Pair result = calculateBackStateForState(mState); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java index b447f0d36c108..52430d33cbf08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -90,11 +90,14 @@ public enum ScrimState { AUTH_SCRIMMED_SHADE { @Override public void prepare(ScrimState previousState) { - // notif & behind scrim alpha values are determined by ScrimController#applyState + // notif scrim alpha values are determined by ScrimController#applyState // based on the shade expansion mFrontTint = Color.BLACK; mFrontAlpha = .66f; + + mBehindTint = Color.BLACK; + mBehindAlpha = 1f; } }, 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 a5deaa45bf0f9..696775a240745 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 @@ -1150,7 +1150,7 @@ public class ScrimControllerTest extends SysuiTestCase { } @Test - public void testAuthScrim_notifScrimOpaque_whenShadeFullyExpanded() { + public void testAuthScrim_setClipQSScrimTrue_notifScrimOpaque_whenShadeFullyExpanded() { // GIVEN device has an activity showing ('UNLOCKED' state can occur on the lock screen // with the camera app occluding the keyguard) mScrimController.transitionTo(ScrimState.UNLOCKED); @@ -1176,6 +1176,34 @@ public class ScrimControllerTest extends SysuiTestCase { )); } + + @Test + public void testAuthScrim_setClipQSScrimFalse_notifScrimOpaque_whenShadeFullyExpanded() { + // GIVEN device has an activity showing ('UNLOCKED' state can occur on the lock screen + // with the camera app occluding the keyguard) + mScrimController.transitionTo(ScrimState.UNLOCKED); + mScrimController.setClipsQsScrim(false); + mScrimController.setRawPanelExpansionFraction(1); + // notifications scrim alpha change require calling setQsPosition + mScrimController.setQsPosition(0, 300); + finishAnimationsImmediately(); + + // WHEN the user triggers the auth bouncer + mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE); + finishAnimationsImmediately(); + + assertEquals("Behind scrim should be opaque", + mScrimBehind.getViewAlpha(), 1, 0.0); + assertEquals("Notifications scrim should be opaque", + mNotificationsScrim.getViewAlpha(), 1, 0.0); + + assertScrimTinted(Map.of( + mScrimInFront, true, + mScrimBehind, true, + mNotificationsScrim, false + )); + } + @Test public void testAuthScrimKeyguard() { // GIVEN device is on the keyguard