Don't handle task appeared during second quick switch transition

Instead of using shared gesture state, use the swipe handler's
internal state. This ensures that only the handler that started
the new task can finish the controller for it (i.e. starting a
new gesture, which creates a new handler, will ignore the
onTaskAppeared() that the previous handler initiated).

Test: Quick switch to delayed task A, then quick switch to B right
before onTaskAppeared() such that we get onTaskAppeared() during
the transition (easier to repro if you increase animation durations
with springs off). Before this change, A appeared on top.

Bug: 156412706
Change-Id: Ic7d3cd43399005095b2e7c7382218edffefdc27b
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
index e7fe142..0bf81ef 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
@@ -724,7 +724,7 @@
         if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
             return false;
         }
-        if (mGestureState.getEndTarget() == NEW_TASK
+        if (mStateCallback.hasStates(STATE_START_NEW_TASK)
                 && appearedTaskTarget.taskId == mGestureState.getLastStartedTaskId()) {
             reset();
             return true;