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

Commit 5fae7137 authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "SplitScrn: Check for all children visibility when updating mVisible." into main

parents 7587d53f e984551f
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -245,9 +245,9 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener {
                return;
                return;
            }
            }
            mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
            mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
            mVisible = taskInfo.isVisible && taskInfo.isVisibleRequested;
            mVisible = isStageVisible();
            mCallbacks.onChildTaskStatusChanged(this, taskInfo.taskId, true /* present */,
            mCallbacks.onChildTaskStatusChanged(this, taskInfo.taskId, true /* present */,
                    mVisible);
                    taskInfo.isVisible && taskInfo.isVisibleRequested);
        } else {
        } else {
            throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
            throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
                    + "\n mRootTaskInfo: " + mRootTaskInfo);
                    + "\n mRootTaskInfo: " + mRootTaskInfo);
@@ -293,6 +293,19 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener {
        t.reparent(sc, findTaskSurface(taskId));
        t.reparent(sc, findTaskSurface(taskId));
    }
    }


    /**
     * Checks against all children task info and return true if any are marked as visible.
     */
    private boolean isStageVisible() {
        for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
            if (mChildrenTaskInfo.valueAt(i).isVisible
                    && mChildrenTaskInfo.valueAt(i).isVisibleRequested) {
                return true;
            }
        }
        return false;
    }

    private SurfaceControl findTaskSurface(int taskId) {
    private SurfaceControl findTaskSurface(int taskId) {
        if (mRootTaskInfo.taskId == taskId) {
        if (mRootTaskInfo.taskId == taskId) {
            return mRootLeash;
            return mRootLeash;