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

Commit 78a9f282 authored by Louis Chang's avatar Louis Chang Committed by Mady Mellor
Browse files

DO NOT MERGE Reset top focused root task when task hidden

The focused app was not updated when bubble minimized and causing
ANR.

Bug: 179676966
Bug: 171522827
Test: expand and minimize bubbles
Test: 1) play video
      2) adjust volume
      3) get bubble, expand it, adjust volume
      4) collapse bubble
      5) adjust volume
      => Should see volume dialog; no ANR
Change-Id: If04de21b954d074b045e76d7d23e02dade60cdbe
(cherry picked from commit a782799b)
parent 4d7d9c5f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -4597,11 +4597,11 @@ class Task extends WindowContainer<WindowContainer> {
        }
        final boolean wasHidden = isForceHidden();
        mForceHiddenFlags = newFlags;
        if (wasHidden && isFocusableAndVisible()) {
            // The change in force-hidden state will change visibility without triggering a stack
            // order change, so we should reset the preferred top focusable stack to ensure it's not
            // used if a new activity is started from this task.
            getDisplayArea().resetPreferredTopFocusableStackIfBelow(this);
        if (wasHidden != isForceHidden() && isTopActivityFocusable()) {
            // The change in force-hidden state will change visibility without triggering a root
            // task order change, so we should reset the preferred top focusable root task to ensure
            // it's not used if a new activity is started from this task.
            getDisplayArea().resetPreferredTopFocusableRootTaskIfNeeded(this);
        }
        return true;
    }
+3 −2
Original line number Diff line number Diff line
@@ -773,9 +773,10 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
        onStackOrderChanged(stack);
    }

    void resetPreferredTopFocusableStackIfBelow(Task task) {
    /** Reset the mPreferredTopFocusableRootTask if it is or below the given task. */
    void resetPreferredTopFocusableRootTaskIfNeeded(Task task) {
        if (mPreferredTopFocusableStack != null
                && mPreferredTopFocusableStack.compareTo(task) < 0) {
                && mPreferredTopFocusableStack.compareTo(task) <= 0) {
            mPreferredTopFocusableStack = null;
        }
    }