Merge "Apply front scrim to doze pulsing"

This commit is contained in:
TreeHugger Robot
2019-09-17 01:20:55 +00:00
committed by Android (Google) Code Review
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