summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java18
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;
+ }
+ }
}