diff options
| author | 2023-07-25 10:36:48 +0000 | |
|---|---|---|
| committer | 2023-07-25 10:36:48 +0000 | |
| commit | d55c003a4760606e75322a611e5246472f9fda3a (patch) | |
| tree | c22fa79f64f733eb53da42ea2852ccf559faa03a | |
| parent | f8175e026f5fc60eef27a369e3bbe15707429644 (diff) | |
| parent | 4b8e8ea3a592f7f66a38e8f7fa885958700187db (diff) | |
Merge "Do not skip finishing async rotation by a non-rotation transition" into udc-qpr-dev am: 4b8e8ea3a5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24150832
Change-Id: If2a41693e640789fe6bc68eba08919502c7588b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
3 files changed, 33 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 53429448b4ca..e292ce0f5508 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1935,7 +1935,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } else if (mFixedRotationLaunchingApp != null && r == null) { mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); // Keep async rotation controller if the next transition of display is requested. - if (!mTransitionController.isCollecting(this)) { + if (!mTransitionController.hasCollectingRotationChange(this, getRotation())) { finishAsyncRotationIfPossible(); } } diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index 37985ea0aa6a..1565341deb4c 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -578,6 +578,17 @@ class TransitionController { } /** + * Returns {@code true} if the window container is in the collecting transition, and its + * collected rotation is different from the target rotation. + */ + boolean hasCollectingRotationChange(@NonNull WindowContainer<?> wc, int targetRotation) { + final Transition transition = mCollectingTransition; + if (transition == null || !transition.mParticipants.contains(wc)) return false; + final Transition.ChangeInfo changeInfo = transition.mChanges.get(wc); + return changeInfo != null && changeInfo.mRotation != targetRotation; + } + + /** * @see #requestTransitionIfNeeded(int, int, WindowContainer, WindowContainer, RemoteTransition) */ @Nullable 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 e91fdde955ef..ca5d8fe33dba 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -1240,6 +1240,27 @@ public class TransitionTests extends WindowTestsBase { } @Test + public void testFinishRotationControllerWithFixedRotation() { + final ActivityRecord app = new ActivityBuilder(mAtm).setCreateTask(true).build(); + mDisplayContent.setFixedRotationLaunchingAppUnchecked(app); + registerTestTransitionPlayer(); + mDisplayContent.setLastHasContent(); + mDisplayContent.requestChangeTransitionIfNeeded(1 /* changes */, null /* displayChange */); + assertNotNull(mDisplayContent.getAsyncRotationController()); + mDisplayContent.setFixedRotationLaunchingAppUnchecked(null); + assertNull("Clear rotation controller if rotation is not changed", + mDisplayContent.getAsyncRotationController()); + + mDisplayContent.setFixedRotationLaunchingAppUnchecked(app); + assertNotNull(mDisplayContent.getAsyncRotationController()); + mDisplayContent.getDisplayRotation().setRotation( + mDisplayContent.getWindowConfiguration().getRotation() + 1); + mDisplayContent.setFixedRotationLaunchingAppUnchecked(null); + assertNotNull("Keep rotation controller if rotation will be changed", + mDisplayContent.getAsyncRotationController()); + } + + @Test public void testDeferRotationForTransientLaunch() { final TestTransitionPlayer player = registerTestTransitionPlayer(); assumeFalse(mDisplayContent.mTransitionController.useShellTransitionsRotation()); |