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

Commit a8e3dbf1 authored by Robin Lee's avatar Robin Lee
Browse files

Fix non tailcall onTransitionFinished

According to current design, RecentsTransitionHandler's finish methods
are not re-entrant, so onTransitionFinished *must* be tail called from
RecentsTransitionHandler to avoid broken state when we come back.

Test: atest 'ShellTransitionTests#testTransitSleep_squashesRecents' # see follow-up commit
Bug: 277212616
Change-Id: I97fd08f16e096588e2c838b181ff0287410f8326
parent 39421eea
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -213,12 +213,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {

        RecentsController(IRecentsAnimationRunner listener) {
            mListener = listener;
            mDeathHandler = () -> mExecutor.execute(() -> {
                if (mListener == null) return;
                if (mFinishCB != null) {
                    finish(mWillFinishToHome, false /* leaveHint */);
                }
            });
            mDeathHandler = () -> finish(mWillFinishToHome, false /* leaveHint */);
            try {
                mListener.asBinder().linkToDeath(mDeathHandler, 0 /* flags */);
            } catch (RemoteException e) {
@@ -245,7 +240,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
                }
            }
            if (mFinishCB != null) {
                finish(toHome, false /* userLeave */);
                finishInner(toHome, false /* userLeave */);
            } else {
                cleanUp();
            }
@@ -552,13 +547,13 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
            t.apply();
            // not using the incoming anim-only surfaces
            info.releaseAnimSurfaces();
            finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */);
            if (appearedTargets == null) return;
            try {
                mListener.onTasksAppeared(appearedTargets);
            } catch (RemoteException e) {
                Slog.e(TAG, "Error sending appeared tasks to recents animation", e);
            }
            finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */);
        }

        /** For now, just set-up a jump-cut to the new activity. */