From a5081d9e8029d88cf749879b195d09276cd3e57e Mon Sep 17 00:00:00 2001 From: Beverly Date: Wed, 8 Mar 2023 17:23:52 +0000 Subject: [PATCH] On occlusion: use AUTH_SCRIMMED scrim state Previously, it was using AUTH_SCRIMMED_SHADE because when an app is occluding the lockscreen, the status bar state is StatusBarState.SHADE. Therefore, we need to make sure that if we're occluding (and the shade is not expanded), that the AUTH_SCRIMMED scrim is used. On devices where clipQs=false, using AUTH_SCRIMMED_SHADE instead of AUTH_SCRIMMED would make the alternate bouncer have a black background instead of showing a transparent scrim over the occluding activity. Fixes: 272101893 Test: atest CentralSurfacesImplTest Test: show the alternate bouncer over an occluding app, scrim is transparent over occluding app Test: show the alternate bouncer over the shade on top of an occluding app => frontScrim is transparent over the notification shade. Back & notification scrims are the same as what they'd be for the regular open shade Change-Id: Ie3b2d3ff7868eb038023787e5cae35c98576f5fe --- .../statusbar/phone/CentralSurfacesImpl.java | 6 ++-- .../phone/CentralSurfacesImplTest.java | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index b5d51ce2b9ee3..9b41077068e65 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -3745,10 +3745,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { boolean launchingAffordanceWithPreview = mLaunchingAffordance; mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview); - if (mAlternateBouncerInteractor.isVisibleState()) { - if (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED - || mTransitionToFullShadeProgress > 0f) { + if ((!isOccluded() || isPanelExpanded()) + && (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED + || mTransitionToFullShadeProgress > 0f)) { mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE); } else { mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index 5a5b1424758fc..1d60d436aa090 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -1035,6 +1035,34 @@ public class CentralSurfacesImplTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).onKeyguardFadedAway(); } + @Test + public void testOccludingQSNotExpanded_transitionToAuthScrimmed() { + when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); + + // GIVEN device occluded and panel is NOT expanded + mCentralSurfaces.setBarStateForTest(SHADE); // occluding on LS has StatusBarState = SHADE + when(mKeyguardStateController.isOccluded()).thenReturn(true); + mCentralSurfaces.mPanelExpanded = false; + + mCentralSurfaces.updateScrimController(); + + verify(mScrimController).transitionTo(eq(ScrimState.AUTH_SCRIMMED)); + } + + @Test + public void testOccludingQSExpanded_transitionToAuthScrimmedShade() { + when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); + + // GIVEN device occluded and qs IS expanded + mCentralSurfaces.setBarStateForTest(SHADE); // occluding on LS has StatusBarState = SHADE + when(mKeyguardStateController.isOccluded()).thenReturn(true); + mCentralSurfaces.mPanelExpanded = true; + + mCentralSurfaces.updateScrimController(); + + verify(mScrimController).transitionTo(eq(ScrimState.AUTH_SCRIMMED_SHADE)); + } + @Test public void testShowKeyguardImplementation_setsState() { when(mLockscreenUserManager.getCurrentProfiles()).thenReturn(new SparseArray<>());