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

Commit 21373a85 authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge "Support starts a pair of intent/shortcut and task to split" into tm-qpr-dev

parents 6aca959b 3d39bfcd
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -561,6 +561,34 @@ public class SystemUiProxy implements ISystemUiProxy {
        }
    }

    public void startIntentAndTask(PendingIntent pendingIntent, Intent fillInIntent,
            Bundle options1, int taskId, Bundle options2,
            @SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
            RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
        if (mSystemUiProxy != null) {
            try {
                mSplitScreen.startIntentAndTask(pendingIntent, fillInIntent, options1,
                        taskId, options2, splitPosition, splitRatio,
                        remoteTransition.getTransition(), instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startIntentAndTask");
            }
        }
    }

    public void startShortcutAndTask(ShortcutInfo shortcutInfo, Bundle options1, int taskId,
            Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
            float splitRatio, RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
        if (mSystemUiProxy != null) {
            try {
                mSplitScreen.startShortcutAndTask(shortcutInfo, options1, taskId, options2,
                        splitPosition, splitRatio, remoteTransition.getTransition(), instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startShortcutAndTask");
            }
        }
    }

    /**
     * Start multiple tasks in split-screen simultaneously.
     */
+4 −3
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.quickstep;

import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -425,8 +424,10 @@ public final class TaskViewUtils {
        TransitionInfo.Change splitRoot2 = null;
        for (int i = 0; i < transitionInfo.getChanges().size(); ++i) {
            final TransitionInfo.Change change = transitionInfo.getChanges().get(i);
            final int taskId = change.getTaskInfo() != null ? change.getTaskInfo().taskId : -1;
            if (change.getTaskInfo() == null) continue;
            final int taskId = change.getTaskInfo().taskId;
            final int mode = change.getMode();

            // Find the target tasks' root tasks since those are the split stages that need to
            // be animated (the tasks themselves are children and thus inherit animation).
            if (taskId == initialTaskId || taskId == secondTaskId) {
@@ -439,7 +440,7 @@ public final class TaskViewUtils {
                            + "root of " + taskId + " is already visible or has broken hierarchy.");
                }
            }
            if (taskId == initialTaskId && initialTaskId != INVALID_TASK_ID) {
            if (taskId == initialTaskId) {
                splitRoot1 = transitionInfo.getChange(change.getParent());
            }
            if (taskId == secondTaskId) {
+26 −12
Original line number Diff line number Diff line
@@ -214,18 +214,36 @@ public class SplitSelectStateController {
            @Nullable InstanceId shellInstanceId) {
        TestLogging.recordEvent(
                TestProtocol.SEQUENCE_MAIN, "launchSplitTasks");
        final ActivityOptions options1 = ActivityOptions.makeBasic();
        if (freezeTaskList) {
            options1.setFreezeRecentTasksReordering();
        }
        if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
            RemoteSplitLaunchTransitionRunner animationRunner =
            final RemoteSplitLaunchTransitionRunner animationRunner =
                    new RemoteSplitLaunchTransitionRunner(taskId1, taskPendingIntent, taskId2,
                            callback);
            mSystemUiProxy.startTasks(taskId1, null /* options1 */, taskId2,
                    null /* options2 */, stagePosition, splitRatio,
                    new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR,
                            ActivityThread.currentActivityThread().getApplicationThread()),
            final RemoteTransitionCompat remoteTransition = new RemoteTransitionCompat(
                    animationRunner, MAIN_EXECUTOR,
                    ActivityThread.currentActivityThread().getApplicationThread());
            if (taskPendingIntent == null) {
                mSystemUiProxy.startTasks(taskId1, options1.toBundle(), taskId2,
                        null /* options2 */, stagePosition, splitRatio, remoteTransition,
                        shellInstanceId);
            // TODO(b/237635859): handle intent/shortcut + task with shell transition
            } else {
            RemoteSplitLaunchAnimationRunner animationRunner =
                final ShortcutInfo shortcutInfo = getShortcutInfo(mInitialTaskIntent,
                        taskPendingIntent.getCreatorUserHandle());
                if (shortcutInfo != null) {
                    mSystemUiProxy.startShortcutAndTask(shortcutInfo,
                            options1.toBundle(), taskId2, null /* options2 */, stagePosition,
                            splitRatio, remoteTransition, shellInstanceId);
                } else {
                    mSystemUiProxy.startIntentAndTask(taskPendingIntent,
                            fillInIntent, options1.toBundle(), taskId2, null /* options2 */,
                            stagePosition, splitRatio, remoteTransition, shellInstanceId);
                }
            }
        } else {
            final RemoteSplitLaunchAnimationRunner animationRunner =
                    new RemoteSplitLaunchAnimationRunner(taskId1, taskPendingIntent, taskId2,
                            callback);
            final RemoteAnimationAdapter adapter = new RemoteAnimationAdapter(
@@ -233,10 +251,6 @@ public class SplitSelectStateController {
                    300, 150,
                    ActivityThread.currentActivityThread().getApplicationThread());

            ActivityOptions options1 = ActivityOptions.makeBasic();
            if (freezeTaskList) {
                options1.setFreezeRecentTasksReordering();
            }
            if (taskPendingIntent == null) {
                mSystemUiProxy.startTasksWithLegacyTransition(taskId1, options1.toBundle(),
                        taskId2, null /* options2 */, stagePosition, splitRatio, adapter,