summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2023-08-22 14:43:44 +0000
committer Riddle Hsu <riddlehsu@google.com> 2023-08-22 15:00:05 +0000
commit93ceb9983199014c86ce38c5afcc04727d6828d1 (patch)
tree85b8f8acac6ada22ccbefd17d480fa53b97ef934
parentef4b10d1c72e8a22e70fb38c8b9211e3c55aba0f (diff)
Keep insets leash position before display transaction applies
This is similar to keepAppearanceInPreviousRotation. Not only the content drawn by the window, the insets leash position also needs to keep the original rotation. Otherwise because the insets leash is the parent of window, the window may be put at a rotated position before the display projection applies the new rotation. Fix: 293395004 Test: atest TransitionTests#testAppTransitionWithRotationChange Test: Use gesture navigation to swipe from portrait home to an immersive landscape activity. The navigation bar is not flickering at the center of screen. Change-Id: I1def139a19831c03879199e7f095750f0cc23cb3
-rw-r--r--services/core/java/com/android/server/wm/AsyncRotationController.java12
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TransitionTests.java3
2 files changed, 7 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/AsyncRotationController.java b/services/core/java/com/android/server/wm/AsyncRotationController.java
index 025047588ea5..0a2bbd467ab3 100644
--- a/services/core/java/com/android/server/wm/AsyncRotationController.java
+++ b/services/core/java/com/android/server/wm/AsyncRotationController.java
@@ -455,13 +455,11 @@ class AsyncRotationController extends FadeAnimationController implements Consume
* or seamless transformation in a rotated display.
*/
boolean shouldFreezeInsetsPosition(WindowState w) {
- if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) {
- // Expect a screenshot layer has covered the screen, so it is fine to let client side
- // insets animation runner update the position directly.
- return false;
- }
- return mTransitionOp != OP_LEGACY && !mIsStartTransactionCommitted
- && isTargetToken(w.mToken);
+ // 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
+ || TransitionController.SYNC_METHOD == BLASTSyncEngine.METHOD_BLAST)
+ && !mIsStartTransactionCommitted && isTargetToken(w.mToken);
}
/**
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 7544fdaa1fb6..be4ef6fd05cb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java
@@ -1197,7 +1197,7 @@ public class TransitionTests extends WindowTestsBase {
final AsyncRotationController asyncRotationController =
mDisplayContent.getAsyncRotationController();
assertNotNull(asyncRotationController);
- assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);
+ assertTrue(asyncRotationController.shouldFreezeInsetsPosition(statusBar));
assertTrue(app.getTask().inTransition());
player.start();
@@ -1222,6 +1222,7 @@ public class TransitionTests extends WindowTestsBase {
assertFalse(asyncRotationController.isTargetToken(navBar.mToken));
navBar.finishDrawing(null /* postDrawTransaction */, Integer.MAX_VALUE);
assertTrue(asyncRotationController.isTargetToken(navBar.mToken));
+ assertTrue(asyncRotationController.shouldFreezeInsetsPosition(navBar));
player.startTransition();
// Non-app windows should not be collected.