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

Commit 0c333774 authored by Mady Mellor's avatar Mady Mellor
Browse files

Introduce scrim state for bubbles

When bubbles are expanded we'll want to put a scrim behind them, this
is the scrim state we'll use.

Super simple test to check that alpha / visibility state of scrims
are as expected

Test: atest frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
Bug: 111236845
Change-Id: I1ee8ff9e7ce35aae692cf75a912106255e0e9b5a
parent 2f01ed9a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -186,6 +186,20 @@ public enum ScrimState {
                mBlankScreen = false;
            }
        }
    },

    /**
     * Unlocked with a bubble expanded.
     */
    BUBBLE_EXPANDED(7) {
        @Override
        public void prepare(ScrimState previousState) {
            mCurrentInFrontTint = Color.TRANSPARENT;
            mCurrentBehindTint = Color.TRANSPARENT;
            mAnimationDuration = ScrimController.ANIMATION_DURATION;
            mCurrentBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
            mBlankScreen = false;
        }
    };

    boolean mBlankScreen = false;
+13 −0
Original line number Diff line number Diff line
@@ -262,6 +262,19 @@ public class ScrimControllerTest extends SysuiTestCase {
        assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
    }

    @Test
    public void transitionToBubbleExpanded() {
        mScrimController.transitionTo(ScrimState.BUBBLE_EXPANDED);
        mScrimController.finishAnimationsImmediately();

        // Front scrim should be transparent
        Assert.assertEquals(ScrimController.VISIBILITY_FULLY_TRANSPARENT,
                mScrimInFront.getViewAlpha(), 0.0f);
        // Back scrim should be visible
        Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
                mScrimBehind.getViewAlpha(), 0.0f);
    }

    @Test
    public void scrimStateCallback() {
        mScrimController.transitionTo(ScrimState.UNLOCKED);