Loading services/core/java/com/android/server/wm/AsyncRotationController.java +6 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,12 @@ class AsyncRotationController extends FadeAnimationController implements Consume return op != null && op.mAction == Operation.ACTION_FADE; } /** Returns {@code true} if the window is un-rotated to original rotation. */ boolean hasSeamlessOperation(WindowToken token) { final Operation op = mTargetWindowTokens.get(token); return op != null && op.mAction == Operation.ACTION_SEAMLESS; } /** * Whether the insets animation leash should use previous position when running fade animation * or seamless transformation in a rotated display. Loading services/core/java/com/android/server/wm/WindowState.java +11 −4 Original line number Diff line number Diff line Loading @@ -5258,10 +5258,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mSurfacePosition.offset(mXOffset, mYOffset); } // Freeze position while we're unrotated, so the surface remains at the position it was // prior to the rotation. if (!mSurfaceAnimator.hasLeash() && mPendingSeamlessRotate == null && !mLastSurfacePosition.equals(mSurfacePosition)) { final AsyncRotationController asyncRotationController = mDisplayContent.getAsyncRotationController(); if ((asyncRotationController != null && asyncRotationController.hasSeamlessOperation(mToken)) || mPendingSeamlessRotate != null) { // Freeze position while un-rotating the window, so its surface remains at the position // corresponding to the original rotation. return; } if (!mSurfaceAnimator.hasLeash() && !mLastSurfacePosition.equals(mSurfacePosition)) { final boolean frameSizeChanged = mWindowFrames.isFrameSizeChangeReported(); final boolean surfaceInsetsChanged = surfaceInsetsChanging(); final boolean surfaceSizeChanged = frameSizeChanged || surfaceInsetsChanged; Loading services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +6 −0 Original line number Diff line number Diff line Loading @@ -1115,6 +1115,12 @@ public class TransitionTests extends WindowTestsBase { assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT)); assertTrue(asyncRotationController.isTargetToken(statusBar.mToken)); // Window surface position is frozen while seamless rotation state is active. final Point prevPos = new Point(screenDecor.mLastSurfacePosition); screenDecor.getFrame().left += 1; screenDecor.updateSurfacePosition(mMockT); assertEquals(prevPos, screenDecor.mLastSurfacePosition); final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class); final SurfaceControl.TransactionCommittedListener transactionCommittedListener = onRotationTransactionReady(player, startTransaction); Loading Loading
services/core/java/com/android/server/wm/AsyncRotationController.java +6 −0 Original line number Diff line number Diff line Loading @@ -465,6 +465,12 @@ class AsyncRotationController extends FadeAnimationController implements Consume return op != null && op.mAction == Operation.ACTION_FADE; } /** Returns {@code true} if the window is un-rotated to original rotation. */ boolean hasSeamlessOperation(WindowToken token) { final Operation op = mTargetWindowTokens.get(token); return op != null && op.mAction == Operation.ACTION_SEAMLESS; } /** * Whether the insets animation leash should use previous position when running fade animation * or seamless transformation in a rotated display. Loading
services/core/java/com/android/server/wm/WindowState.java +11 −4 Original line number Diff line number Diff line Loading @@ -5258,10 +5258,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mSurfacePosition.offset(mXOffset, mYOffset); } // Freeze position while we're unrotated, so the surface remains at the position it was // prior to the rotation. if (!mSurfaceAnimator.hasLeash() && mPendingSeamlessRotate == null && !mLastSurfacePosition.equals(mSurfacePosition)) { final AsyncRotationController asyncRotationController = mDisplayContent.getAsyncRotationController(); if ((asyncRotationController != null && asyncRotationController.hasSeamlessOperation(mToken)) || mPendingSeamlessRotate != null) { // Freeze position while un-rotating the window, so its surface remains at the position // corresponding to the original rotation. return; } if (!mSurfaceAnimator.hasLeash() && !mLastSurfacePosition.equals(mSurfacePosition)) { final boolean frameSizeChanged = mWindowFrames.isFrameSizeChangeReported(); final boolean surfaceInsetsChanged = surfaceInsetsChanging(); final boolean surfaceSizeChanged = frameSizeChanged || surfaceInsetsChanged; Loading
services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +6 −0 Original line number Diff line number Diff line Loading @@ -1115,6 +1115,12 @@ public class TransitionTests extends WindowTestsBase { assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT)); assertTrue(asyncRotationController.isTargetToken(statusBar.mToken)); // Window surface position is frozen while seamless rotation state is active. final Point prevPos = new Point(screenDecor.mLastSurfacePosition); screenDecor.getFrame().left += 1; screenDecor.updateSurfacePosition(mMockT); assertEquals(prevPos, screenDecor.mLastSurfacePosition); final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class); final SurfaceControl.TransactionCommittedListener transactionCommittedListener = onRotationTransactionReady(player, startTransaction); Loading