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

Commit efad747e authored by Louis Chang's avatar Louis Chang
Browse files

Clear the preferred top focusable root task when moving

... a focusable and inivisble root task to top.

A focusable root task was moved to top, but it was not the
top focusable root task because the task was force-hidden
and not visible. The mPreferredTopFocusableRootTask should
be clear in that case, so that the top focusable root task
can be recalculated to the topmost root task once it became
visible.

Bug: 228092608
Test: repro on the car emulator
Change-Id: I5e645b5148ab03014a95ac92d540e3c6f242bbfe
parent 148fdaa8
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -422,8 +422,10 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        // wasContained} restricts the preferred root task is set only when moving an existing
        // root task to top instead of adding a new root task that may be too early (e.g. in the
        // middle of launching or reparenting).
        if (moveToTop && child.isFocusableAndVisible()) {
            mPreferredTopFocusableRootTask = child;
        final boolean isTopFocusableTask = moveToTop && child.isTopActivityFocusable();
        if (isTopFocusableTask) {
            mPreferredTopFocusableRootTask =
                    child.shouldBeVisible(null /* starting */) ? child : null;
        } else if (mPreferredTopFocusableRootTask == child) {
            mPreferredTopFocusableRootTask = null;
        }