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

Commit ea09c542 authored by Joshua Mokut's avatar Joshua Mokut Committed by Android (Google) Code Review
Browse files

Merge "Added accessibility category to shortcut helper" into main

parents 6867f0b1 e2d2bce1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3779,6 +3779,11 @@
         that shows the user which keyboard shortcuts they can use. The "Split screen" shortcuts are
         for example "Move current app to left split". [CHAR LIMIT=NONE] -->
    <string name="shortcutHelper_category_split_screen">Split screen</string>
    <!-- Title of the keyboard shortcut helper category "Accessibility". This category contains shortcuts
         for android accessibility and disability inclusion features such as screen readers, voice control,
         switch access, talkback, etc. The helper is a component that shows the user which keyboard
         shortcuts they can use. [CHAR LIMIT=NONE] -->
    <string name="shortcutHelper_category_accessibility">Accessibility</string>
    <!-- Title of the keyboard shortcut helper category "Input". The helper is a component
         that shows the user which keyboard shortcuts they can use. The "Input" shortcuts are
         the ones provided by the keyboard. Examples are "Access emoji" or "Switch to next language"
+8 −0
Original line number Diff line number Diff line
@@ -21,12 +21,14 @@ import com.android.systemui.Flags.keyboardShortcutHelperRewrite
import com.android.systemui.keyboard.shortcut.data.repository.CustomShortcutCategoriesRepository
import com.android.systemui.keyboard.shortcut.data.repository.DefaultShortcutCategoriesRepository
import com.android.systemui.keyboard.shortcut.data.repository.ShortcutCategoriesRepository
import com.android.systemui.keyboard.shortcut.data.source.AccessibilityShortcutsSource
import com.android.systemui.keyboard.shortcut.data.source.AppCategoriesShortcutsSource
import com.android.systemui.keyboard.shortcut.data.source.CurrentAppShortcutsSource
import com.android.systemui.keyboard.shortcut.data.source.InputShortcutsSource
import com.android.systemui.keyboard.shortcut.data.source.KeyboardShortcutGroupsSource
import com.android.systemui.keyboard.shortcut.data.source.MultitaskingShortcutsSource
import com.android.systemui.keyboard.shortcut.data.source.SystemShortcutsSource
import com.android.systemui.keyboard.shortcut.qualifiers.AccessibilityShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.AppCategoriesShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.CurrentAppShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.CustomShortcutCategories
@@ -67,6 +69,12 @@ interface ShortcutHelperModule {
        impl: AppCategoriesShortcutsSource
    ): KeyboardShortcutGroupsSource

    @Binds
    @AccessibilityShortcuts
    fun accessibilityShortcutsSource(
        impl: AccessibilityShortcutsSource
    ): KeyboardShortcutGroupsSource

    @Binds
    @DefaultShortcutCategories
    fun defaultShortcutCategoriesRepository(
+12 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.keyboard.shortcut.data.model.InternalKeyboardShortcutGroup
import com.android.systemui.keyboard.shortcut.data.model.InternalKeyboardShortcutInfo
import com.android.systemui.keyboard.shortcut.data.source.KeyboardShortcutGroupsSource
import com.android.systemui.keyboard.shortcut.qualifiers.AccessibilityShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.AppCategoriesShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.CurrentAppShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.InputShortcuts
@@ -30,6 +31,7 @@ import com.android.systemui.keyboard.shortcut.qualifiers.MultitaskingShortcuts
import com.android.systemui.keyboard.shortcut.qualifiers.SystemShortcuts
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategory
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.Accessibility
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.AppCategories
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.CurrentApp
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.InputMethodEditor
@@ -47,11 +49,12 @@ class DefaultShortcutCategoriesRepository
@Inject
constructor(
    @Background private val backgroundScope: CoroutineScope,
    @SystemShortcuts private val systemShortcutsSource: KeyboardShortcutGroupsSource,
    @MultitaskingShortcuts private val multitaskingShortcutsSource: KeyboardShortcutGroupsSource,
    @AppCategoriesShortcuts private val appCategoriesShortcutsSource: KeyboardShortcutGroupsSource,
    @InputShortcuts private val inputShortcutsSource: KeyboardShortcutGroupsSource,
    @CurrentAppShortcuts private val currentAppShortcutsSource: KeyboardShortcutGroupsSource,
    @SystemShortcuts systemShortcutsSource: KeyboardShortcutGroupsSource,
    @MultitaskingShortcuts multitaskingShortcutsSource: KeyboardShortcutGroupsSource,
    @AppCategoriesShortcuts appCategoriesShortcutsSource: KeyboardShortcutGroupsSource,
    @InputShortcuts inputShortcutsSource: KeyboardShortcutGroupsSource,
    @CurrentAppShortcuts currentAppShortcutsSource: KeyboardShortcutGroupsSource,
    @AccessibilityShortcuts accessibilityShortcutsSource: KeyboardShortcutGroupsSource,
    inputDeviceRepository: ShortcutHelperInputDeviceRepository,
    shortcutCategoriesUtils: ShortcutCategoriesUtils,
) : ShortcutCategoriesRepository {
@@ -71,6 +74,10 @@ constructor(
                source = inputShortcutsSource,
                typeProvider = { InputMethodEditor },
            ),
            InternalGroupsSource(
                source = accessibilityShortcutsSource,
                typeProvider = { Accessibility },
            ),
            InternalGroupsSource(
                source = currentAppShortcutsSource,
                typeProvider = { groups -> getCurrentAppShortcutCategoryType(groups) },
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.keyboard.shortcut.data.source

import android.content.res.Resources
import android.view.KeyboardShortcutGroup
import android.view.KeyboardShortcutInfo
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.res.R
import javax.inject.Inject

class AccessibilityShortcutsSource @Inject constructor(@Main private val resources: Resources) :
    KeyboardShortcutGroupsSource {
    override suspend fun shortcutGroups(deviceId: Int): List<KeyboardShortcutGroup> =
        listOf(
            KeyboardShortcutGroup(
                /* label= */ resources.getString(R.string.shortcutHelper_category_accessibility),
                accessibilityShortcuts(),
            )
        )

    private fun accessibilityShortcuts() = listOf<KeyboardShortcutInfo>()
}
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.keyboard.shortcut.qualifiers

import javax.inject.Qualifier

@Qualifier annotation class AccessibilityShortcuts
Loading