From 55479777dd42067ff5e8830454c18f8bb817757d Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Thu, 29 Jul 2021 14:29:50 -0700 Subject: [PATCH] DO NOT MERGE [QPR1] Fix QS having a white when opened over bubbles mBehindTint now controls the background of quick settings. I think this wasn't the case in R when the bubble state was written & it was never updated appropriately whenever that changed. Seems like most of the code in the unlocked state should apply to bubbles so just copied it in and updated the test. Test: atest ScrimControllerTest Bug: 191338071 Change-Id: I90fa26760d346a67d42b22d8e562d5b4c66f3017 --- .../systemui/statusbar/phone/ScrimState.java | 38 ++++++++++++++++--- .../statusbar/phone/ScrimControllerTest.java | 2 +- 2 files changed, 33 insertions(+), 7 deletions(-) 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 06811932ac0cd..a73fec8455d5f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -278,15 +278,41 @@ public enum ScrimState { BUBBLE_EXPANDED { @Override public void prepare(ScrimState previousState) { - mFrontTint = Color.TRANSPARENT; - mBehindTint = Color.TRANSPARENT; - mBubbleTint = Color.BLACK; + mBehindAlpha = mClipQsScrim ? 1 : 0; + mNotifAlpha = 0; + mFrontAlpha = 0; - mFrontAlpha = 0f; - mBehindAlpha = mDefaultScrimAlpha; + mAnimationDuration = mKeyguardFadingAway + ? mKeyguardFadingAwayDuration + : StatusBar.FADE_KEYGUARD_DURATION; + + mAnimateChange = !mLaunchingAffordanceWithPreview; + + mFrontTint = Color.TRANSPARENT; + mBehindTint = Color.BLACK; + mBubbleTint = Color.BLACK; + mBlankScreen = false; + + if (previousState == ScrimState.AOD) { + // Set all scrims black, before they fade transparent. + updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */); + if (mScrimForBubble != null) { + updateScrimColor(mScrimForBubble, 1f /* alpha */, Color.BLACK /* tint */); + } + + // Scrims should still be black at the end of the transition. + mFrontTint = Color.BLACK; + mBehindTint = Color.BLACK; + mBubbleTint = Color.BLACK; + mBlankScreen = true; + } + + if (mClipQsScrim) { + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + } mAnimationDuration = ScrimController.ANIMATION_DURATION; - mBlankScreen = false; } }; 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 678b193073c2c..73164fa35fcca 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 @@ -621,7 +621,7 @@ public class ScrimControllerTest extends SysuiTestCase { assertScrimTinted(Map.of( mScrimInFront, false, - mScrimBehind, false, + mScrimBehind, true, mScrimForBubble, true ));