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

Commit d0e6c8b2 authored by Winson Chung's avatar Winson Chung
Browse files

Freeze task list if requested when launching split tasks

Bug: 206000278
Test: Quickswitch from app pair and back
Change-Id: I76af1396145e121e7f66f9e6b97f21a85c075e8e
parent 8727c4f7
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -21,8 +21,10 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;

import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.view.RemoteAnimationAdapter;
@@ -78,14 +80,15 @@ public class SplitSelectStateController {
     */
    public void setSecondTaskId(Task taskView, Consumer<Boolean> callback) {
        mSecondTask = taskView;
        launchTasks(mInitialTask, mSecondTask, mStagePosition, callback);
        launchTasks(mInitialTask, mSecondTask, mStagePosition, callback,
                false /* freezeTaskList */);
    }

    /**
     * @param stagePosition representing location of task1
     */
    public void launchTasks(Task task1, Task task2, @StagePosition int stagePosition,
            Consumer<Boolean> callback) {
            Consumer<Boolean> callback, boolean freezeTaskList) {
        // Assume initial task is for top/left part of screen
        final int[] taskIds = stagePosition == STAGE_POSITION_TOP_OR_LEFT
                ? new int[]{task1.key.id, task2.key.id}
@@ -105,8 +108,13 @@ public class SplitSelectStateController {
                    300, 150,
                    ActivityThread.currentActivityThread().getApplicationThread());

            mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], null /* mainOptions */,
                    taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, adapter);
            ActivityOptions mainOpts = ActivityOptions.makeBasic();
            if (freezeTaskList) {
                mainOpts.setFreezeRecentTasksReordering();
            }
            mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(),
                    taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT,
                    adapter);
        }
    }

+3 −2
Original line number Diff line number Diff line
@@ -157,14 +157,15 @@ public class GroupedTaskView extends TaskView {
    @Override
    public RunnableList launchTaskAnimated() {
        getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask,
                STAGE_POSITION_TOP_OR_LEFT, null /*callback*/);
                STAGE_POSITION_TOP_OR_LEFT, null /*callback*/,
                false /* freezeTaskList */);
        return null;
    }

    @Override
    public void launchTask(@NonNull Consumer<Boolean> callback, boolean freezeTaskList) {
        getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask,
                STAGE_POSITION_TOP_OR_LEFT, callback);
                STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList);
    }

    @Override