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

Commit 6805dbd1 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Ensure to reset seamless transform after transition"

parents 011451e5 fba32157
Loading
Loading
Loading
Loading
+11 −5
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
        if (op == null) return;
        if (op == null) return;
        if (op.mDrawTransaction != null) {
        if (op.mDrawTransaction != null) {
            // Unblock the window to show its latest content.
            // Unblock the window to show its latest content.
            mDisplayContent.getPendingTransaction().merge(op.mDrawTransaction);
            windowToken.getSyncTransaction().merge(op.mDrawTransaction);
            op.mDrawTransaction = null;
            op.mDrawTransaction = null;
            if (DEBUG) Slog.d(TAG, "finishOp merge transaction " + windowToken.getTopChild());
            if (DEBUG) Slog.d(TAG, "finishOp merge transaction " + windowToken.getTopChild());
        }
        }
@@ -235,7 +235,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
        } else if (op.mAction == Operation.ACTION_SEAMLESS && mRotator != null
        } else if (op.mAction == Operation.ACTION_SEAMLESS && mRotator != null
                && op.mLeash != null && op.mLeash.isValid()) {
                && op.mLeash != null && op.mLeash.isValid()) {
            if (DEBUG) Slog.d(TAG, "finishOp undo seamless " + windowToken.getTopChild());
            if (DEBUG) Slog.d(TAG, "finishOp undo seamless " + windowToken.getTopChild());
            mRotator.setIdentityMatrix(mDisplayContent.getPendingTransaction(), op.mLeash);
            mRotator.setIdentityMatrix(windowToken.getSyncTransaction(), op.mLeash);
        }
        }
    }
    }


@@ -322,7 +322,8 @@ class AsyncRotationController extends FadeAnimationController implements Consume
        if (mTimeoutRunnable == null) {
        if (mTimeoutRunnable == null) {
            mTimeoutRunnable = () -> {
            mTimeoutRunnable = () -> {
                synchronized (mService.mGlobalLock) {
                synchronized (mService.mGlobalLock) {
                    Slog.i(TAG, "Async rotation timeout: " + mTargetWindowTokens);
                    Slog.i(TAG, "Async rotation timeout: " + (!mIsStartTransactionCommitted
                            ? " start transaction is not committed" : mTargetWindowTokens));
                    mIsStartTransactionCommitted = true;
                    mIsStartTransactionCommitted = true;
                    mDisplayContent.finishAsyncRotationIfPossible();
                    mDisplayContent.finishAsyncRotationIfPossible();
                    mService.mWindowPlacerLocked.performSurfacePlacement();
                    mService.mWindowPlacerLocked.performSurfacePlacement();
@@ -484,12 +485,17 @@ class AsyncRotationController extends FadeAnimationController implements Consume
     * by this controller.
     * by this controller.
     */
     */
    boolean handleFinishDrawing(WindowState w, SurfaceControl.Transaction postDrawTransaction) {
    boolean handleFinishDrawing(WindowState w, SurfaceControl.Transaction postDrawTransaction) {
        if (mTransitionOp == OP_LEGACY || postDrawTransaction == null || !mIsSyncDrawRequested) {
        if (mTransitionOp == OP_LEGACY) {
            return false;
            return false;
        }
        }
        final Operation op = mTargetWindowTokens.get(w.mToken);
        final Operation op = mTargetWindowTokens.get(w.mToken);
        if (op == null || op.canDrawBeforeStartTransaction()) return false;
        if (op == null) return false;
        if (DEBUG) Slog.d(TAG, "handleFinishDrawing " + w);
        if (DEBUG) Slog.d(TAG, "handleFinishDrawing " + w);
        if (postDrawTransaction == null || !mIsSyncDrawRequested
                || op.canDrawBeforeStartTransaction()) {
            mDisplayContent.finishAsyncRotation(w.mToken);
            return false;
        }
        if (op.mDrawTransaction == null) {
        if (op.mDrawTransaction == null) {
            if (w.isClientLocal()) {
            if (w.isClientLocal()) {
                // Use a new transaction to merge the draw transaction of local window because the
                // Use a new transaction to merge the draw transaction of local window because the
+4 −8
Original line number Original line Diff line number Diff line
@@ -2137,6 +2137,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        if (!shellTransitions) {
        if (!shellTransitions) {
            forAllWindows(w -> {
            forAllWindows(w -> {
                w.seamlesslyRotateIfAllowed(transaction, oldRotation, rotation, rotateSeamlessly);
                w.seamlesslyRotateIfAllowed(transaction, oldRotation, rotation, rotateSeamlessly);
                if (!rotateSeamlessly && w.mHasSurface) {
                    ProtoLog.v(WM_DEBUG_ORIENTATION, "Set mOrientationChanging of %s", w);
                    w.setOrientationChanging(true);
                }
            }, true /* traverseTopToBottom */);
            }, true /* traverseTopToBottom */);
            mPinnedTaskController.startSeamlessRotationIfNeeded(transaction, oldRotation, rotation);
            mPinnedTaskController.startSeamlessRotationIfNeeded(transaction, oldRotation, rotation);
            if (!mDisplayRotation.hasSeamlessRotatingWindow()) {
            if (!mDisplayRotation.hasSeamlessRotatingWindow()) {
@@ -2148,14 +2152,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        mWmService.mDisplayManagerInternal.performTraversal(transaction);
        mWmService.mDisplayManagerInternal.performTraversal(transaction);
        scheduleAnimation();
        scheduleAnimation();


        forAllWindows(w -> {
            if (!w.mHasSurface) return;
            if (!rotateSeamlessly) {
                ProtoLog.v(WM_DEBUG_ORIENTATION, "Set mOrientationChanging of %s", w);
                w.setOrientationChanging(true);
            }
        }, true /* traverseTopToBottom */);

        for (int i = mWmService.mRotationWatchers.size() - 1; i >= 0; i--) {
        for (int i = mWmService.mRotationWatchers.size() - 1; i >= 0; i--) {
            final WindowManagerService.RotationWatcher rotationWatcher
            final WindowManagerService.RotationWatcher rotationWatcher
                    = mWmService.mRotationWatchers.get(i);
                    = mWmService.mRotationWatchers.get(i);
+4 −14
Original line number Original line Diff line number Diff line
@@ -867,9 +867,6 @@ public class TransitionTests extends WindowTestsBase {
        final AsyncRotationController asyncRotationController =
        final AsyncRotationController asyncRotationController =
                mDisplayContent.getAsyncRotationController();
                mDisplayContent.getAsyncRotationController();
        assertNotNull(asyncRotationController);
        assertNotNull(asyncRotationController);
        for (WindowState w : windows) {
            w.setOrientationChanging(true);
        }
        player.startTransition();
        player.startTransition();


        assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken));
        assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken));
@@ -879,15 +876,11 @@ public class TransitionTests extends WindowTestsBase {
        assertTrue(asyncRotationController.isTargetToken(decorToken));
        assertTrue(asyncRotationController.isTargetToken(decorToken));
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);


        if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) {
        // Only seamless window syncs its draw transaction with transition.
        // Only seamless window syncs its draw transaction with transition.
            assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT));
        assertTrue(asyncRotationController.handleFinishDrawing(screenDecor, mMockT));
        assertTrue(asyncRotationController.handleFinishDrawing(screenDecor, mMockT));
        }
        screenDecor.setOrientationChanging(false);
        // Status bar finishes drawing before the start transaction. Its fade-in animation will be
        // Status bar finishes drawing before the start transaction. Its fade-in animation will be
        // executed until the transaction is committed, so it is still in target tokens.
        // executed until the transaction is committed, so it is still in target tokens.
        statusBar.setOrientationChanging(false);
        assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT));
        assertTrue(asyncRotationController.isTargetToken(statusBar.mToken));
        assertTrue(asyncRotationController.isTargetToken(statusBar.mToken));


        final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class);
        final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class);
@@ -901,7 +894,7 @@ public class TransitionTests extends WindowTestsBase {


        // Navigation bar finishes drawing after the start transaction, so its fade-in animation
        // Navigation bar finishes drawing after the start transaction, so its fade-in animation
        // can execute directly.
        // can execute directly.
        navBar.setOrientationChanging(false);
        asyncRotationController.handleFinishDrawing(navBar, mMockT);
        assertFalse(asyncRotationController.isTargetToken(navBar.mToken));
        assertFalse(asyncRotationController.isTargetToken(navBar.mToken));
        assertNull(mDisplayContent.getAsyncRotationController());
        assertNull(mDisplayContent.getAsyncRotationController());
    }
    }
@@ -935,7 +928,6 @@ public class TransitionTests extends WindowTestsBase {
        assertNotNull(asyncRotationController);
        assertNotNull(asyncRotationController);
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);
        assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);


        statusBar.setOrientationChanging(true);
        player.startTransition();
        player.startTransition();
        // Non-app windows should not be collected.
        // Non-app windows should not be collected.
        assertFalse(statusBar.mToken.inTransition());
        assertFalse(statusBar.mToken.inTransition());
@@ -998,7 +990,6 @@ public class TransitionTests extends WindowTestsBase {
        mDisplayContent.mTransitionController.dispatchLegacyAppTransitionFinished(app);
        mDisplayContent.mTransitionController.dispatchLegacyAppTransitionFinished(app);
        assertTrue(mDisplayContent.hasTopFixedRotationLaunchingApp());
        assertTrue(mDisplayContent.hasTopFixedRotationLaunchingApp());


        statusBar.setOrientationChanging(true);
        player.startTransition();
        player.startTransition();
        // Non-app windows should not be collected.
        // Non-app windows should not be collected.
        assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken));
        assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken));
@@ -1010,7 +1001,6 @@ public class TransitionTests extends WindowTestsBase {


        // The controller should be cleared if the target windows are drawn.
        // The controller should be cleared if the target windows are drawn.
        statusBar.finishDrawing(mWm.mTransactionFactory.get(), Integer.MAX_VALUE);
        statusBar.finishDrawing(mWm.mTransactionFactory.get(), Integer.MAX_VALUE);
        statusBar.setOrientationChanging(false);
        assertNull(mDisplayContent.getAsyncRotationController());
        assertNull(mDisplayContent.getAsyncRotationController());
    }
    }