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

Commit f2638c8a authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Android (Google) Code Review
Browse files

Merge "Fix: Open notes shortcut is not customizable" into main

parents 5651b1ce ade50930
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -216,20 +216,13 @@ constructor(
            "handleKeyGestureEvent: Received OPEN_NOTES gesture event from keycodes: " +
                event.keycodes.contentToString()
        }
        if (
            event.keycodes.contains(KEYCODE_N) &&
                event.hasModifiers(KeyEvent.META_CTRL_ON or KeyEvent.META_META_ON)
        ) {
            debugLog { "Note task triggered by keyboard shortcut" }
            backgroundExecutor.execute { controller.showNoteTask(KEYBOARD_SHORTCUT) }
            return true
        }
        if (event.keycodes.size == 1 && event.keycodes[0] == KEYCODE_STYLUS_BUTTON_TAIL) {
            debugLog { "Note task triggered by stylus tail button" }
            backgroundExecutor.execute { controller.showNoteTask(TAIL_BUTTON) }
            return true
        }
        return false
        backgroundExecutor.execute { controller.showNoteTask(KEYBOARD_SHORTCUT) }
        return true
    }

    private fun isKeyGestureSupported(gestureType: Int): Boolean {
+1 −3
Original line number Diff line number Diff line
@@ -181,11 +181,9 @@ internal class NoteTaskInitializerTest : SysuiTestCase() {

    @Test
    @EnableFlags(com.android.hardware.input.Flags.FLAG_USE_KEY_GESTURE_EVENT_HANDLER)
    fun handlesShortcut_metaCtrlN() {
    fun handlesShortcut_keyGestureTypeOpenNotes() {
        val gestureEvent =
            KeyGestureEvent.Builder()
                .setKeycodes(intArrayOf(KeyEvent.KEYCODE_N))
                .setModifierState(KeyEvent.META_META_ON or KeyEvent.META_CTRL_ON)
                .setKeyGestureType(KeyGestureEvent.KEY_GESTURE_TYPE_OPEN_NOTES)
                .setAction(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
                .build()