Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d45fc70 authored by Chris.CC Lee's avatar Chris.CC Lee Committed by android-build-merger
Browse files

Merge "Apply front scrim to doze pulsing" into qt-qpr1-dev am: 513a591c

am: cc5500b8

Change-Id: I21f44e3e1c1c3d01ebdc3578ef64007db22601d2
parents f453e781 cc5500b8
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -473,11 +473,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
            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);
@@ -503,13 +503,14 @@ 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();
        }

        mState.AOD.setAodFrontScrimAlpha(alpha);
        mState.PULSING.setAodFrontScrimAlpha(alpha);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ public enum ScrimState {
    PULSING(5) {
        @Override
        public void prepare(ScrimState previousState) {
            mFrontAlpha = 0f;
            mFrontAlpha = mAodFrontScrimAlpha;
            mBubbleAlpha = 0f;
            mBehindTint = Color.BLACK;
            mFrontTint = Color.BLACK;
+13 −2
Original line number Diff line number Diff line
@@ -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