Loading services/core/java/com/android/server/wm/AsyncRotationController.java +11 −5 Original line number Diff line number Diff line Loading @@ -223,7 +223,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume if (op == null) return; if (op.mDrawTransaction != null) { // Unblock the window to show its latest content. mDisplayContent.getPendingTransaction().merge(op.mDrawTransaction); windowToken.getSyncTransaction().merge(op.mDrawTransaction); op.mDrawTransaction = null; if (DEBUG) Slog.d(TAG, "finishOp merge transaction " + windowToken.getTopChild()); } Loading @@ -235,7 +235,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume } else if (op.mAction == Operation.ACTION_SEAMLESS && mRotator != null && op.mLeash != null && op.mLeash.isValid()) { if (DEBUG) Slog.d(TAG, "finishOp undo seamless " + windowToken.getTopChild()); mRotator.setIdentityMatrix(mDisplayContent.getPendingTransaction(), op.mLeash); mRotator.setIdentityMatrix(windowToken.getSyncTransaction(), op.mLeash); } } Loading Loading @@ -322,7 +322,8 @@ class AsyncRotationController extends FadeAnimationController implements Consume if (mTimeoutRunnable == null) { mTimeoutRunnable = () -> { 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; mDisplayContent.finishAsyncRotationIfPossible(); mService.mWindowPlacerLocked.performSurfacePlacement(); Loading Loading @@ -484,12 +485,17 @@ class AsyncRotationController extends FadeAnimationController implements Consume * by this controller. */ boolean handleFinishDrawing(WindowState w, SurfaceControl.Transaction postDrawTransaction) { if (mTransitionOp == OP_LEGACY || postDrawTransaction == null || !mIsSyncDrawRequested) { if (mTransitionOp == OP_LEGACY) { return false; } 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 (postDrawTransaction == null || !mIsSyncDrawRequested || op.canDrawBeforeStartTransaction()) { mDisplayContent.finishAsyncRotation(w.mToken); return false; } if (op.mDrawTransaction == null) { if (w.isClientLocal()) { // Use a new transaction to merge the draw transaction of local window because the Loading services/core/java/com/android/server/wm/DisplayContent.java +4 −8 Original line number Diff line number Diff line Loading @@ -2137,6 +2137,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (!shellTransitions) { forAllWindows(w -> { 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 */); mPinnedTaskController.startSeamlessRotationIfNeeded(transaction, oldRotation, rotation); if (!mDisplayRotation.hasSeamlessRotatingWindow()) { Loading @@ -2148,14 +2152,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mDisplayManagerInternal.performTraversal(transaction); 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--) { final WindowManagerService.RotationWatcher rotationWatcher = mWmService.mRotationWatchers.get(i); Loading services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +4 −14 Original line number Diff line number Diff line Loading @@ -867,9 +867,6 @@ public class TransitionTests extends WindowTestsBase { final AsyncRotationController asyncRotationController = mDisplayContent.getAsyncRotationController(); assertNotNull(asyncRotationController); for (WindowState w : windows) { w.setOrientationChanging(true); } player.startTransition(); assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken)); Loading @@ -879,15 +876,11 @@ public class TransitionTests extends WindowTestsBase { assertTrue(asyncRotationController.isTargetToken(decorToken)); assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true); if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) { // Only seamless window syncs its draw transaction with transition. assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT)); assertTrue(asyncRotationController.handleFinishDrawing(screenDecor, mMockT)); } screenDecor.setOrientationChanging(false); // 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. statusBar.setOrientationChanging(false); assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT)); assertTrue(asyncRotationController.isTargetToken(statusBar.mToken)); final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class); Loading @@ -901,7 +894,7 @@ public class TransitionTests extends WindowTestsBase { // Navigation bar finishes drawing after the start transaction, so its fade-in animation // can execute directly. navBar.setOrientationChanging(false); asyncRotationController.handleFinishDrawing(navBar, mMockT); assertFalse(asyncRotationController.isTargetToken(navBar.mToken)); assertNull(mDisplayContent.getAsyncRotationController()); } Loading Loading @@ -935,7 +928,6 @@ public class TransitionTests extends WindowTestsBase { assertNotNull(asyncRotationController); assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true); statusBar.setOrientationChanging(true); player.startTransition(); // Non-app windows should not be collected. assertFalse(statusBar.mToken.inTransition()); Loading Loading @@ -998,7 +990,6 @@ public class TransitionTests extends WindowTestsBase { mDisplayContent.mTransitionController.dispatchLegacyAppTransitionFinished(app); assertTrue(mDisplayContent.hasTopFixedRotationLaunchingApp()); statusBar.setOrientationChanging(true); player.startTransition(); // Non-app windows should not be collected. assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken)); Loading @@ -1010,7 +1001,6 @@ public class TransitionTests extends WindowTestsBase { // The controller should be cleared if the target windows are drawn. statusBar.finishDrawing(mWm.mTransactionFactory.get(), Integer.MAX_VALUE); statusBar.setOrientationChanging(false); assertNull(mDisplayContent.getAsyncRotationController()); } Loading Loading
services/core/java/com/android/server/wm/AsyncRotationController.java +11 −5 Original line number Diff line number Diff line Loading @@ -223,7 +223,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume if (op == null) return; if (op.mDrawTransaction != null) { // Unblock the window to show its latest content. mDisplayContent.getPendingTransaction().merge(op.mDrawTransaction); windowToken.getSyncTransaction().merge(op.mDrawTransaction); op.mDrawTransaction = null; if (DEBUG) Slog.d(TAG, "finishOp merge transaction " + windowToken.getTopChild()); } Loading @@ -235,7 +235,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume } else if (op.mAction == Operation.ACTION_SEAMLESS && mRotator != null && op.mLeash != null && op.mLeash.isValid()) { if (DEBUG) Slog.d(TAG, "finishOp undo seamless " + windowToken.getTopChild()); mRotator.setIdentityMatrix(mDisplayContent.getPendingTransaction(), op.mLeash); mRotator.setIdentityMatrix(windowToken.getSyncTransaction(), op.mLeash); } } Loading Loading @@ -322,7 +322,8 @@ class AsyncRotationController extends FadeAnimationController implements Consume if (mTimeoutRunnable == null) { mTimeoutRunnable = () -> { 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; mDisplayContent.finishAsyncRotationIfPossible(); mService.mWindowPlacerLocked.performSurfacePlacement(); Loading Loading @@ -484,12 +485,17 @@ class AsyncRotationController extends FadeAnimationController implements Consume * by this controller. */ boolean handleFinishDrawing(WindowState w, SurfaceControl.Transaction postDrawTransaction) { if (mTransitionOp == OP_LEGACY || postDrawTransaction == null || !mIsSyncDrawRequested) { if (mTransitionOp == OP_LEGACY) { return false; } 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 (postDrawTransaction == null || !mIsSyncDrawRequested || op.canDrawBeforeStartTransaction()) { mDisplayContent.finishAsyncRotation(w.mToken); return false; } if (op.mDrawTransaction == null) { if (w.isClientLocal()) { // Use a new transaction to merge the draw transaction of local window because the Loading
services/core/java/com/android/server/wm/DisplayContent.java +4 −8 Original line number Diff line number Diff line Loading @@ -2137,6 +2137,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (!shellTransitions) { forAllWindows(w -> { 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 */); mPinnedTaskController.startSeamlessRotationIfNeeded(transaction, oldRotation, rotation); if (!mDisplayRotation.hasSeamlessRotatingWindow()) { Loading @@ -2148,14 +2152,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mDisplayManagerInternal.performTraversal(transaction); 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--) { final WindowManagerService.RotationWatcher rotationWatcher = mWmService.mRotationWatchers.get(i); Loading
services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +4 −14 Original line number Diff line number Diff line Loading @@ -867,9 +867,6 @@ public class TransitionTests extends WindowTestsBase { final AsyncRotationController asyncRotationController = mDisplayContent.getAsyncRotationController(); assertNotNull(asyncRotationController); for (WindowState w : windows) { w.setOrientationChanging(true); } player.startTransition(); assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken)); Loading @@ -879,15 +876,11 @@ public class TransitionTests extends WindowTestsBase { assertTrue(asyncRotationController.isTargetToken(decorToken)); assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true); if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) { // Only seamless window syncs its draw transaction with transition. assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT)); assertTrue(asyncRotationController.handleFinishDrawing(screenDecor, mMockT)); } screenDecor.setOrientationChanging(false); // 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. statusBar.setOrientationChanging(false); assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT)); assertTrue(asyncRotationController.isTargetToken(statusBar.mToken)); final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class); Loading @@ -901,7 +894,7 @@ public class TransitionTests extends WindowTestsBase { // Navigation bar finishes drawing after the start transaction, so its fade-in animation // can execute directly. navBar.setOrientationChanging(false); asyncRotationController.handleFinishDrawing(navBar, mMockT); assertFalse(asyncRotationController.isTargetToken(navBar.mToken)); assertNull(mDisplayContent.getAsyncRotationController()); } Loading Loading @@ -935,7 +928,6 @@ public class TransitionTests extends WindowTestsBase { assertNotNull(asyncRotationController); assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true); statusBar.setOrientationChanging(true); player.startTransition(); // Non-app windows should not be collected. assertFalse(statusBar.mToken.inTransition()); Loading Loading @@ -998,7 +990,6 @@ public class TransitionTests extends WindowTestsBase { mDisplayContent.mTransitionController.dispatchLegacyAppTransitionFinished(app); assertTrue(mDisplayContent.hasTopFixedRotationLaunchingApp()); statusBar.setOrientationChanging(true); player.startTransition(); // Non-app windows should not be collected. assertFalse(mDisplayContent.mTransitionController.isCollecting(statusBar.mToken)); Loading @@ -1010,7 +1001,6 @@ public class TransitionTests extends WindowTestsBase { // The controller should be cleared if the target windows are drawn. statusBar.finishDrawing(mWm.mTransactionFactory.get(), Integer.MAX_VALUE); statusBar.setOrientationChanging(false); assertNull(mDisplayContent.getAsyncRotationController()); } Loading