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

Commit 783e4e07 authored by Winson Chung's avatar Winson Chung
Browse files

Ensure we call cancel in a few more fallback cases

- We should always cancel and notify the listener after the recents
  transition is started.  These are mainly edge cases where transition
  handling goes wrong or Launcher erroneously starts a recents
  transition while on the homescreen.

Bug: 329324086
Test: atest WMShellUnitTests
Change-Id: I36c61d9efd3157a84f31e969a9f10a13c3e77eb3
parent dbc248a1
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -402,6 +402,11 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
            }
        }

        /**
         * Cleans up the recents transition.  This should generally not be called directly
         * to cancel a transition after it has started, instead callers should call one of
         * the cancel() methods to ensure that Launcher is notified.
         */
        void cleanUp() {
            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                    "[%d] RecentsController.cleanup", mInstanceId);
@@ -438,7 +443,8 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
            if (mListener == null || mTransition == null) {
                Slog.e(TAG, "Missing listener or transition, hasListener=" + (mListener != null) +
                        " hasTransition=" + (mTransition != null));
                cleanUp();
                cancel("No listener (" + (mListener == null)
                        + ") or no transition (" + (mTransition == null) + ")");
                return false;
            }
            // First see if this is a valid recents transition.
@@ -462,7 +468,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
            if (mRecentsTask == null && !hasPausingTasks) {
                // Recents is already running apparently, so this is a no-op.
                Slog.e(TAG, "Tried to start recents while it is already running.");
                cleanUp();
                cancel("No recents task and no pausing tasks");
                return false;
            }