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

Commit 564df39f authored by Alex Stetson's avatar Alex Stetson
Browse files

Check if the display ids match when moving to top

When checking for the current focus, also check that the top focused
display is the relevant display rather than assuming focused means it's
already on top.

Bug: 294251202
Test: atest android.server.wm.MultiDisplayClientTests
Change-Id: I55d4aa9a94ecb01d3a511f34d684a8b064c13a82
parent ddcf051c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3369,7 +3369,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // current focused activity could be another activity in the same Task if activities are
        // displayed on adjacent TaskFragments.
        final ActivityRecord currentFocusedApp = mDisplayContent.mFocusedApp;
        if (currentFocusedApp != null && currentFocusedApp.task == task) {
        final int topFocusedDisplayId = mRootWindowContainer.getTopFocusedDisplayContent() != null
                ? mRootWindowContainer.getTopFocusedDisplayContent().getDisplayId()
                : INVALID_DISPLAY;
        if (currentFocusedApp != null && currentFocusedApp.task == task
                && topFocusedDisplayId == mDisplayContent.getDisplayId()) {
            final Task topFocusableTask = mDisplayContent.getTask(
                    (t) -> t.isLeafTask() && t.isFocusable(), true /*  traverseTopToBottom */);
            if (task == topFocusableTask) {