From a581b4b13cf107b722a187bb463415f0912d0d88 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 7 Mar 2022 15:08:06 +0800 Subject: [PATCH] Fix missing operation when hiding window for rotation Commit d8152bd changed to use a map of token operation to decide the animation appearance. But forgot to migrate the usage of hideImmediately, that only hides the surface without storing the information so when the window is drawn in new rotation (e.g. IME), the controller doesn't know the window should be shown again. Fix: 222424027 Test: atest DisplayContentTests#testApplyTopFixedRotationTransform Change-Id: I8f45bbd73ad06f9961aa55f3c05a571f77c5655b --- .../java/com/android/server/wm/AsyncRotationController.java | 4 ++++ .../src/com/android/server/wm/DisplayContentTests.java | 5 ++++- 2 files changed, 8 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 9e889ad11b8e5..220d9ec8febbf 100644 --- a/services/core/java/com/android/server/wm/AsyncRotationController.java +++ b/services/core/java/com/android/server/wm/AsyncRotationController.java @@ -329,8 +329,12 @@ class AsyncRotationController extends FadeAnimationController implements Consume void hideImmediately(WindowToken windowToken) { final boolean original = mHideImmediately; mHideImmediately = true; + final Operation op = new Operation(Operation.ACTION_FADE); + mTargetWindowTokens.put(windowToken, op); fadeWindowToken(false /* show */, windowToken, ANIMATION_TYPE_FIXED_TRANSFORM); + op.mLeash = windowToken.getAnimationLeash(); mHideImmediately = original; + if (DEBUG) Slog.d(TAG, "hideImmediately " + windowToken.getTopChild()); } /** Returns {@code true} if the window will rotate independently. */ diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 12f987dfcd8d6..3d95ec599b1b0 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -1370,7 +1370,9 @@ public class DisplayContentTests extends WindowTestsBase { ROTATION_0 /* oldRotation */, ROTATION_90 /* newRotation */, false /* forceUpdate */)); - assertNotNull(mDisplayContent.getAsyncRotationController()); + final AsyncRotationController asyncRotationController = + mDisplayContent.getAsyncRotationController(); + assertNotNull(asyncRotationController); assertTrue(mStatusBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM)); assertTrue(mNavBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM)); // Notification shade may have its own view animation in real case so do not fade out it. @@ -1443,6 +1445,7 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.setImeLayeringTarget(mAppWindow); LocalServices.getService(WindowManagerInternal.class).onToggleImeRequested(true /* show */, app.token, app.token, mDisplayContent.mDisplayId); + assertTrue(asyncRotationController.isTargetToken(mImeWindow.mToken)); assertTrue(mImeWindow.mToken.hasFixedRotationTransform()); assertTrue(mImeWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));