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
This commit is contained in:
Robin Lee
2023-04-14 16:57:35 +02:00
parent 39421eea46
commit a8e3dbf124

View File

@@ -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. */