Prevent early onEnterAnimationComplete callback for recents target
- When starting the recents animation, we immediately change the visibility
of home, which triggers the onEnterAnimationComplete for the target
activity to be called. We would like to use the callback on the client
side to actually do work once the enter animation completes (in both
the recents and non-recents animation case), so instead of sending the
callback immediately, defer it until after the animation has actually
completed.
Bug: 77730018
Test: Manual, tap home and ensure the client only gets
onEnterAnimationComplete after the transition ends
Change-Id: I3f4b189712e61867d9185e32bda4afcc9d7e2849
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 318b3d2..2aa4f3b 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -397,6 +397,14 @@
// Clear associated input consumers
mService.mInputMonitor.updateInputWindowsLw(true /*force*/);
mService.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
+
+ // We have deferred all notifications to the target app as a part of the recents animation,
+ // so if we are actually transitioning there, notify again here
+ if (mTargetAppToken != null) {
+ if (reorderMode == REORDER_MOVE_TO_TOP || reorderMode == REORDER_KEEP_IN_PLACE) {
+ mService.mAppTransition.notifyAppTransitionFinishedLocked(mTargetAppToken.token);
+ }
+ }
}
void scheduleFailsafe() {
@@ -447,6 +455,10 @@
return false;
}
+ boolean isTargetApp(AppWindowToken token) {
+ return mTargetAppToken != null && token == mTargetAppToken;
+ }
+
private boolean isTargetOverWallpaper() {
if (mTargetAppToken == null) {
return false;