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

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

Merge "Add accessibility shortcuts to shortcut helper" into main

parents de996345 868add6d
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCommand
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutKey
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutSubCategory
import com.android.systemui.keyboard.shortcut.shortcutHelperAccessibilityShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperAppCategoriesShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperCurrentAppShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperInputShortcutsSource
@@ -88,6 +89,7 @@ class DefaultShortcutCategoriesRepositoryTest : SysuiTestCase() {
            it.shortcutHelperAppCategoriesShortcutsSource = fakeAppCategoriesSource
            it.shortcutHelperInputShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperCurrentAppShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperAccessibilityShortcutsSource = FakeKeyboardShortcutGroupsSource()
        }

    private val repo = kosmos.defaultShortcutCategoriesRepository
@@ -284,14 +286,20 @@ class DefaultShortcutCategoriesRepositoryTest : SysuiTestCase() {
            val categories by collectLastValue(repo.categories)

            val cycleForwardThroughRecentAppsShortcut =
                categories?.first { it.type == ShortcutCategoryType.MultiTasking }
                    ?.subCategories?.first { it.label == recentAppsGroup.label }
                    ?.shortcuts?.first { it.label == CYCLE_FORWARD_THROUGH_RECENT_APPS_SHORTCUT_LABEL }
                categories
                    ?.first { it.type == ShortcutCategoryType.MultiTasking }
                    ?.subCategories
                    ?.first { it.label == recentAppsGroup.label }
                    ?.shortcuts
                    ?.first { it.label == CYCLE_FORWARD_THROUGH_RECENT_APPS_SHORTCUT_LABEL }

            val cycleBackThroughRecentAppsShortcut =
                categories?.first { it.type == ShortcutCategoryType.MultiTasking }
                    ?.subCategories?.first { it.label == recentAppsGroup.label }
                    ?.shortcuts?.first { it.label == CYCLE_BACK_THROUGH_RECENT_APPS_SHORTCUT_LABEL }
                categories
                    ?.first { it.type == ShortcutCategoryType.MultiTasking }
                    ?.subCategories
                    ?.first { it.label == recentAppsGroup.label }
                    ?.shortcuts
                    ?.first { it.label == CYCLE_BACK_THROUGH_RECENT_APPS_SHORTCUT_LABEL }

            assertThat(cycleForwardThroughRecentAppsShortcut?.isCustomizable).isFalse()
            assertThat(cycleBackThroughRecentAppsShortcut?.isCustomizable).isFalse()
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategory
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.InputMethodEditor
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.MultiTasking
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.System
import com.android.systemui.keyboard.shortcut.shortcutHelperAccessibilityShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperAppCategoriesShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperCategoriesInteractor
import com.android.systemui.keyboard.shortcut.shortcutHelperCurrentAppShortcutsSource
@@ -76,6 +77,7 @@ class ShortcutHelperCategoriesInteractorTest : SysuiTestCase() {
            it.shortcutHelperMultiTaskingShortcutsSource = multitaskingShortcutsSource
            it.shortcutHelperAppCategoriesShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperCurrentAppShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperAccessibilityShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.userTracker = FakeUserTracker(onCreateCurrentUserContext = { mockUserContext })
        }

+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.keyboard.shortcut.data.source.FakeKeyboardShortcutGroupsSource
import com.android.systemui.keyboard.shortcut.data.source.TestShortcuts
import com.android.systemui.keyboard.shortcut.shortcutCustomizationDialogStarterFactory
import com.android.systemui.keyboard.shortcut.shortcutHelperAccessibilityShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperAppCategoriesShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperCurrentAppShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperInputShortcutsSource
@@ -66,6 +67,7 @@ class ShortcutHelperDialogStarterTest : SysuiTestCase() {
            it.testDispatcher = UnconfinedTestDispatcher()
            it.shortcutHelperSystemShortcutsSource = fakeSystemSource
            it.shortcutHelperMultiTaskingShortcutsSource = fakeMultiTaskingSource
            it.shortcutHelperAccessibilityShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperAppCategoriesShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperInputShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperCurrentAppShortcutsSource = FakeKeyboardShortcutGroupsSource()
+27 −23
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.System
import com.android.systemui.keyboard.shortcut.shared.model.ShortcutSubCategory
import com.android.systemui.keyboard.shortcut.shared.model.shortcut
import com.android.systemui.keyboard.shortcut.shortcutHelperAccessibilityShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperAppCategoriesShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperCurrentAppShortcutsSource
import com.android.systemui.keyboard.shortcut.shortcutHelperInputShortcutsSource
@@ -95,6 +96,7 @@ class ShortcutHelperViewModelTest : SysuiTestCase() {
            it.shortcutHelperMultiTaskingShortcutsSource = fakeMultiTaskingSource
            it.shortcutHelperAppCategoriesShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperInputShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperAccessibilityShortcutsSource = FakeKeyboardShortcutGroupsSource()
            it.shortcutHelperCurrentAppShortcutsSource = fakeCurrentAppsSource
            it.userTracker = FakeUserTracker(onCreateCurrentUserContext = { mockUserContext })
        }
@@ -112,9 +114,12 @@ class ShortcutHelperViewModelTest : SysuiTestCase() {
        fakeSystemSource.setGroups(TestShortcuts.systemGroups)
        fakeMultiTaskingSource.setGroups(TestShortcuts.multitaskingGroups)
        fakeCurrentAppsSource.setGroups(TestShortcuts.currentAppGroups)
        whenever(mockPackageManager.getApplicationInfo(anyString(), eq(0))).thenReturn(mockApplicationInfo)
        whenever(mockPackageManager.getApplicationLabel(mockApplicationInfo)).thenReturn("Current App")
        whenever(mockPackageManager.getApplicationIcon(anyString())).thenThrow(NameNotFoundException())
        whenever(mockPackageManager.getApplicationInfo(anyString(), eq(0)))
            .thenReturn(mockApplicationInfo)
        whenever(mockPackageManager.getApplicationLabel(mockApplicationInfo))
            .thenReturn("Current App")
        whenever(mockPackageManager.getApplicationIcon(anyString()))
            .thenThrow(NameNotFoundException())
        whenever(mockUserContext.packageManager).thenReturn(mockPackageManager)
        whenever(mockUserContext.getSystemService(INPUT_SERVICE)).thenReturn(inputManager)
    }
@@ -420,9 +425,8 @@ class ShortcutHelperViewModelTest : SysuiTestCase() {
    @Test
    fun shortcutsUiState_shouldShowResetButton_isTrueWhenThereAreCustomShortcuts() =
        testScope.runTest {
            whenever(
                inputManager.getCustomInputGestures(/* filter= */ InputGestureData.Filter.KEY)
            ).thenReturn(listOf(allAppsInputGestureData))
            whenever(inputManager.getCustomInputGestures(/* filter= */ InputGestureData.Filter.KEY))
                .thenReturn(listOf(allAppsInputGestureData))
            val uiState by collectLastValue(viewModel.shortcutsUiState)

            testHelper.showFromActivity()
+9 −0
Original line number Diff line number Diff line
@@ -2377,6 +2377,15 @@
    <!-- User visible title for the keyboard shortcut that takes the user to the maps app. [CHAR LIMIT=70] -->
    <string name="keyboard_shortcut_group_applications_maps">Maps</string>

    <!-- User visible title for the keyboard shortcut that toggles bounce keys. [CHAR LIMIT=70]-->
    <string name="group_accessibility_toggle_bounce_keys">Toggle bounce keys</string>
    <!-- User visible title for the keyboard shortcut that toggles mouse keys. [CHAR LIMIT=70]-->
    <string name="group_accessibility_toggle_mouse_keys">Toggle mouse keys</string>
    <!-- User visible title for the keyboard shortcut that toggles sticky keys. [CHAR LIMIT=70]-->
    <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>

    <!-- SysUI Tuner: Label for screen about do not disturb settings [CHAR LIMIT=60] -->
    <string name="volume_and_do_not_disturb">Do Not Disturb</string>

Loading