Screenshot freeform task when going to overview

When freeform tasks are visible in desktop mode, capture a screenshot of
the tasks when opening overview.
Also use RecentsView instead of RecentsAnimationController when
finishing the recents animation. RecentsView.finishRecentsAnimation
method has an extra call to onRecentsAnimationComplete() which ensures
that screenshot does got used.

Bug: 244348395
Test: manual, open freeform task, swipe up to go overview, observe a
screenshot of the task

Change-Id: I066b25ec7ae25d1e09aba0ff0a379d35bbe2b636
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 0347c7e..a4f3d5b 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -1881,11 +1881,13 @@
     }
 
     private void finishCurrentTransitionToRecents() {
-        if (mRecentsAnimationController != null
+        if (mRecentsView != null
                 && mActivityInterface.getDesktopVisibilityController() != null
                 && mActivityInterface.getDesktopVisibilityController().areFreeformTasksVisible()) {
-            mRecentsAnimationController.finish(true /* toRecents */,
-                    () -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
+            mRecentsView.switchToScreenshot(() -> {
+                mRecentsView.finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
+                        () -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
+            });
         } else {
             mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED);
             if (mRecentsAnimationController != null) {