Make sure that live tile feature is compatible with scrolling towards previous app.

Change-Id: I5d6e3bfe22a505f0c77a6f7f627e9248e63ea6e0
Fixes: 123720385
Test: scroll or fling towards the previous app, it will settle on it and launch it.
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index a99fc0f..c1417dd 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -1164,11 +1164,18 @@
     @UiThread
     private void startNewTask() {
         // Launch the task user scrolled to (mRecentsView.getNextPage()).
-        mRecentsAnimationWrapper.finish(true /* toRecents */, () -> {
+        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
+            // We finish recents animation inside launchTask() when live tile is enabled.
             mRecentsView.getTaskViewAt(mRecentsView.getNextPage()).launchTask(false,
                     result -> setStateOnUiThread(STATE_HANDLER_INVALIDATED),
                     mMainThreadHandler);
-        });
+        } else {
+            mRecentsAnimationWrapper.finish(true /* toRecents */, () -> {
+                mRecentsView.getTaskViewAt(mRecentsView.getNextPage()).launchTask(false,
+                        result -> setStateOnUiThread(STATE_HANDLER_INVALIDATED),
+                        mMainThreadHandler);
+            });
+        }
         mTouchInteractionLog.finishRecentsAnimation(false);
         doLogGesture(NEW_TASK);
     }