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

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

Merge "Fix some legacy-transition timing issues in split-screen" into sc-dev

parents 91fb524a b944f19d
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ class LegacySplitScreenTaskListener implements ShellTaskOrganizer.TaskListener {
    private final SyncTransactionQueue mSyncQueue;
    private final SparseArray<SurfaceControl> mLeashByTaskId = new SparseArray<>();

    // TODO(shell-transitions): Remove when switched to shell-transitions.
    private final SparseArray<Point> mPositionByTaskId = new SparseArray<>();

    RunningTaskInfo mPrimary;
    RunningTaskInfo mSecondary;
    SurfaceControl mPrimarySurface;
@@ -167,6 +170,7 @@ class LegacySplitScreenTaskListener implements ShellTaskOrganizer.TaskListener {
    @Override
    public void onTaskVanished(RunningTaskInfo taskInfo) {
        synchronized (this) {
            mPositionByTaskId.remove(taskInfo.taskId);
            if (taskInfo.hasParentTask()) {
                mLeashByTaskId.remove(taskInfo.taskId);
                return;
@@ -200,16 +204,24 @@ class LegacySplitScreenTaskListener implements ShellTaskOrganizer.TaskListener {
        }
        synchronized (this) {
            if (taskInfo.hasParentTask()) {
                handleChildTaskChanged(taskInfo);
                // changed messages are noisy since it reports on every ensureVisibility. This
                // conflicts with legacy app-transitions which "swaps" the position to a
                // leash. For now, only update when position actually changes to avoid
                // poorly-timed duplicate calls.
                if (taskInfo.positionInParent.equals(mPositionByTaskId.get(taskInfo.taskId))) {
                    return;
                }

                handleChildTaskChanged(taskInfo);
            } else {
                handleTaskInfoChanged(taskInfo);
            }
            mPositionByTaskId.put(taskInfo.taskId, new Point(taskInfo.positionInParent));
        }
    }

    private void handleChildTaskAppeared(RunningTaskInfo taskInfo, SurfaceControl leash) {
        mLeashByTaskId.put(taskInfo.taskId, leash);
        mPositionByTaskId.put(taskInfo.taskId, new Point(taskInfo.positionInParent));
        if (Transitions.ENABLE_SHELL_TRANSITIONS) return;
        updateChildTaskSurface(taskInfo, leash, true /* firstAppeared */);
    }
+0 −1
Original line number Diff line number Diff line
@@ -3626,7 +3626,6 @@ class Task extends WindowContainer<WindowContainer> {

    @Override
    void resetSurfacePositionForAnimationLeash(SurfaceControl.Transaction t) {
        if (isOrganized()) return;
        super.resetSurfacePositionForAnimationLeash(t);
    }