From 88f306e2ba5c2a85dfeab16ca63197657a73c436 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 13 Jul 2021 02:35:07 +0800 Subject: [PATCH] Skip marking recents as pending top if it is already on top Otherwise when cleaning up recents animation without further transition, the fixed rotation state is not cleared. Since live tile is enabled, when using home key (button navigation mode) to leave overview, the recents animation will be finished after starting home, so home is already on top. Then the method notifyRecentsWillBeTop that used for deferring clear fixed rotation until next transition should not be called. Fixes: 193032496 Test: RecentsAnimationControllerTest Change-Id: Icbe27f6b3d84c948a75d6dabebab1f6b469bbc4d --- .../com/android/server/wm/RecentsAnimationController.java | 3 ++- .../android/server/wm/RecentsAnimationControllerTest.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 710dd552f72d2..58db7c4168751 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -949,7 +949,8 @@ public class RecentsAnimationController implements DeathRecipient { "cleanupAnimation(): Notify animation finished mPendingAnimations=%d " + "reorderMode=%d", mPendingAnimations.size(), reorderMode); - if (reorderMode != REORDER_MOVE_TO_ORIGINAL_POSITION) { + if (reorderMode != REORDER_MOVE_TO_ORIGINAL_POSITION + && mTargetActivityRecord != mDisplayContent.topRunningActivity()) { // Notify the state at the beginning because the removeAnimation may notify the // transition is finished. This is a signal that there will be a next transition. mDisplayContent.mFixedRotationTransitionListener.notifyRecentsWillBeTop(); diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index 03944172db7c9..c9faf34bbacb6 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -701,6 +701,12 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { // Continue the animation (simulating a call to cleanupScreenshot()) mController.continueDeferredCancelAnimation(); verify(mAnimationCallbacks).onAnimationFinished(REORDER_MOVE_TO_TOP, false); + + // Assume home was moved to front so will-be-top callback should not be called. + homeActivity.moveFocusableActivityToTop("test"); + spyOn(mDefaultDisplay.mFixedRotationTransitionListener); + mController.cleanupAnimation(REORDER_MOVE_TO_TOP); + verify(mDefaultDisplay.mFixedRotationTransitionListener, never()).notifyRecentsWillBeTop(); } private ActivityRecord createHomeActivity() {