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

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

Pause insets position for seamless rotation

The enhances the concept [1] to sync insets leash position.
Because after [2], the position will be applied with insets
control change.

[1]: I51ebd9f2c90b2b4d12f77d1361acc66ab7777b38
[2]: I5ba0c33ca4542d27bb4dee4ce849f34721f20b14

This also merges I2a886a6a04891a7bf09c1152e52a431326a80d03.

Bug: 337018949
Test: Enable auto rotation. Rotate camera app. The navigation
      bar can won't show on screen center.
Merged-In: Ibb25dc5735674e6618b5c639c4e2e61ffa678f52
Change-Id: Ibb25dc5735674e6618b5c639c4e2e61ffa678f52
parent 64d7a085
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
        }
        // The insets position may be frozen by shouldFreezeInsetsPosition(), so refresh the
        // position to the latest state when it is ready to show in new rotation.
        if (mTransitionOp == OP_APP_SWITCH) {
        if (isSeamlessTransition()) {
            for (int i = windowToken.getChildCount() - 1; i >= 0; i--) {
                final WindowState w = windowToken.getChildAt(i);
                final InsetsSourceProvider insetsProvider = w.getControllableInsetProvider();
@@ -505,10 +505,15 @@ class AsyncRotationController extends FadeAnimationController implements Consume
     */
    boolean shouldFreezeInsetsPosition(WindowState w) {
        // 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
        // insets should keep original position before the window is done with new rotation.
        return mTransitionOp != OP_LEGACY && (isSeamlessTransition()
                || TransitionController.SYNC_METHOD == BLASTSyncEngine.METHOD_BLAST)
                && !mIsStartTransactionCommitted && canBeAsync(w.mToken) && isTargetToken(w.mToken);
                && canBeAsync(w.mToken) && isTargetToken(w.mToken);
    }

    /** Returns true if there won't be a screen rotation animation (screenshot-based). */
    private boolean isSeamlessTransition() {
        return mTransitionOp == OP_APP_SWITCH || mTransitionOp == OP_CHANGE_MAY_SEAMLESS;
    }

    /**