From 2503213450a11440aae81076eb6446844df75256 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 30 Jun 2022 17:00:32 +0800 Subject: [PATCH] Freeze insets position for shell transition rotation The insets-freeze should be enabled for all types of shell transition, e.g. change/open/close. Otherwise if the app changes insets flags and requests different orientation at the same time, the position of the insets provider (e.g. navigation bar) will show at a rotated position. Fixes: 237599512 Test: atest TransitionTests#testDisplayRotationChange Change-Id: I5723c8082f6c9d658f83c0e5064463870870283f --- .../java/com/android/server/wm/AsyncRotationController.java | 2 +- .../wmtests/src/com/android/server/wm/TransitionTests.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/AsyncRotationController.java b/services/core/java/com/android/server/wm/AsyncRotationController.java index e3de18b1ebc7a..2e1d3b1643ac6 100644 --- a/services/core/java/com/android/server/wm/AsyncRotationController.java +++ b/services/core/java/com/android/server/wm/AsyncRotationController.java @@ -357,7 +357,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume * or seamless transformation in a rotated display. */ boolean shouldFreezeInsetsPosition(WindowState w) { - return mTransitionOp == OP_APP_SWITCH && w.mTransitionController.inTransition() + return mTransitionOp != OP_LEGACY && w.mTransitionController.inTransition() && 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 ab72a0f726715..e1fbf96b2e710 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -683,6 +683,7 @@ public class TransitionTests extends WindowTestsBase { assertTrue(ime.mToken.inTransition()); assertTrue(task.inTransition()); assertTrue(asyncRotationController.isTargetToken(decorToken)); + assertTrue(asyncRotationController.shouldFreezeInsetsPosition(navBar)); screenDecor.setOrientationChanging(false); // Status bar finishes drawing before the start transaction. Its fade-in animation will be