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

Commit 4750e965 authored by Matt Pietal's avatar Matt Pietal
Browse files

Fix keyguard -> shade_locked scrim transition

A recent fix to not apply the bouncer scrim exposed this bug, where
pulling down the shade over the lockscreen was not correctly setting
the notif scrim.

Remove the hardcoded BLACK value, and align with all other ScrimStates
to use conditional logic for mClipsQsScrim.

Fixes: 259684978
Test: atest ScrimControllerTest
Test: manual pull down shade and use bouncer over lockscreen, in
regular and split shade modes

Change-Id: I057fad9149523e418f909bade90490effdc26eb5
parent a1d7b13c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -352,6 +352,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
                .getBoolean(R.bool.notification_scrim_transparent);
        updateScrims();
        mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);

        // prepare() sets proper initial values for most states
        for (ScrimState state : ScrimState.values()) {
            state.prepare(state);
        }
    }

    /**
@@ -641,10 +646,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
    private void setTransitionToFullShade(boolean transitioning) {
        if (transitioning != mTransitioningToFullShade) {
            mTransitioningToFullShade = transitioning;
            if (transitioning) {
                // Let's make sure the shade locked is ready
                ScrimState.SHADE_LOCKED.prepare(mState);
            }
        }
    }

+1 −7
Original line number Diff line number Diff line
@@ -146,18 +146,12 @@ public enum ScrimState {
            mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha;
            mNotifAlpha = 1f;
            mFrontAlpha = 0f;
            mBehindTint = Color.BLACK;
            mBehindTint = mClipQsScrim ? Color.TRANSPARENT : Color.BLACK;

            if (mClipQsScrim) {
                updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK);
            }
        }

        // to make sure correct color is returned before "prepare" is called
        @Override
        public int getBehindTint() {
            return Color.BLACK;
        }
    },

    /**
+15 −1
Original line number Diff line number Diff line
@@ -1442,16 +1442,30 @@ public class ScrimControllerTest extends SysuiTestCase {

    @Test
    public void testNotificationTransparency_followsTransitionToFullShade() {
        mScrimController.setClipsQsScrim(true);

        mScrimController.transitionTo(SHADE_LOCKED);
        mScrimController.setRawPanelExpansionFraction(1.0f);
        finishAnimationsImmediately();

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

        float shadeLockedAlpha = mNotificationsScrim.getViewAlpha();
        mScrimController.transitionTo(ScrimState.KEYGUARD);
        mScrimController.setRawPanelExpansionFraction(1.0f);
        finishAnimationsImmediately();
        float keyguardAlpha = mNotificationsScrim.getViewAlpha();

        mScrimController.setClipsQsScrim(true);
        assertScrimTinted(Map.of(
                mScrimInFront, true,
                mScrimBehind, true,
                mNotificationsScrim, true
        ));

        float progress = 0.5f;
        float lsNotifProgress = 0.3f;
        mScrimController.setTransitionToFullShadeProgress(progress, lsNotifProgress);