Merge "Start background tasks via task instead of intent." into main
diff --git a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
index 4962367..bdfaa48 100644
--- a/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java
@@ -48,8 +48,11 @@
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.views.FloatingTaskView;
import com.android.quickstep.views.RecentsView;
+import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
+import java.util.Collections;
+
/** Handles when the stage split lands on the home screen. */
public class SplitToWorkspaceController {
@@ -133,10 +136,20 @@
// Use Launcher's default click handler
return false;
}
-
- mController.setSecondTask(intent, user, (ItemInfo) tag);
-
- startWorkspaceAnimation(view, null /*bitmap*/, bitmapInfo.newIcon(mLauncher));
+ // Check for background task matching this tag; if we find one, set second task
+ // via task instead of intent so the bounds and windowing mode will be corrected.
+ mController.findLastActiveTasksAndRunCallback(
+ Collections.singletonList(((ItemInfo) tag).getComponentKey()),
+ false /* findExactPairMatch */,
+ foundTasks -> {
+ Task foundTask = foundTasks[0];
+ if (foundTask != null) {
+ mController.setSecondTask(foundTask, (ItemInfo) tag);
+ } else {
+ mController.setSecondTask(intent, user, (ItemInfo) tag);
+ }
+ startWorkspaceAnimation(view, null /*bitmap*/, bitmapInfo.newIcon(mLauncher));
+ });
return true;
}