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

Commit a8f16894 authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

Merge "Fix display id for desktop keyboard shotcuts" into main

parents 5aa4ba28 73e35134
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -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;
        }
    }
}