diff options
| author | 2023-08-23 10:13:32 -0700 | |
|---|---|---|
| committer | 2023-08-23 10:13:32 -0700 | |
| commit | 564df39f95f2769c94956bbb0bb5140c6a67f4ef (patch) | |
| tree | 3000acbedbae832005b22f9c85712cb58eb2f598 | |
| parent | ddcf051c9e95f3ef7faad316a25f65eeb5348f9c (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityRecord.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 71502c667f02..7c849aac07db 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -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) { |