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

Commit c7dc9ab8 authored by Mady Mellor's avatar Mady Mellor
Browse files

Remove BUBBLE_EXPANDED state from ScrimController

I don't think this is needed at all after removing
bubble scrim from ScrimController.

Additionally, this fixes the issue where QS didn't
have a background when pulled down on top of bubbles.

Test: manual - expand a bubble & pull down the shade
             => verify QS look normal
             - expand a bubble, tap the manage button,
               collapse the bubble & pull down the shade
             => verify QS look normal
Test: atest ScrimControllerTest
Bug: 191338071
Bug: 191769064
Change-Id: Ie7aaec551700c823cce5cf6f4ea4f650b640ab63
parent 0974348d
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -480,8 +480,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            boolean relevantState = (mState == ScrimState.UNLOCKED
            boolean relevantState = (mState == ScrimState.UNLOCKED
                    || mState == ScrimState.KEYGUARD
                    || mState == ScrimState.KEYGUARD
                    || mState == ScrimState.SHADE_LOCKED
                    || mState == ScrimState.SHADE_LOCKED
                    || mState == ScrimState.PULSING
                    || mState == ScrimState.PULSING);
                    || mState == ScrimState.BUBBLE_EXPANDED);
            if (!(relevantState && mExpansionAffectsAlpha)) {
            if (!(relevantState && mExpansionAffectsAlpha)) {
                return;
                return;
            }
            }
@@ -548,8 +547,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            mQsBottomVisible = qsBottomVisible;
            mQsBottomVisible = qsBottomVisible;
            boolean relevantState = (mState == ScrimState.SHADE_LOCKED
            boolean relevantState = (mState == ScrimState.SHADE_LOCKED
                    || mState == ScrimState.KEYGUARD
                    || mState == ScrimState.KEYGUARD
                    || mState == ScrimState.PULSING
                    || mState == ScrimState.PULSING);
                    || mState == ScrimState.BUBBLE_EXPANDED);
            if (!(relevantState && mExpansionAffectsAlpha)) {
            if (!(relevantState && mExpansionAffectsAlpha)) {
                return;
                return;
            }
            }
@@ -622,7 +620,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            return;
            return;
        }
        }


        if (mState == ScrimState.UNLOCKED || mState == ScrimState.BUBBLE_EXPANDED) {
        if (mState == ScrimState.UNLOCKED) {
            // Darken scrim as you pull down the shade when unlocked, unless the shade is expanding
            // Darken scrim as you pull down the shade when unlocked, unless the shade is expanding
            // because we're doing the screen off animation.
            // because we're doing the screen off animation.
            if (!mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()) {
            if (!mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()) {
+0 −17
Original line number Original line Diff line number Diff line
@@ -250,23 +250,6 @@ public enum ScrimState {
                updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK);
                updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK);
            }
            }
        }
        }
    },

    /**
     * Unlocked with a bubble expanded.
     */
    BUBBLE_EXPANDED {
        @Override
        public void prepare(ScrimState previousState) {
            mFrontTint = Color.TRANSPARENT;
            mBehindTint = Color.TRANSPARENT;

            mFrontAlpha = 0f;
            mBehindAlpha = mDefaultScrimAlpha;

            mAnimationDuration = ScrimController.ANIMATION_DURATION;
            mBlankScreen = false;
        }
    };
    };


    boolean mBlankScreen = false;
    boolean mBlankScreen = false;
+0 −2
Original line number Original line Diff line number Diff line
@@ -4481,8 +4481,6 @@ public class StatusBar extends SystemUI implements DemoMode,
            mScrimController.transitionTo(ScrimState.AOD);
            mScrimController.transitionTo(ScrimState.AOD);
        } else if (mIsKeyguard && !unlocking) {
        } else if (mIsKeyguard && !unlocking) {
            mScrimController.transitionTo(ScrimState.KEYGUARD);
            mScrimController.transitionTo(ScrimState.KEYGUARD);
        } else if (mBubblesOptional.isPresent() && mBubblesOptional.get().isStackExpanded()) {
            mScrimController.transitionTo(ScrimState.BUBBLE_EXPANDED, mUnlockScrimCallback);
        } else {
        } else {
            mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
            mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
        }
        }
+1 −18
Original line number Original line Diff line number Diff line
@@ -642,23 +642,6 @@ public class ScrimControllerTest extends SysuiTestCase {
                mScrimBehind, SEMI_TRANSPARENT));
                mScrimBehind, SEMI_TRANSPARENT));
    }
    }


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

        assertScrimTinted(Map.of(
                mScrimInFront, false,
                mScrimBehind, false
        ));

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


    @Test
    @Test
    public void scrimStateCallback() {
    public void scrimStateCallback() {
@@ -1061,7 +1044,7 @@ public class ScrimControllerTest extends SysuiTestCase {
        HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
        HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
                ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
                ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
                ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR, ScrimState.UNLOCKED,
                ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR, ScrimState.UNLOCKED,
                ScrimState.BUBBLE_EXPANDED, ScrimState.SHADE_LOCKED, ScrimState.AUTH_SCRIMMED));
                ScrimState.SHADE_LOCKED, ScrimState.AUTH_SCRIMMED));


        for (ScrimState state : ScrimState.values()) {
        for (ScrimState state : ScrimState.values()) {
            if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {
            if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {