summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/wm/RecentsAnimationController.java3
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java6
2 files changed, 8 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 737ef338f9b2..cb30f1624e67 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -952,7 +952,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 a034ac267287..79feb8d30dfd 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() {