Create separate fullscreen launch type for shortcuts

Bug: 283045822
Test: Verified via debugger the right API is called,
still have issues on split side
Flag: none

Change-Id: Ic2fcbf4ffe05503b0c2e1fade3e3e990498cf6cf
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectDataHolder.kt b/quickstep/src/com/android/quickstep/util/SplitSelectDataHolder.kt
index 8e6415b..0631537 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectDataHolder.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectDataHolder.kt
@@ -62,7 +62,8 @@
     companion object {
         @IntDef(SPLIT_TASK_TASK, SPLIT_TASK_PENDINGINTENT, SPLIT_TASK_SHORTCUT,
                 SPLIT_PENDINGINTENT_TASK, SPLIT_PENDINGINTENT_PENDINGINTENT, SPLIT_SHORTCUT_TASK,
-                SPLIT_SINGLE_TASK_FULLSCREEN, SPLIT_SINGLE_INTENT_FULLSCREEN)
+                SPLIT_SINGLE_TASK_FULLSCREEN, SPLIT_SINGLE_INTENT_FULLSCREEN,
+                SPLIT_SINGLE_SHORTCUT_FULLSCREEN)
         @Retention(AnnotationRetention.SOURCE)
         annotation class SplitLaunchType
 
@@ -76,6 +77,7 @@
         // Non-split edge case of launching the initial selected task as a fullscreen task
         const val SPLIT_SINGLE_TASK_FULLSCREEN = 6
         const val SPLIT_SINGLE_INTENT_FULLSCREEN = 7
+        const val SPLIT_SINGLE_SHORTCUT_FULLSCREEN = 8
     }
 
 
@@ -217,8 +219,7 @@
     fun getFullscreenLaunchData() : SplitLaunchData {
         // Convert all intents to shortcut infos to see if determine if we launch shortcut or intent
         convertIntentsToFinalTypes()
-        val splitLaunchType = if (initialTaskId != INVALID_TASK_ID) SPLIT_SINGLE_TASK_FULLSCREEN
-        else SPLIT_SINGLE_INTENT_FULLSCREEN
+        val splitLaunchType = getFullscreenLaunchType()
 
         return generateSplitLaunchData(splitLaunchType)
     }
@@ -309,6 +310,22 @@
         throw IllegalStateException("Unidentified split launch type")
     }
 
+    @SplitLaunchType
+    private fun getFullscreenLaunchType(): Int {
+        if (initialTaskId != INVALID_TASK_ID) {
+            return SPLIT_SINGLE_TASK_FULLSCREEN
+        }
+
+        if (initialShortcut != null) {
+            return SPLIT_SINGLE_SHORTCUT_FULLSCREEN
+        }
+
+        if (initialIntent != null) {
+            return SPLIT_SINGLE_INTENT_FULLSCREEN
+        }
+        throw IllegalStateException("Unidentified fullscreen launch type")
+    }
+
     data class SplitLaunchData(
             @SplitLaunchType
             val splitLaunchType: Int,
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index ec8be89..45df831 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -28,6 +28,7 @@
 import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_PENDINGINTENT_TASK;
 import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_SHORTCUT_TASK;
 import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_SINGLE_INTENT_FULLSCREEN;
+import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_SINGLE_SHORTCUT_FULLSCREEN;
 import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_SINGLE_TASK_FULLSCREEN;
 import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_PENDINGINTENT;
 import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_SHORTCUT;
@@ -524,6 +525,7 @@
         PendingIntent firstPI = launchData.getInitialPendingIntent();
         int firstUserId = launchData.getInitialUserId();
         int initialStagePosition = launchData.getInitialStagePosition();
+        ShortcutInfo initialShortcut = launchData.getInitialShortcut();
         Bundle optionsBundle = options1.toBundle();
 
         final RemoteSplitLaunchTransitionRunner animationRunner =
@@ -531,17 +533,19 @@
         final RemoteTransition remoteTransition = new RemoteTransition(animationRunner,
                 ActivityThread.currentActivityThread().getApplicationThread(),
                 "LaunchSplitPair");
-        Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
-                LogUtils.getShellShareableInstanceId();
+        InstanceId instanceId = LogUtils.getShellShareableInstanceId().first;
         if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
             switch (launchData.getSplitLaunchType()) {
                 case SPLIT_SINGLE_TASK_FULLSCREEN -> mSystemUiProxy.startTasks(firstTaskId,
                         optionsBundle, secondTaskId, null /* options2 */, initialStagePosition,
-                        DEFAULT_SPLIT_RATIO, remoteTransition, instanceIds.first);
+                        DEFAULT_SPLIT_RATIO, remoteTransition, instanceId);
                 case SPLIT_SINGLE_INTENT_FULLSCREEN -> mSystemUiProxy.startIntentAndTask(firstPI,
                         firstUserId, optionsBundle, secondTaskId, null /*options2*/,
                         initialStagePosition, DEFAULT_SPLIT_RATIO, remoteTransition,
-                        instanceIds.first);
+                        instanceId);
+                case SPLIT_SINGLE_SHORTCUT_FULLSCREEN -> mSystemUiProxy.startShortcutAndTask(
+                        initialShortcut, optionsBundle, firstTaskId, null /* options2 */,
+                        initialStagePosition, DEFAULT_SPLIT_RATIO, remoteTransition, instanceId);
             }
         } else {
             final RemoteAnimationAdapter adapter = getLegacyRemoteAdapter(firstTaskId,
@@ -549,12 +553,16 @@
             switch (launchData.getSplitLaunchType()) {
                 case SPLIT_SINGLE_TASK_FULLSCREEN -> mSystemUiProxy.startTasksWithLegacyTransition(
                         firstTaskId, optionsBundle, secondTaskId, null /* options2 */,
-                        initialStagePosition, DEFAULT_SPLIT_RATIO, adapter, instanceIds.first);
+                        initialStagePosition, DEFAULT_SPLIT_RATIO, adapter, instanceId);
                 case SPLIT_SINGLE_INTENT_FULLSCREEN ->
                         mSystemUiProxy.startIntentAndTaskWithLegacyTransition(firstPI, firstUserId,
                                 optionsBundle, secondTaskId, null /*options2*/,
                                 initialStagePosition, DEFAULT_SPLIT_RATIO, adapter,
-                                instanceIds.first);
+                                instanceId);
+                case SPLIT_SINGLE_SHORTCUT_FULLSCREEN ->
+                        mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(
+                                initialShortcut, optionsBundle, firstTaskId, null /* options2 */,
+                                initialStagePosition, DEFAULT_SPLIT_RATIO, adapter, instanceId);
             }
         }
     }