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

Commit 8561894f authored by Winson Chung's avatar Winson Chung Committed by android-build-merger
Browse files

Merge "Fix issue with non-focusable PiP activities being resumed." into oc-dev

am: 68cf1b88

Change-Id: I7d20aeebb7e1a1e6485cc22a8e18ca3c4ab35c3d
parents 2d8e49da 68cf1b88
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -644,9 +644,13 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
    }
    }


    final ActivityRecord topRunningActivityLocked() {
    final ActivityRecord topRunningActivityLocked() {
        return topRunningActivityLocked(false /* focusableOnly */);
    }

    final ActivityRecord topRunningActivityLocked(boolean focusableOnly) {
        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
            ActivityRecord r = mTaskHistory.get(taskNdx).topRunningActivityLocked();
            ActivityRecord r = mTaskHistory.get(taskNdx).topRunningActivityLocked();
            if (r != null) {
            if (r != null && (!focusableOnly || r.isFocusable())) {
                return r;
                return r;
            }
            }
        }
        }
@@ -1321,7 +1325,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                        + (timeout ? " (due to timeout)" : " (pause complete)"));
                        + (timeout ? " (due to timeout)" : " (pause complete)"));
                mService.mWindowManager.deferSurfaceLayout();
                mService.mWindowManager.deferSurfaceLayout();
                try {
                try {
                    completePauseLocked(true, null);
                    completePauseLocked(true /* resumeNext */, null /* resumingActivity */);
                } finally {
                } finally {
                    mService.mWindowManager.continueSurfaceLayout();
                    mService.mWindowManager.continueSurfaceLayout();
                }
                }
@@ -2198,8 +2202,10 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            return false;
            return false;
        }
        }


        // Find the topmost activity in this stack that is not finishing.
        // Find the next top-most activity to resume in this stack that is not finishing and is
        final ActivityRecord next = topRunningActivityLocked();
        // focusable. If it is not focusable, we will fall into the case below to resume the
        // top activity in the next focusable task.
        final ActivityRecord next = topRunningActivityLocked(true /* focusableOnly */);


        final boolean hasRunningActivity = next != null;
        final boolean hasRunningActivity = next != null;