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

Commit 75a0d5ab authored by Chandru S's avatar Chandru S
Browse files

Remove unusued AUTH_SCRIM states

These were migrated to a separate view as part of the deviceEntryUdfpsRefactor. There is nothing in sysui that initiates a scrim transition to these two states

Bug: 381263600
Flag: EXEMPT cleanup
Test: NA code deletion
Change-Id: I58c7c7f071b7b34b11369c09f36afd9178f7c28e
parent 7c308acf
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -979,8 +979,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
                        mBehindTint,
                        interpolatedFraction);
            }
        } else if (mState == ScrimState.AUTH_SCRIMMED_SHADE) {
            mNotificationsAlpha = (float) Math.pow(getInterpolatedFraction(), 0.8f);
        } else if (mState == ScrimState.KEYGUARD || mState == ScrimState.SHADE_LOCKED
                || mState == ScrimState.PULSING || mState == ScrimState.GLANCEABLE_HUB) {
            Pair<Integer, Float> result = calculateBackStateForState(mState);
+0 −28
Original line number Diff line number Diff line
@@ -99,34 +99,6 @@ public enum ScrimState {
        }
    },

    AUTH_SCRIMMED_SHADE {
        @Override
        public void prepare(ScrimState previousState) {
            // notif scrim alpha values are determined by ScrimController#applyState
            // based on the shade expansion

            mFrontTint = mBackgroundColor;
            mFrontAlpha = .66f;

            mBehindTint = mBackgroundColor;
            mBehindAlpha = 1f;
        }
    },

    AUTH_SCRIMMED {
        @Override
        public void prepare(ScrimState previousState) {
            mNotifTint = previousState.mNotifTint;
            mNotifAlpha = previousState.mNotifAlpha;

            mBehindTint = previousState.mBehindTint;
            mBehindAlpha = previousState.mBehindAlpha;

            mFrontTint = mBackgroundColor;
            mFrontAlpha = .66f;
        }
    },

    /**
     * Showing password challenge on the keyguard.
     */
+1 −76
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
@@ -1425,8 +1424,7 @@ public class ScrimControllerTest extends SysuiTestCase {
        HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
                ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, BOUNCER,
                ScrimState.DREAMING, ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR,
                ScrimState.UNLOCKED, SHADE_LOCKED, ScrimState.AUTH_SCRIMMED,
                ScrimState.AUTH_SCRIMMED_SHADE, ScrimState.GLANCEABLE_HUB,
                ScrimState.UNLOCKED, SHADE_LOCKED, ScrimState.GLANCEABLE_HUB,
                ScrimState.GLANCEABLE_HUB_OVER_DREAM));

        for (ScrimState state : ScrimState.values()) {
@@ -1450,79 +1448,6 @@ public class ScrimControllerTest extends SysuiTestCase {
                mNotificationsScrim.getViewAlpha(), 1, 0.0);
    }

    @Test
    public void testAuthScrim_setClipQSScrimTrue_notifScrimOpaque_whenShadeFullyExpanded() {
        // GIVEN device has an activity showing ('UNLOCKED' state can occur on the lock screen
        // with the camera app occluding the keyguard)
        mScrimController.legacyTransitionTo(ScrimState.UNLOCKED);
        mScrimController.setClipsQsScrim(true);
        mScrimController.setRawPanelExpansionFraction(1);
        // notifications scrim alpha change require calling setQsPosition
        mScrimController.setQsPosition(0, 300);
        finishAnimationsImmediately();

        // WHEN the user triggers the auth bouncer
        mScrimController.legacyTransitionTo(ScrimState.AUTH_SCRIMMED_SHADE);
        finishAnimationsImmediately();

        assertEquals("Behind scrim should be opaque",
                mScrimBehind.getViewAlpha(), 1, 0.0);
        assertEquals("Notifications scrim should be opaque",
                mNotificationsScrim.getViewAlpha(), 1, 0.0);

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


    @Test
    public void testAuthScrim_setClipQSScrimFalse_notifScrimOpaque_whenShadeFullyExpanded() {
        // GIVEN device has an activity showing ('UNLOCKED' state can occur on the lock screen
        // with the camera app occluding the keyguard)
        mScrimController.legacyTransitionTo(ScrimState.UNLOCKED);
        mScrimController.setClipsQsScrim(false);
        mScrimController.setRawPanelExpansionFraction(1);
        // notifications scrim alpha change require calling setQsPosition
        mScrimController.setQsPosition(0, 300);
        finishAnimationsImmediately();

        // WHEN the user triggers the auth bouncer
        mScrimController.legacyTransitionTo(ScrimState.AUTH_SCRIMMED_SHADE);
        finishAnimationsImmediately();

        assertEquals("Behind scrim should be opaque",
                mScrimBehind.getViewAlpha(), 1, 0.0);
        assertEquals("Notifications scrim should be opaque",
                mNotificationsScrim.getViewAlpha(), 1, 0.0);

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

    @Test
    public void testAuthScrimKeyguard() {
        // GIVEN device is on the keyguard
        mScrimController.legacyTransitionTo(ScrimState.KEYGUARD);
        finishAnimationsImmediately();

        // WHEN the user triggers the auth bouncer
        mScrimController.legacyTransitionTo(ScrimState.AUTH_SCRIMMED);
        finishAnimationsImmediately();

        // THEN the front scrim is updated and the KEYGUARD scrims are the same as the
        // KEYGUARD scrim state
        assertScrimAlpha(Map.of(
                mScrimInFront, SEMI_TRANSPARENT,
                mScrimBehind, SEMI_TRANSPARENT,
                mNotificationsScrim, TRANSPARENT));
    }

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