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

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

Hide both pausing and closing tasks when finishing the recents transition

- If we try to merge a transition that closes a pausing task, the task
  will be removed from the pausing set, but not actually handled during
  cleanup and may result in the task being visible momentarily between
  reparenting of the task out of the transition leash (applied in the
  shell) and WM committing the visibility of the task
- When handling a task view transition for a task that going TO_BACK,
  also update the surface visibility if the pending transition is also
  TO_BACK since that is only created when the taskview container's
  surface is destroyed.

Fixes: 310567149
Test: Repro on the bug
Change-Id: I1ba72a2f1b2bcd2b56f55d4c288e86ebf3e53d8c
parent 24a9de23
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -995,16 +995,10 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
                    t.show(mOpeningTasks.get(i).mTaskSurface);
                }
                for (int i = 0; i < mPausingTasks.size(); ++i) {
                    if (!sendUserLeaveHint && mPausingTasks.get(i).isLeaf()) {
                        // This means recents is not *actually* finishing, so of course we gotta
                        // do special stuff in WMCore to accommodate.
                        wct.setDoNotPip(mPausingTasks.get(i).mToken);
                    cleanUpPausingOrClosingTask(mPausingTasks.get(i), wct, t, sendUserLeaveHint);
                }
                    // Since we will reparent out of the leashes, pre-emptively hide the child
                    // surface to match the leash. Otherwise, there will be a flicker before the
                    // visibility gets committed in Core when using split-screen (in splitscreen,
                    // the leaf-tasks are not "independent" so aren't hidden by normal setup).
                    t.hide(mPausingTasks.get(i).mTaskSurface);
                for (int i = 0; i < mClosingTasks.size(); ++i) {
                    cleanUpPausingOrClosingTask(mClosingTasks.get(i), wct, t, sendUserLeaveHint);
                }
                if (mPipTransaction != null && sendUserLeaveHint) {
                    SurfaceControl pipLeash = null;
@@ -1053,6 +1047,20 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
            }
        }

        private void cleanUpPausingOrClosingTask(TaskState task, WindowContainerTransaction wct,
                SurfaceControl.Transaction finishTransaction, boolean sendUserLeaveHint) {
            if (!sendUserLeaveHint && task.isLeaf()) {
                // This means recents is not *actually* finishing, so of course we gotta
                // do special stuff in WMCore to accommodate.
                wct.setDoNotPip(task.mToken);
            }
            // Since we will reparent out of the leashes, pre-emptively hide the child
            // surface to match the leash. Otherwise, there will be a flicker before the
            // visibility gets committed in Core when using split-screen (in splitscreen,
            // the leaf-tasks are not "independent" so aren't hidden by normal setup).
            finishTransaction.hide(task.mTaskSurface);
        }

        @Override
        public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) {
        }
+5 −0
Original line number Diff line number Diff line
@@ -330,6 +330,11 @@ public class TaskViewTransitions implements Transitions.TransitionHandler {
                    continue;
                }
                if (isHide) {
                    if (pending.mType == TRANSIT_TO_BACK) {
                        // TO_BACK is only used when setting the task view visibility immediately,
                        // so in that case we can also hide the surface immediately
                        startTransaction.hide(chg.getLeash());
                    }
                    tv.prepareHideAnimation(finishTransaction);
                } else {
                    tv.prepareCloseAnimation();