Keep scrim black when "always on" is off
The first frame when waking up is expensive and we
need a black scrim hiding what was left behind.
Bug: 78022321
Test: atest packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
Change-Id: I99e2b7960daf2cbe51bec6aee4b15c74d532078c
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 4e04790..a2a866e 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
@@ -184,6 +184,16 @@
mScrimController.finishAnimationsImmediately();
assertScrimVisibility(VISIBILITY_FULLY_OPAQUE, VISIBILITY_FULLY_OPAQUE);
+ // ... and alpha updates should be completely ignored if always_on is off.
+ // Passing it forward would mess up the wake-up transition.
+ mAlwaysOnEnabled = false;
+ mScrimController.transitionTo(ScrimState.UNLOCKED);
+ mScrimController.transitionTo(ScrimState.AOD);
+ mScrimController.finishAnimationsImmediately();
+ mScrimController.setAodFrontScrimAlpha(0.3f);
+ Assert.assertEquals(ScrimState.AOD.getFrontAlpha(), mScrimInFront.getViewAlpha(), 0.001f);
+ Assert.assertNotEquals(0.3f, mScrimInFront.getViewAlpha(), 0.001f);
+
// Reset value since enums are static.
mScrimController.setAodFrontScrimAlpha(0f);
}