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

Commit 93ceb998 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Keep insets leash position before display transaction applies

This is similar to keepAppearanceInPreviousRotation. Not only the
content drawn by the window, the insets leash position also needs
to keep the original rotation. Otherwise because the insets leash
is the parent of window, the window may be put at a rotated position
before the display projection applies the new rotation.

Fix: 293395004
Test: atest TransitionTests#testAppTransitionWithRotationChange
Test: Use gesture navigation to swipe from portrait home to an
      immersive landscape activity. The navigation bar is not
      flickering at the center of screen.
Change-Id: I1def139a19831c03879199e7f095750f0cc23cb3
parent ef4b10d1
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -455,13 +455,11 @@ class AsyncRotationController extends FadeAnimationController implements Consume
     * or seamless transformation in a rotated display.
     */
    boolean shouldFreezeInsetsPosition(WindowState w) {
        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);
        // Non-change transition (OP_APP_SWITCH) and METHOD_BLAST don't use screenshot so the
        // insets should keep original position before the start transaction is applied.
        return mTransitionOp != OP_LEGACY && (mTransitionOp == OP_APP_SWITCH
                || TransitionController.SYNC_METHOD == BLASTSyncEngine.METHOD_BLAST)
                && !mIsStartTransactionCommitted && isTargetToken(w.mToken);
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -1197,7 +1197,7 @@ public class TransitionTests extends WindowTestsBase {
        final AsyncRotationController asyncRotationController =
                mDisplayContent.getAsyncRotationController();
        assertNotNull(asyncRotationController);
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);
        assertTrue(asyncRotationController.shouldFreezeInsetsPosition(statusBar));
        assertTrue(app.getTask().inTransition());

        player.start();
@@ -1222,6 +1222,7 @@ public class TransitionTests extends WindowTestsBase {
        assertFalse(asyncRotationController.isTargetToken(navBar.mToken));
        navBar.finishDrawing(null /* postDrawTransaction */, Integer.MAX_VALUE);
        assertTrue(asyncRotationController.isTargetToken(navBar.mToken));
        assertTrue(asyncRotationController.shouldFreezeInsetsPosition(navBar));

        player.startTransition();
        // Non-app windows should not be collected.