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

Commit 64d724fc authored by Yuhan Yang's avatar Yuhan Yang Committed by Android (Google) Code Review
Browse files

Merge "Move toggle voice access shortcut to accessibility category" into main

parents fb5aea38 1eef74ca
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2316,9 +2316,6 @@
    <string name="group_system_lock_screen">Lock screen</string>
    <!-- User visible title for the keyboard shortcut that pulls up Notes app for quick memo. [CHAR LIMIT=70] -->
    <string name="group_system_quick_memo">Take a note</string>
    <!-- TODO(b/383734125): make it translatable once string is finalized by UXW.-->
    <!-- User visible title for the keyboard shortcut that toggles Voice Access. [CHAR LIMIT=70] -->
    <string name="group_system_toggle_voice_access" translatable="false">Toggle Voice Access</string>

    <!-- User visible title for the multitasking keyboard shortcuts list. [CHAR LIMIT=70] -->
    <string name="keyboard_shortcut_group_system_multitasking">Multitasking</string>
@@ -2385,6 +2382,8 @@
    <string name="group_accessibility_toggle_sticky_keys">Toggle sticky keys</string>
    <!-- User visible title for the keyboard shortcut that toggles slow keys. [CHAR LIMIT=70]-->
    <string name="group_accessibility_toggle_slow_keys">Toggle slow keys</string>
    <!-- User visible title for the keyboard shortcut that toggles Voice Access. [CHAR LIMIT=70] -->
    <string name="group_accessibility_toggle_voice_access">Toggle Voice Access</string>

    <!-- SysUI Tuner: Label for screen about do not disturb settings [CHAR LIMIT=60] -->
    <string name="volume_and_do_not_disturb">Do Not Disturb</string>
+4 −3
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ class InputGestureMaps @Inject constructor(private val context: Context) {
            KEY_GESTURE_TYPE_LAUNCH_ASSISTANT to System,
            KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT to System,
            KEY_GESTURE_TYPE_ALL_APPS to System,
            KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS to System,

            // Multitasking Category
            KEY_GESTURE_TYPE_RECENT_APPS_SWITCHER to MultiTasking,
@@ -92,6 +91,7 @@ class InputGestureMaps @Inject constructor(private val context: Context) {
            KEY_GESTURE_TYPE_TOGGLE_MOUSE_KEYS to Accessibility,
            KEY_GESTURE_TYPE_TOGGLE_STICKY_KEYS to Accessibility,
            KEY_GESTURE_TYPE_TOGGLE_SLOW_KEYS to Accessibility,
            KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS to Accessibility,
        )

    val gestureToInternalKeyboardShortcutGroupLabelResIdMap =
@@ -113,7 +113,6 @@ class InputGestureMaps @Inject constructor(private val context: Context) {
            KEY_GESTURE_TYPE_LAUNCH_ASSISTANT to R.string.shortcut_helper_category_system_apps,
            KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT to
                R.string.shortcut_helper_category_system_apps,
            KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS to R.string.shortcut_helper_category_system_apps,

            // Multitasking Category
            KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION_LEFT to
@@ -144,6 +143,7 @@ class InputGestureMaps @Inject constructor(private val context: Context) {
            KEY_GESTURE_TYPE_TOGGLE_MOUSE_KEYS to R.string.shortcutHelper_category_accessibility,
            KEY_GESTURE_TYPE_TOGGLE_STICKY_KEYS to R.string.shortcutHelper_category_accessibility,
            KEY_GESTURE_TYPE_TOGGLE_SLOW_KEYS to R.string.shortcutHelper_category_accessibility,
            KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS to R.string.shortcutHelper_category_accessibility,
        )

    /**
@@ -168,7 +168,6 @@ class InputGestureMaps @Inject constructor(private val context: Context) {
            KEY_GESTURE_TYPE_LAUNCH_ASSISTANT to R.string.group_system_access_google_assistant,
            KEY_GESTURE_TYPE_LAUNCH_VOICE_ASSISTANT to
                R.string.group_system_access_google_assistant,
            KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS to R.string.group_system_toggle_voice_access,

            // Multitasking Category
            KEY_GESTURE_TYPE_RECENT_APPS_SWITCHER to R.string.group_system_cycle_forward,
@@ -191,6 +190,8 @@ class InputGestureMaps @Inject constructor(private val context: Context) {
            KEY_GESTURE_TYPE_TOGGLE_MOUSE_KEYS to R.string.group_accessibility_toggle_mouse_keys,
            KEY_GESTURE_TYPE_TOGGLE_STICKY_KEYS to R.string.group_accessibility_toggle_sticky_keys,
            KEY_GESTURE_TYPE_TOGGLE_SLOW_KEYS to R.string.group_accessibility_toggle_slow_keys,
            KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS to
                R.string.group_accessibility_toggle_voice_access,
        )

    val shortcutLabelToKeyGestureTypeMap: Map<String, Int>
+14 −0
Original line number Diff line number Diff line
@@ -22,10 +22,12 @@ import android.view.KeyEvent.KEYCODE_3
import android.view.KeyEvent.KEYCODE_4
import android.view.KeyEvent.KEYCODE_5
import android.view.KeyEvent.KEYCODE_6
import android.view.KeyEvent.KEYCODE_V
import android.view.KeyEvent.META_ALT_ON
import android.view.KeyEvent.META_META_ON
import android.view.KeyboardShortcutGroup
import android.view.KeyboardShortcutInfo
import com.android.hardware.input.Flags.enableVoiceAccessKeyGestures
import com.android.hardware.input.Flags.keyboardA11yShortcutControl
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyboard.shortcut.data.model.shortcutInfo
@@ -92,6 +94,18 @@ class AccessibilityShortcutsSource @Inject constructor(@Main private val resourc
            }
        }

        if (enableVoiceAccessKeyGestures()) {
            shortcuts.add(
                // Toggle voice access:
                //  - Meta + Alt + V
                shortcutInfo(
                    resources.getString(R.string.group_accessibility_toggle_voice_access)
                ) {
                    command(META_META_ON or META_ALT_ON, KEYCODE_V)
                }
            )
        }

        return shortcuts
    }
}
+2 −17
Original line number Diff line number Diff line
@@ -32,14 +32,12 @@ import android.view.KeyEvent.KEYCODE_RECENT_APPS
import android.view.KeyEvent.KEYCODE_S
import android.view.KeyEvent.KEYCODE_SLASH
import android.view.KeyEvent.KEYCODE_TAB
import android.view.KeyEvent.KEYCODE_V
import android.view.KeyEvent.META_ALT_ON
import android.view.KeyEvent.META_CTRL_ON
import android.view.KeyEvent.META_META_ON
import android.view.KeyEvent.META_SHIFT_ON
import android.view.KeyboardShortcutGroup
import android.view.KeyboardShortcutInfo
import com.android.hardware.input.Flags.enableVoiceAccessKeyGestures
import com.android.systemui.Flags.shortcutHelperKeyGlyph
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyboard.shortcut.data.model.shortcutInfo
@@ -120,8 +118,8 @@ constructor(@Main private val resources: Resources, private val inputManager: In
        return shortcuts
    }

    private fun systemControlsShortcuts(): List<KeyboardShortcutInfo>  {
        val shortcuts = mutableListOf(
    private fun systemControlsShortcuts() =
        listOf(
            // Access list of all apps and search (i.e. Search/Launcher):
            //  - Meta
            shortcutInfo(resources.getString(R.string.group_system_access_all_apps_search)) {
@@ -178,19 +176,6 @@ constructor(@Main private val resources: Resources, private val inputManager: In
            },
        )

        if (enableVoiceAccessKeyGestures()) {
            shortcuts.add(
                // Toggle voice access:
                //  - Meta + Alt + V
                shortcutInfo(resources.getString(R.string.group_system_toggle_voice_access)) {
                    command(META_META_ON or META_ALT_ON, KEYCODE_V)
                }
            )
        }

        return shortcuts
    }

    private fun systemAppsShortcuts() =
        listOf(
            // Pull up Notes app for quick memo: