diff options
author | 2024-03-04 11:03:52 +0000 | |
---|---|---|
committer | 2024-03-04 11:03:52 +0000 | |
commit | a8f168949c9a9639acc4c29123d87149e870caeb (patch) | |
tree | bb144f9b2ae661cb6390c6ea756c56a5b23f562f | |
parent | 5aa4ba28c49344c136fffcb67c795bc372c55ef2 (diff) | |
parent | 73e351345f681668f89add849048022d526c7353 (diff) |
Merge "Fix display id for desktop keyboard shotcuts" into main
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index e9a7fe1371ac..ec4b38b10af2 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -3504,7 +3504,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (firstDown && event.isMetaPressed() && event.isCtrlPressed()) { StatusBarManagerInternal statusbar = getStatusBarManagerInternal(); if (statusbar != null) { - statusbar.moveFocusedTaskToFullscreen(event.getDisplayId()); + statusbar.moveFocusedTaskToFullscreen(getTargetDisplayIdForKeyEvent(event)); logKeyboardSystemsEvent(event, KeyboardLogEvent.MULTI_WINDOW_NAVIGATION); return true; } @@ -3514,7 +3514,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (firstDown && event.isMetaPressed() && event.isCtrlPressed()) { StatusBarManagerInternal statusbar = getStatusBarManagerInternal(); if (statusbar != null) { - statusbar.enterDesktop(event.getDisplayId()); + statusbar.enterDesktop(getTargetDisplayIdForKeyEvent(event)); logKeyboardSystemsEvent(event, KeyboardLogEvent.DESKTOP_MODE); return true; } @@ -6951,4 +6951,18 @@ public class PhoneWindowManager implements WindowManagerPolicy { == PERMISSION_GRANTED; } } + + private int getTargetDisplayIdForKeyEvent(KeyEvent event) { + int displayId = event.getDisplayId(); + + if (displayId == INVALID_DISPLAY) { + displayId = mTopFocusedDisplayId; + } + + if (displayId == INVALID_DISPLAY) { + return DEFAULT_DISPLAY; + } else { + return displayId; + } + } } |