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

Commit 0aeed081 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Use desktop only gesture type for Action+Ctrl+W

This CL introduces a new gesture type,
`KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK`, for the
`Action+Ctrl+W` keyboard shortcut.

Bug: 416437920
Test: KeyGestureControllerTests
Flag: com.android.window.flags.close_task_keyboard_shortcut
Change-Id: I986033702f9ea72a12872c69c755a59df4ac1472
parent d42028a7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ public final class KeyGestureEvent {
    public static final int KEY_GESTURE_TYPE_SWITCH_TO_NEXT_DESK = 78;
    public static final int KEY_GESTURE_TYPE_TOGGLE_QUICK_SETTINGS_PANEL = 79;
    public static final int KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK = 80;
    public static final int KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK = 81;

    public static final int FLAG_CANCELLED = 1 << 0;
    public static final int FLAG_LONG_PRESS = 1 << 1;
@@ -228,6 +229,7 @@ public final class KeyGestureEvent {
            KEY_GESTURE_TYPE_SWITCH_TO_NEXT_DESK,
            KEY_GESTURE_TYPE_TOGGLE_QUICK_SETTINGS_PANEL,
            KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK,
            KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface KeyGestureType {
@@ -828,6 +830,8 @@ public final class KeyGestureEvent {
                return "KEY_GESTURE_TYPE_TOGGLE_QUICK_SETTINGS_PANEL";
            case KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK:
                return "KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK";
            case KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK:
                return "KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK";
            default:
                return Integer.toHexString(value);
        }
+1 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ final class InputGestureManager {
                    createKeyGesture(
                            KeyEvent.KEYCODE_W,
                            KeyEvent.META_META_ON | KeyEvent.META_CTRL_ON,
                            KeyGestureEvent.KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK,
                            KeyGestureEvent.KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK,
                            /* allowCaptureByFocusedWindow = */false
                    ));
        }
+2 −2
Original line number Diff line number Diff line
@@ -166,13 +166,13 @@ object KeyGestureTestData {
                intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE),
            ),
            KeyGestureData(
                "META + CTRL + W -> Quit focused task",
                "META + CTRL + W -> Quit focused desktop task",
                intArrayOf(
                    KeyEvent.KEYCODE_META_LEFT,
                    KeyEvent.KEYCODE_CTRL_LEFT,
                    KeyEvent.KEYCODE_W,
                ),
                KeyGestureEvent.KEY_GESTURE_TYPE_QUIT_FOCUSED_TASK,
                KeyGestureEvent.KEY_GESTURE_TYPE_QUIT_FOCUSED_DESKTOP_TASK,
                intArrayOf(KeyEvent.KEYCODE_W),
                KeyEvent.META_META_ON or KeyEvent.META_CTRL_ON,
                intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE),