Fixed crashes due to HSUM issues

+ moved model conversion logic from UI layer to Domain layer
+ replaced default context (system) with current user context

Fix: 369425977
Test: Manual - open shortcut helper from Chrome on HSUM enabled device,
ensure device doesn't crash
Flag: com.android.systemui.keyboard_shortcut_helper_rewrite

Change-Id: Ifb9f0b6a193953190fa77a0b7865f6131f74a38d
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
index 3c8bb09..901eafa 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/composable/ShortcutHelper.kt
@@ -16,10 +16,7 @@
 
 package com.android.systemui.keyboard.shortcut.ui.composable
 
-import android.content.Context
-import android.content.pm.PackageManager.NameNotFoundException
 import android.graphics.drawable.Icon
-import android.util.Log
 import androidx.compose.animation.AnimatedVisibility
 import androidx.compose.animation.core.animateFloatAsState
 import androidx.compose.foundation.Image
@@ -55,12 +52,8 @@
 import androidx.compose.foundation.verticalScroll
 import androidx.compose.material.icons.Icons
 import androidx.compose.material.icons.automirrored.filled.OpenInNew
-import androidx.compose.material.icons.filled.Apps
 import androidx.compose.material.icons.filled.ExpandMore
-import androidx.compose.material.icons.filled.Keyboard
 import androidx.compose.material.icons.filled.Search
-import androidx.compose.material.icons.filled.Tv
-import androidx.compose.material.icons.filled.VerticalSplit
 import androidx.compose.material3.CenterAlignedTopAppBar
 import androidx.compose.material3.ExperimentalMaterial3Api
 import androidx.compose.material3.HorizontalDivider
@@ -111,16 +104,15 @@
 import com.android.compose.modifiers.thenIf
 import com.android.compose.ui.graphics.painter.rememberDrawablePainter
 import com.android.systemui.keyboard.shortcut.shared.model.Shortcut as ShortcutModel
-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.ShortcutCommand
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutIcon
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutKey
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutSubCategory
 import com.android.systemui.keyboard.shortcut.ui.model.IconSource
+import com.android.systemui.keyboard.shortcut.ui.model.ShortcutCategoryUi
 import com.android.systemui.keyboard.shortcut.ui.model.ShortcutsUiState
 import com.android.systemui.res.R
-import com.android.systemui.statusbar.phone.CentralSurfaces
 
 @Composable
 fun ShortcutHelper(
@@ -187,7 +179,7 @@
 private fun ShortcutHelperSinglePane(
     searchQuery: String,
     onSearchQueryChanged: (String) -> Unit,
-    categories: List<ShortcutCategory>,
+    categories: List<ShortcutCategoryUi>,
     selectedCategoryType: ShortcutCategoryType?,
     onCategorySelected: (ShortcutCategoryType?) -> Unit,
     onKeyboardSettingsClicked: () -> Unit,
@@ -228,7 +220,7 @@
 @Composable
 private fun CategoriesPanelSinglePane(
     searchQuery: String,
-    categories: List<ShortcutCategory>,
+    categories: List<ShortcutCategoryUi>,
     selectedCategoryType: ShortcutCategoryType?,
     onCategorySelected: (ShortcutCategoryType?) -> Unit,
 ) {
@@ -267,7 +259,7 @@
 @Composable
 private fun CategoryItemSinglePane(
     searchQuery: String,
-    category: ShortcutCategory,
+    category: ShortcutCategoryUi,
     isExpanded: Boolean,
     onClick: () -> Unit,
     shape: Shape,
@@ -278,9 +270,9 @@
                 verticalAlignment = Alignment.CenterVertically,
                 modifier = Modifier.fillMaxWidth().heightIn(min = 88.dp).padding(horizontal = 16.dp),
             ) {
-                ShortcutCategoryIcon(modifier = Modifier.size(24.dp), source = category.icon)
+                ShortcutCategoryIcon(modifier = Modifier.size(24.dp), source = category.iconSource)
                 Spacer(modifier = Modifier.width(16.dp))
-                Text(category.label(LocalContext.current))
+                Text(category.label)
                 Spacer(modifier = Modifier.weight(1f))
                 RotatingExpandCollapseIcon(isExpanded)
             }
@@ -291,23 +283,6 @@
     }
 }
 
-private val ShortcutCategory.icon: IconSource
-    @Composable
-    get() =
-        when (type) {
-            ShortcutCategoryType.System -> IconSource(imageVector = Icons.Default.Tv)
-            ShortcutCategoryType.MultiTasking ->
-                IconSource(imageVector = Icons.Default.VerticalSplit)
-            ShortcutCategoryType.InputMethodEditor ->
-                IconSource(imageVector = Icons.Default.Keyboard)
-            ShortcutCategoryType.AppCategories -> IconSource(imageVector = Icons.Default.Apps)
-            is ShortcutCategoryType.CurrentApp -> {
-                val context = LocalContext.current
-                val iconDrawable = context.packageManager.getApplicationIcon(type.packageName)
-                IconSource(painter = rememberDrawablePainter(drawable = iconDrawable))
-            }
-        }
-
 @Composable
 fun ShortcutCategoryIcon(
     source: IconSource,
@@ -322,37 +297,6 @@
     }
 }
 
-private fun ShortcutCategory.label(context: Context): String =
-    when (type) {
-        ShortcutCategoryType.System -> context.getString(R.string.shortcut_helper_category_system)
-        ShortcutCategoryType.MultiTasking ->
-            context.getString(R.string.shortcut_helper_category_multitasking)
-        ShortcutCategoryType.InputMethodEditor ->
-            context.getString(R.string.shortcut_helper_category_input)
-        ShortcutCategoryType.AppCategories ->
-            context.getString(R.string.shortcut_helper_category_app_shortcuts)
-        is ShortcutCategoryType.CurrentApp -> getApplicationLabelForCurrentApp(type, context)
-    }
-
-private fun getApplicationLabelForCurrentApp(
-    type: ShortcutCategoryType.CurrentApp,
-    context: Context,
-): String {
-    val packageManagerForUser = CentralSurfaces.getPackageManagerForUser(context, context.userId)
-    return try {
-        val currentAppInfo =
-            packageManagerForUser.getApplicationInfoAsUser(
-                type.packageName,
-                /* flags = */ 0,
-                context.userId,
-            )
-        packageManagerForUser.getApplicationLabel(currentAppInfo).toString()
-    } catch (e: NameNotFoundException) {
-        Log.wtf(ShortcutHelper.TAG, "Couldn't find app info by package name ${type.packageName}")
-        context.getString(R.string.shortcut_helper_category_current_app_shortcuts)
-    }
-}
-
 @Composable
 private fun RotatingExpandCollapseIcon(isExpanded: Boolean) {
     val expandIconRotationDegrees by
@@ -384,7 +328,7 @@
 }
 
 @Composable
-private fun ShortcutCategoryDetailsSinglePane(searchQuery: String, category: ShortcutCategory) {
+private fun ShortcutCategoryDetailsSinglePane(searchQuery: String, category: ShortcutCategoryUi) {
     Column(Modifier.padding(horizontal = 16.dp)) {
         category.subCategories.fastForEach { subCategory ->
             ShortcutSubCategorySinglePane(searchQuery, subCategory)
@@ -409,7 +353,7 @@
     searchQuery: String,
     onSearchQueryChanged: (String) -> Unit,
     modifier: Modifier = Modifier,
-    categories: List<ShortcutCategory>,
+    categories: List<ShortcutCategoryUi>,
     selectedCategoryType: ShortcutCategoryType?,
     onCategorySelected: (ShortcutCategoryType?) -> Unit,
     onKeyboardSettingsClicked: () -> Unit,
@@ -434,7 +378,7 @@
 }
 
 @Composable
-private fun EndSidePanel(searchQuery: String, modifier: Modifier, category: ShortcutCategory?) {
+private fun EndSidePanel(searchQuery: String, modifier: Modifier, category: ShortcutCategoryUi?) {
     val listState = rememberLazyListState()
     LaunchedEffect(key1 = category) { if (category != null) listState.animateScrollToItem(0) }
     if (category == null) {
@@ -670,10 +614,10 @@
 private fun StartSidePanel(
     onSearchQueryChanged: (String) -> Unit,
     modifier: Modifier,
-    categories: List<ShortcutCategory>,
+    categories: List<ShortcutCategoryUi>,
     onKeyboardSettingsClicked: () -> Unit,
     selectedCategory: ShortcutCategoryType?,
-    onCategoryClicked: (ShortcutCategory) -> Unit,
+    onCategoryClicked: (ShortcutCategoryUi) -> Unit,
 ) {
     Column(modifier) {
         ShortcutsSearchBar(onSearchQueryChanged)
@@ -690,15 +634,15 @@
 
 @Composable
 private fun CategoriesPanelTwoPane(
-    categories: List<ShortcutCategory>,
+    categories: List<ShortcutCategoryUi>,
     selectedCategory: ShortcutCategoryType?,
-    onCategoryClicked: (ShortcutCategory) -> Unit,
+    onCategoryClicked: (ShortcutCategoryUi) -> Unit,
 ) {
     Column {
         categories.fastForEach {
             CategoryItemTwoPane(
-                label = it.label(LocalContext.current),
-                iconSource = it.icon,
+                label = it.label,
+                iconSource = it.iconSource,
                 selected = selectedCategory == it.type,
                 onClick = { onCategoryClicked(it) },
             )
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutCategoryUi.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutCategoryUi.kt
new file mode 100644
index 0000000..f5d478b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutCategoryUi.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2024 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.ui.model
+
+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.ShortcutSubCategory
+
+data class ShortcutCategoryUi(
+    val label: String,
+    val iconSource: IconSource,
+    val type: ShortcutCategoryType,
+    val subCategories: List<ShortcutSubCategory>,
+) {
+    constructor(
+        label: String,
+        iconSource: IconSource,
+        shortcutCategory: ShortcutCategory,
+    ) : this(label, iconSource, shortcutCategory.type, shortcutCategory.subCategories)
+}
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutsUiState.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutsUiState.kt
index d2122b3..8f23261 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutsUiState.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/model/ShortcutsUiState.kt
@@ -16,14 +16,13 @@
 
 package com.android.systemui.keyboard.shortcut.ui.model
 
-import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategory
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType
 
 sealed interface ShortcutsUiState {
 
     data class Active(
         val searchQuery: String,
-        val shortcutCategories: List<ShortcutCategory>,
+        val shortcutCategories: List<ShortcutCategoryUi>,
         val defaultSelectedCategory: ShortcutCategoryType?,
     ) : ShortcutsUiState
 
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModel.kt
index 04aa04d..20d09ed 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModel.kt
@@ -17,6 +17,15 @@
 package com.android.systemui.keyboard.shortcut.ui.viewmodel
 
 import android.app.role.RoleManager
+import android.content.pm.PackageManager.NameNotFoundException
+import android.util.Log
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Android
+import androidx.compose.material.icons.filled.Apps
+import androidx.compose.material.icons.filled.Keyboard
+import androidx.compose.material.icons.filled.Tv
+import androidx.compose.material.icons.filled.VerticalSplit
+import com.android.compose.ui.graphics.painter.DrawablePainter
 import com.android.systemui.dagger.qualifiers.Background
 import com.android.systemui.keyboard.shortcut.domain.interactor.ShortcutHelperCategoriesInteractor
 import com.android.systemui.keyboard.shortcut.domain.interactor.ShortcutHelperStateInteractor
@@ -25,7 +34,10 @@
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.CurrentApp
 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutSubCategory
+import com.android.systemui.keyboard.shortcut.ui.model.IconSource
+import com.android.systemui.keyboard.shortcut.ui.model.ShortcutCategoryUi
 import com.android.systemui.keyboard.shortcut.ui.model.ShortcutsUiState
+import com.android.systemui.res.R
 import com.android.systemui.settings.UserTracker
 import javax.inject.Inject
 import kotlinx.coroutines.CoroutineDispatcher
@@ -51,6 +63,7 @@
 ) {
 
     private val searchQuery = MutableStateFlow("")
+    private val userContext = userTracker.createCurrentUserContext(userTracker.userContext)
 
     val shouldShow =
         categoriesInteractor.shortcutCategories
@@ -68,9 +81,10 @@
                     val categoriesWithLauncherExcluded = excludeLauncherApp(categories)
                     val filteredCategories =
                         filterCategoriesBySearchQuery(query, categoriesWithLauncherExcluded)
+                    val shortcutCategoriesUi = convertCategoriesModelToUiModel(filteredCategories)
                     ShortcutsUiState.Active(
                         searchQuery = query,
-                        shortcutCategories = filteredCategories,
+                        shortcutCategories = shortcutCategoriesUi,
                         defaultSelectedCategory = getDefaultSelectedCategory(filteredCategories),
                     )
                 }
@@ -78,9 +92,73 @@
             .stateIn(
                 scope = backgroundScope,
                 started = SharingStarted.Lazily,
-                initialValue = ShortcutsUiState.Inactive
+                initialValue = ShortcutsUiState.Inactive,
             )
 
+    private fun convertCategoriesModelToUiModel(
+        categories: List<ShortcutCategory>
+    ): List<ShortcutCategoryUi> {
+        return categories.map { category ->
+            ShortcutCategoryUi(
+                label = getShortcutCategoryLabel(category.type),
+                iconSource = getShortcutCategoryIcon(category.type),
+                shortcutCategory = category,
+            )
+        }
+    }
+
+    private fun getShortcutCategoryIcon(type: ShortcutCategoryType): IconSource {
+        return when (type) {
+            ShortcutCategoryType.System -> IconSource(imageVector = Icons.Default.Tv)
+            ShortcutCategoryType.MultiTasking ->
+                IconSource(imageVector = Icons.Default.VerticalSplit)
+            ShortcutCategoryType.InputMethodEditor ->
+                IconSource(imageVector = Icons.Default.Keyboard)
+            ShortcutCategoryType.AppCategories -> IconSource(imageVector = Icons.Default.Apps)
+            is CurrentApp -> {
+                try {
+                    val iconDrawable =
+                        userContext.packageManager.getApplicationIcon(type.packageName)
+                    IconSource(painter = DrawablePainter(drawable = iconDrawable))
+                } catch (e: NameNotFoundException) {
+                    Log.wtf(
+                        "ShortcutHelperViewModel",
+                        "Package not found when retrieving icon for ${type.packageName}",
+                    )
+                    IconSource(imageVector = Icons.Default.Android)
+                }
+            }
+        }
+    }
+
+    private fun getShortcutCategoryLabel(type: ShortcutCategoryType): String =
+        when (type) {
+            ShortcutCategoryType.System ->
+                userContext.getString(R.string.shortcut_helper_category_system)
+            ShortcutCategoryType.MultiTasking ->
+                userContext.getString(R.string.shortcut_helper_category_multitasking)
+            ShortcutCategoryType.InputMethodEditor ->
+                userContext.getString(R.string.shortcut_helper_category_input)
+            ShortcutCategoryType.AppCategories ->
+                userContext.getString(R.string.shortcut_helper_category_app_shortcuts)
+            is CurrentApp -> getApplicationLabelForCurrentApp(type)
+        }
+
+    private fun getApplicationLabelForCurrentApp(type: CurrentApp): String {
+        try {
+            val packageManagerForUser = userContext.packageManager
+            val currentAppInfo =
+                packageManagerForUser.getApplicationInfo(type.packageName, /* flags= */ 0)
+            return packageManagerForUser.getApplicationLabel(currentAppInfo).toString()
+        } catch (e: NameNotFoundException) {
+            Log.wtf(
+                "ShortcutHelperViewModel",
+                "Package Not found when retrieving Label for ${type.packageName}",
+            )
+            return "Current App"
+        }
+    }
+
     private suspend fun excludeLauncherApp(
         categories: List<ShortcutCategory>
     ): List<ShortcutCategory> {
@@ -111,7 +189,7 @@
 
     private fun filterCategoriesBySearchQuery(
         query: String,
-        categories: List<ShortcutCategory>
+        categories: List<ShortcutCategory>,
     ): List<ShortcutCategory> {
         val lowerCaseTrimmedQuery = query.trim().lowercase()
         if (lowerCaseTrimmedQuery.isEmpty()) {
@@ -132,7 +210,7 @@
 
     private fun filterSubCategoriesBySearchQuery(
         subCategories: List<ShortcutSubCategory>,
-        query: String
+        query: String,
     ) =
         subCategories
             .map { subCategory ->
diff --git a/packages/SystemUI/src/com/android/systemui/settings/UserContextProvider.kt b/packages/SystemUI/src/com/android/systemui/settings/UserContextProvider.kt
index dae8512..258befe 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/UserContextProvider.kt
+++ b/packages/SystemUI/src/com/android/systemui/settings/UserContextProvider.kt
@@ -18,15 +18,19 @@
 
 import android.content.Context
 
-/**
- * Implemented by [UserTrackerImpl].
- */
+/** Implemented by [UserTrackerImpl]. */
 interface UserContextProvider {
+    /**
+     * provides system context, not current user context.
+     *
+     * To get current user context use [createCurrentUserContext] passing [userContext] as context
+     */
     val userContext: Context
 
     /**
      * Creates the {@code context} with the current user.
+     *
      * @see Context#createContextAsUser(UserHandle, int)
      */
     fun createCurrentUserContext(context: Context): Context
-}
\ No newline at end of file
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt
index 6b60740..7383faf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyboard/shortcut/ui/viewmodel/ShortcutHelperViewModelTest.kt
@@ -21,6 +21,9 @@
 import android.view.KeyEvent
 import android.view.KeyboardShortcutGroup
 import android.view.KeyboardShortcutInfo
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Tv
+import androidx.compose.material.icons.filled.VerticalSplit
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
 import com.android.systemui.SysuiTestCase
@@ -41,13 +44,17 @@
 import com.android.systemui.keyboard.shortcut.shortcutHelperSystemShortcutsSource
 import com.android.systemui.keyboard.shortcut.shortcutHelperTestHelper
 import com.android.systemui.keyboard.shortcut.shortcutHelperViewModel
+import com.android.systemui.keyboard.shortcut.ui.model.IconSource
+import com.android.systemui.keyboard.shortcut.ui.model.ShortcutCategoryUi
 import com.android.systemui.keyboard.shortcut.ui.model.ShortcutsUiState
 import com.android.systemui.kosmos.Kosmos
 import com.android.systemui.kosmos.testCase
 import com.android.systemui.kosmos.testDispatcher
 import com.android.systemui.kosmos.testScope
 import com.android.systemui.model.sysUiState
+import com.android.systemui.settings.FakeUserTracker
 import com.android.systemui.settings.fakeUserTracker
+import com.android.systemui.settings.userTracker
 import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SHORTCUT_HELPER_SHOWING
 import com.android.systemui.util.mockito.whenever
 import com.google.common.truth.Truth.assertThat
@@ -76,6 +83,7 @@
             it.shortcutHelperAppCategoriesShortcutsSource = FakeKeyboardShortcutGroupsSource()
             it.shortcutHelperInputShortcutsSource = FakeKeyboardShortcutGroupsSource()
             it.shortcutHelperCurrentAppShortcutsSource = fakeCurrentAppsSource
+            it.userTracker = FakeUserTracker(onCreateCurrentUserContext = { context })
         }
 
     private val testScope = kosmos.testScope
@@ -253,7 +261,7 @@
             whenever(
                     mockRoleManager.getRoleHoldersAsUser(
                         RoleManager.ROLE_HOME,
-                        fakeUserTracker.userHandle
+                        fakeUserTracker.userHandle,
                     )
                 )
                 .thenReturn(listOf(TestShortcuts.currentAppPackageName))
@@ -283,15 +291,25 @@
             val activeUiState = uiState as ShortcutsUiState.Active
             assertThat(activeUiState.shortcutCategories)
                 .containsExactly(
-                    ShortcutCategory(
-                        System,
-                        subCategoryWithShortcutLabels("first Foo shortcut1"),
-                        subCategoryWithShortcutLabels("second foO shortcut2")
+                    ShortcutCategoryUi(
+                        label = "System",
+                        iconSource = IconSource(imageVector = Icons.Default.Tv),
+                        shortcutCategory =
+                            ShortcutCategory(
+                                System,
+                                subCategoryWithShortcutLabels("first Foo shortcut1"),
+                                subCategoryWithShortcutLabels("second foO shortcut2"),
+                            ),
                     ),
-                    ShortcutCategory(
-                        MultiTasking,
-                        subCategoryWithShortcutLabels("third FoO shortcut1")
-                    )
+                    ShortcutCategoryUi(
+                        label = "Multitasking",
+                        iconSource = IconSource(imageVector = Icons.Default.VerticalSplit),
+                        shortcutCategory =
+                            ShortcutCategory(
+                                MultiTasking,
+                                subCategoryWithShortcutLabels("third FoO shortcut1"),
+                            ),
+                    ),
                 )
         }
 
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyboard/shortcut/KeyboardShortcutHelperKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyboard/shortcut/KeyboardShortcutHelperKosmos.kt
index fbfaba6..c41493e 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyboard/shortcut/KeyboardShortcutHelperKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyboard/shortcut/KeyboardShortcutHelperKosmos.kt
@@ -41,7 +41,7 @@
 import com.android.systemui.kosmos.testScope
 import com.android.systemui.model.sysUiState
 import com.android.systemui.settings.displayTracker
-import com.android.systemui.settings.fakeUserTracker
+import com.android.systemui.settings.userTracker
 
 var Kosmos.shortcutHelperAppCategoriesShortcutsSource: KeyboardShortcutGroupsSource by
     Kosmos.Fixture { AppCategoriesShortcutsSource(windowManager, testDispatcher) }
@@ -114,7 +114,7 @@
     Kosmos.Fixture {
         ShortcutHelperViewModel(
             mockRoleManager,
-            fakeUserTracker,
+            userTracker,
             applicationCoroutineScope,
             testDispatcher,
             shortcutHelperStateInteractor,