Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bb66ccc authored by Winson Chung's avatar Winson Chung
Browse files

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
parent d4a95a16
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -397,6 +397,14 @@ public class RecentsAnimationController implements DeathRecipient {
        // 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 @@ public class RecentsAnimationController implements DeathRecipient {
        return false;
    }

    boolean isTargetApp(AppWindowToken token) {
        return mTargetAppToken != null && token == mTargetAppToken;
    }

    private boolean isTargetOverWallpaper() {
        if (mTargetAppToken == null) {
            return false;
+13 −4
Original line number Diff line number Diff line
@@ -864,6 +864,14 @@ public class WindowManagerService extends IWindowManager.Stub
            } else {
                atoken.updateReportedVisibilityLocked();
                if (atoken.mEnteringAnimation) {
                    if (getRecentsAnimationController() != null
                            && getRecentsAnimationController().isTargetApp(atoken)) {
                        // Currently running a recents animation, this will get called early because
                        // we show the recents animation target activity immediately when the
                        // animation starts. In this case, we should defer sending the finished
                        // callback until the animation successfully finishes
                        return;
                    } else {
                        atoken.mEnteringAnimation = false;
                        try {
                            mActivityManager.notifyEnterAnimationComplete(atoken.token);
@@ -872,6 +880,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    }
                }
            }
        }
    };

    final ArrayList<AppFreezeListener> mAppFreezeListeners = new ArrayList<>();