Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55f38fb3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 43c79d23 8852010e
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -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,
+14 −6
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }