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

Commit 029b92b8 authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Fixing new shell keyguard inconsistency

The change fixed the following two issues:
1. Keyguard going away should matches the keyguard shown logic - no new
   transition should be created by the server if the new keyguard
   transition is enabled;
2. Updating the corresponding test to match the updated logic.

Test: DisplayContentTests
Bug: 364930619
Flag: com.android.window.flags.ensure_keyguard_does_transition_starting
Change-Id: Ifee7d3d229106e14b2a5b23c8da1803eb9821022
parent 56b7341b
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -310,12 +310,19 @@ class KeyguardController {
        try {
            state.writeEventLog("keyguardGoingAway");
            final int transitFlags = convertTransitFlags(flags);
            if (ENABLE_NEW_KEYGUARD_SHELL_TRANSITIONS) {
                final Transition transition = chain.getTransition();
                if (transition != null && displayId == DEFAULT_DISPLAY) {
                    transition.addFlag(TRANSIT_FLAG_KEYGUARD_GOING_AWAY);
                }
            } else {
                final DisplayContent dc = mRootWindowContainer.getDefaultDisplay();
                // We are deprecating TRANSIT_KEYGUARD_GOING_AWAY for Shell transition and use
            // TRANSIT_FLAG_KEYGUARD_GOING_AWAY to indicate that it should animate keyguard going
            // away.
                // TRANSIT_FLAG_KEYGUARD_GOING_AWAY to indicate that it should animate keyguard
                // going away.
                dc.mAtmService.getTransitionController().requestTransitionIfNeeded(
                        TRANSIT_TO_BACK, transitFlags, null /* trigger */, dc, chain);
            }
            updateKeyguardSleepToken();

            // Some stack visibility might change (e.g. docked stack)
+20 −7
Original line number Diff line number Diff line
@@ -2543,10 +2543,15 @@ public class DisplayContentTests extends WindowTestsBase {
        assertTrue(keyguardShowing.getAsBoolean());
        assertFalse(keyguardGoingAway.getAsBoolean());
        assertFalse(appVisible.getAsBoolean());
        if (Flags.ensureKeyguardDoesTransitionStarting()) {
            assertThat(transitions.mLastTransit).isNull();
        } else {
            if (Flags.aodTransition()) {
                assertThat(transitions.mLastTransit).flags().contains(TRANSIT_FLAG_AOD_APPEARING);
            } else {
            assertThat(transitions.mLastTransit).flags().doesNotContain(TRANSIT_FLAG_AOD_APPEARING);
                assertThat(transitions.mLastTransit).flags().doesNotContain(
                        TRANSIT_FLAG_AOD_APPEARING);
            }
        }
        transitions.flush();

@@ -2556,7 +2561,10 @@ public class DisplayContentTests extends WindowTestsBase {
        assertTrue(appVisible.getAsBoolean());

        if (Flags.ensureKeyguardDoesTransitionStarting()) {
            assertThat(transitions.mLastTransit).isNull();
            // Transition will be created due to sleep token updates. But no keyguard transition
            // should be there when the transition is not initiated from the system UI.
            assertThat(transitions.mLastTransit).flags()
                    .doesNotContain(TRANSIT_FLAG_KEYGUARD_GOING_AWAY);
        } else {
            assertThat(transitions.mLastTransit).flags()
                    .containsExactly(TRANSIT_FLAG_KEYGUARD_GOING_AWAY);
@@ -2598,10 +2606,15 @@ public class DisplayContentTests extends WindowTestsBase {
        keyguard.setKeyguardShown(displayId, true /* keyguard */, true /* aod */);
        assertFalse(keyguardGoingAway.getAsBoolean());
        assertFalse(appVisible.getAsBoolean());
        if (!Flags.ensureKeyguardDoesTransitionStarting()) {
            if (Flags.aodTransition()) {
                assertThat(transitions.mLastTransit).flags().contains(TRANSIT_FLAG_AOD_APPEARING);
            } else {
            assertThat(transitions.mLastTransit).flags().doesNotContain(TRANSIT_FLAG_AOD_APPEARING);
                assertThat(transitions.mLastTransit).flags().doesNotContain(
                        TRANSIT_FLAG_AOD_APPEARING);
            }
        } else {
            assertThat(transitions.mLastTransit).isNull();
        }
        transitions.flush();