diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/AsyncRotationController.java | 14 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TransitionTests.java | 5 |
2 files changed, 16 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/AsyncRotationController.java b/services/core/java/com/android/server/wm/AsyncRotationController.java index 8c5f05365837..7d9ae87517b0 100644 --- a/services/core/java/com/android/server/wm/AsyncRotationController.java +++ b/services/core/java/com/android/server/wm/AsyncRotationController.java @@ -202,8 +202,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume // target windows. But the windows still need to use sync transaction to keep the appearance // in previous rotation, so request a no-op sync to keep the state. for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) { - if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST - && mTargetWindowTokens.valueAt(i).mAction != Operation.ACTION_SEAMLESS) { + if (mTargetWindowTokens.valueAt(i).canDrawBeforeStartTransaction()) { // Expect a screenshot layer will cover the non seamless windows. continue; } @@ -489,7 +488,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume return false; } final Operation op = mTargetWindowTokens.get(w.mToken); - if (op == null) return false; + if (op == null || op.canDrawBeforeStartTransaction()) return false; if (DEBUG) Slog.d(TAG, "handleFinishDrawing " + w); if (op.mDrawTransaction == null) { if (w.isClientLocal()) { @@ -554,5 +553,14 @@ class AsyncRotationController extends FadeAnimationController implements Consume Operation(@Action int action) { mAction = action; } + + /** + * Returns {@code true} if the corresponding window can draw its latest content before the + * start transaction of rotation transition is applied. + */ + boolean canDrawBeforeStartTransaction() { + return TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST + && mAction != ACTION_SEAMLESS; + } } } diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java index 45d8e226c64f..4435d62d7e60 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -732,6 +732,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. |