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

Commit a7b45cb8 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Disable freeze insets for non blast sync shell transition

The method shouldFreezeInsetsPosition was added for when display
rotation happens, if the rotated insets position is sent to client
before the rotation animation starts, the system bars will jump to
weird position temporally because the client side insets animation
runner is not a part of sync system.

But during freezing, it still has a race that after the start
transaction of transition is applied (no longer freeze), the new
position doesn't apply synchronously. Then the bars may flicker
after rotation animation starts.

Since the sync method of shell transition is going to switch to
non-blast version, just disable it and rely on the screenshot to
cover any temporary states.

Bug: 234585256
Test: atest TransitionTests#testDisplayRotationChange
Change-Id: I7499db22b1008820f7dcc62ce714eeb27f0fd674
parent 9fefe95b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -357,7 +357,12 @@ class AsyncRotationController extends FadeAnimationController implements Consume
     * or seamless transformation in a rotated display.
     */
    boolean shouldFreezeInsetsPosition(WindowState w) {
        return mTransitionOp != OP_LEGACY && w.mTransitionController.inTransition()
        if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) {
            // Expect a screenshot layer has covered the screen, so it is fine to let client side
            // insets animation runner update the position directly.
            return false;
        }
        return mTransitionOp != OP_LEGACY && !mIsStartTransactionCommitted
                && isTargetToken(w.mToken);
    }

+13 −3
Original line number Diff line number Diff line
@@ -727,7 +727,7 @@ public class TransitionTests extends WindowTestsBase {
        assertTrue(ime.mToken.inTransition());
        assertTrue(task.inTransition());
        assertTrue(asyncRotationController.isTargetToken(decorToken));
        assertTrue(asyncRotationController.shouldFreezeInsetsPosition(navBar));
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);

        screenDecor.setOrientationChanging(false);
        // Status bar finishes drawing before the start transaction. Its fade-in animation will be
@@ -742,6 +742,7 @@ public class TransitionTests extends WindowTestsBase {
        // The transaction is committed, so fade-in animation for status bar is consumed.
        transactionCommittedListener.onTransactionCommitted();
        assertFalse(asyncRotationController.isTargetToken(statusBar.mToken));
        assertShouldFreezeInsetsPosition(asyncRotationController, navBar, false);

        // Navigation bar finishes drawing after the start transaction, so its fade-in animation
        // can execute directly.
@@ -777,7 +778,7 @@ public class TransitionTests extends WindowTestsBase {
        final AsyncRotationController asyncRotationController =
                mDisplayContent.getAsyncRotationController();
        assertNotNull(asyncRotationController);
        assertTrue(asyncRotationController.shouldFreezeInsetsPosition(statusBar));
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);

        statusBar.setOrientationChanging(true);
        player.startTransition();
@@ -823,7 +824,7 @@ public class TransitionTests extends WindowTestsBase {
        final AsyncRotationController asyncRotationController =
                mDisplayContent.getAsyncRotationController();
        assertNotNull(asyncRotationController);
        assertTrue(asyncRotationController.shouldFreezeInsetsPosition(statusBar));
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);
        assertTrue(app.getTask().inTransition());

        player.start();
@@ -858,6 +859,15 @@ public class TransitionTests extends WindowTestsBase {
        assertNull(mDisplayContent.getAsyncRotationController());
    }

    private static void assertShouldFreezeInsetsPosition(AsyncRotationController controller,
            WindowState w, boolean freeze) {
        if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) {
            // Non blast sync should never freeze insets position.
            freeze = false;
        }
        assertEquals(freeze, controller.shouldFreezeInsetsPosition(w));
    }

    @Test
    public void testDeferRotationForTransientLaunch() {
        final TestTransitionPlayer player = registerTestTransitionPlayer();