if (mDarkenWhileDragging) {
mBehindAlpha = MathUtils.lerp(GRADIENT_SCRIM_ALPHA_BUSY, alphaBehind,
interpolatedFract);
- mInFrontAlpha = 0;
+ mInFrontAlpha = mState.getFrontAlpha();
} else {
mBehindAlpha = MathUtils.lerp(0 /* start */, alphaBehind,
interpolatedFract);
- mInFrontAlpha = 0;
+ mInFrontAlpha = mState.getFrontAlpha();
}
mBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
mState.getBehindTint(), interpolatedFract);
* 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();
}
mState.AOD.setAodFrontScrimAlpha(alpha);
+ mState.PULSING.setAodFrontScrimAlpha(alpha);
}
/**
}
@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.
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