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

Commit d4ae1a52 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove split pair according to last visible task" into tm-qpr-dev

parents 85d56bea af778032
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1222,8 +1222,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            // Notify recents if we are exiting in a way that breaks the pair, and disable further
            // updates to splits in the recents until we enter split again
            if (shouldBreakPairedTaskInRecents(exitReason) && mShouldUpdateRecents) {
                recentTasks.removeSplitPair(mMainStage.getTopVisibleChildTaskId());
                recentTasks.removeSplitPair(mSideStage.getTopVisibleChildTaskId());
                recentTasks.removeSplitPair(mMainStage.getLastVisibleTaskId());
                recentTasks.removeSplitPair(mSideStage.getLastVisibleTaskId());
            }
        });
        mShouldUpdateRecents = false;
+14 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
    protected SurfaceControl mDimLayer;
    protected SparseArray<ActivityManager.RunningTaskInfo> mChildrenTaskInfo = new SparseArray<>();
    private final SparseArray<SurfaceControl> mChildrenLeashes = new SparseArray<>();
    private int mLastVisibleTaskId = INVALID_TASK_ID;
    // TODO(b/204308910): Extracts SplitDecorManager related code to common package.
    private SplitDecorManager mSplitDecorManager;

@@ -122,6 +123,13 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
        return contains(t -> t.token.asBinder() == binder);
    }

    /**
     * Returns the last visible task's id.
     */
    int getLastVisibleTaskId() {
        return mLastVisibleTaskId;
    }

    /**
     * Returns the top visible child task's id.
     */
@@ -221,6 +229,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
                return;
            }
            mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
            if (taskInfo.isVisible && taskInfo.taskId != mLastVisibleTaskId) {
                mLastVisibleTaskId = taskInfo.taskId;
            }
            mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */,
                    taskInfo.isVisible);
            if (!ENABLE_SHELL_TRANSITIONS) {
@@ -253,6 +264,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
        } else if (mChildrenTaskInfo.contains(taskId)) {
            mChildrenTaskInfo.remove(taskId);
            mChildrenLeashes.remove(taskId);
            if (taskId == mLastVisibleTaskId) {
                mLastVisibleTaskId = INVALID_TASK_ID;
            }
            mCallbacks.onChildTaskStatusChanged(taskId, false /* present */, taskInfo.isVisible);
            if (ENABLE_SHELL_TRANSITIONS) {
                // Status is managed/synchronized by the transition lifecycle.