Merge "Create separate fullscreen launch type for shortcuts" into udc-dev

This commit is contained in:
Treehugger Robot
2023-06-02 05:22:23 +00:00
committed by Android (Google) Code Review
2 changed files with 34 additions and 9 deletions

View File

@@ -62,7 +62,8 @@ class SplitSelectDataHolder(
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 @@ class SplitSelectDataHolder(
// 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 @@ class SplitSelectDataHolder(
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 @@ class SplitSelectDataHolder(
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,

View File

@@ -28,6 +28,7 @@ import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_PENDINGINTE
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 @@ public class SplitSelectStateController {
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 @@ public class SplitSelectStateController {
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 @@ public class SplitSelectStateController {
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);
}
}
}