Apply front scrim to doze pulsing

When ambient goes dark, apply the same front scrim opacity during doze
pulsing. The would then be a common behavior to all pulsing reaons.

Bug: 139445074
Test: Manual tests
Test: atest ScrimControllerTest
Change-Id: I3f1f7ca00b9d200ce4a7120b5328527ab9d9fb13
This commit is contained in:
Chris.CC Lee
2019-09-16 12:17:19 +08:00
parent 7c03ce7afe
commit 84d6b0bfc3
2 changed files with 15 additions and 4 deletions

View File

@@ -503,8 +503,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
* device is dozing when the light sensor is on.
*/
public void setAodFrontScrimAlpha(float alpha) {
if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()
&& mInFrontAlpha != alpha) {
if (((mState == ScrimState.AOD && mDozeParameters.getAlwaysOn())
|| mState == ScrimState.PULSING) && mInFrontAlpha != alpha) {
mInFrontAlpha = alpha;
updateScrims();
}

View File

@@ -243,7 +243,7 @@ public class ScrimControllerTest extends SysuiTestCase {
}
@Test
public void transitionToPulsing() {
public void transitionToPulsing_withFrontAlphaUpdates() {
// Pre-condition
// Need to go to AoD first because PULSING doesn't change
// the back scrim opacity - otherwise it would hide AoD wallpapers.
@@ -267,11 +267,22 @@ public class ScrimControllerTest extends SysuiTestCase {
true /* behind */,
false /* bubble */);
// ... and when ambient goes dark, front scrim should be semi-transparent
mScrimController.setAodFrontScrimAlpha(0.5f);
mScrimController.finishAnimationsImmediately();
// Front scrim should be semi-transparent
assertScrimAlpha(SEMI_TRANSPARENT /* front */,
OPAQUE /* back */,
TRANSPARENT /* bubble */);
mScrimController.setWakeLockScreenSensorActive(true);
mScrimController.finishAnimationsImmediately();
assertScrimAlpha(TRANSPARENT /* front */,
assertScrimAlpha(SEMI_TRANSPARENT /* front */,
SEMI_TRANSPARENT /* back */,
TRANSPARENT /* bubble */);
// Reset value since enums are static.
mScrimController.setAodFrontScrimAlpha(0f);
}
@Test