Merge "Fixing regression with launch target task."
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 9ef3733..757e695 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -773,10 +773,15 @@
 
         // Set the task focused state without requesting view focus, and leave the focus animations
         // until after the enter-animation
-        RecentsActivityLaunchState launchState = mConfig.getLaunchState();
-        int taskOffset = launchState.launchedFromHome ? -1 : -2;
-        setFocusedTask(mStack.getTaskCount() + taskOffset, false /* scrollToTask */,
-                false /* animated */, false /* requestViewFocus */);
+        if (!Constants.DebugFlags.App.EnableFastToggleRecents && launchTargetTask != null) {
+            setFocusedTask(mStack.indexOfTask(launchTargetTask), false /* scrollToTask */,
+                    false /* animated */, false /* requestViewFocus */);
+        } else {
+            RecentsActivityLaunchState launchState = mConfig.getLaunchState();
+            int taskOffset = launchState.launchedFromHome ? -1 : -2;
+            setFocusedTask(mStack.getTaskCount() + taskOffset, false /* scrollToTask */,
+                    false /* animated */, false /* requestViewFocus */);
+        }
 
         // Start dozing
         mUIDozeTrigger.startDozing();