1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.keyboard.shortcut.data.source
18 
19 import android.hardware.input.InputGestureData
20 import android.hardware.input.InputGestureData.createKeyTrigger
21 import android.hardware.input.KeyGestureEvent
22 import android.hardware.input.KeyGestureEvent.KEY_GESTURE_TYPE_ALL_APPS
23 import android.hardware.input.KeyGestureEvent.KEY_GESTURE_TYPE_HOME
24 import android.os.SystemClock
25 import android.view.KeyEvent
26 import android.view.KeyEvent.ACTION_DOWN
27 import android.view.KeyEvent.KEYCODE_A
28 import android.view.KeyEvent.META_ALT_ON
29 import android.view.KeyEvent.META_CTRL_ON
30 import android.view.KeyEvent.META_FUNCTION_ON
31 import android.view.KeyEvent.META_META_LEFT_ON
32 import android.view.KeyEvent.META_META_ON
33 import android.view.KeyEvent.META_SHIFT_ON
34 import android.view.KeyEvent.META_SHIFT_RIGHT_ON
35 import android.view.KeyEvent.META_SYM_ON
36 import android.view.KeyboardShortcutGroup
37 import android.view.KeyboardShortcutInfo
38 import com.android.systemui.keyboard.shortcut.data.repository.ShortcutHelperKeys
39 import com.android.systemui.keyboard.shortcut.shared.model.KeyCombination
40 import com.android.systemui.keyboard.shortcut.shared.model.Shortcut
41 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategory
42 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType
43 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.MultiTasking
44 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCategoryType.System
45 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCommand
46 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutCustomizationRequestInfo
47 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutKey
48 import com.android.systemui.keyboard.shortcut.shared.model.ShortcutSubCategory
49 import com.android.systemui.keyboard.shortcut.shared.model.shortcut
50 import com.android.systemui.keyboard.shortcut.shared.model.shortcutCategory
51 import com.android.systemui.res.R
52 
53 object TestShortcuts {
54 
55     private val shortcutInfoWithRepeatedLabel =
56         KeyboardShortcutInfo(
57             /* label = */ "Shortcut with repeated label",
58             /* keycode = */ KeyEvent.KEYCODE_H,
59             /* modifiers = */ META_META_ON,
60         )
61 
62     private val shortcutInfoWithRepeatedLabelAlternate =
63         KeyboardShortcutInfo(
64             /* label = */ shortcutInfoWithRepeatedLabel.label,
65             /* keycode = */ KeyEvent.KEYCODE_L,
66             /* modifiers = */ META_META_ON,
67         )
68 
69     private val shortcutInfoWithRepeatedLabelSecondAlternate =
70         KeyboardShortcutInfo(
71             /* label = */ shortcutInfoWithRepeatedLabel.label,
72             /* keycode = */ KeyEvent.KEYCODE_M,
73             /* modifiers = */ KeyEvent.META_SHIFT_ON,
74         )
75 
76     private val ShortcutsWithDiffSizeOfKeys =
77         KeyboardShortcutInfo(
78             /* label = */ "Shortcuts with diff size of keys",
79             /* keycode = */ KeyEvent.KEYCODE_HOME,
80             /* modifiers = */ 0,
81         )
82 
83     private val ShortcutsWithDiffSizeOfKeys2 =
84         KeyboardShortcutInfo(
85             /* label = */ ShortcutsWithDiffSizeOfKeys.label,
86             /* keycode = */ KeyEvent.KEYCODE_1,
87             /* modifiers = */ META_META_ON,
88         )
89 
90     private val ShortcutsWithDiffSizeOfKeys3 =
91         KeyboardShortcutInfo(
92             /* label = */ ShortcutsWithDiffSizeOfKeys.label,
93             /* keycode = */ KeyEvent.KEYCODE_2,
94             /* modifiers = */ META_META_ON or META_FUNCTION_ON,
95         )
96 
97     private val shortcutWithGroupedRepeatedLabel =
<lambda>null98         shortcut(shortcutInfoWithRepeatedLabel.label!!.toString()) {
99             command {
100                 key(R.drawable.ic_ksh_key_meta)
101                 key("H")
102             }
103             command {
104                 key(R.drawable.ic_ksh_key_meta)
105                 key("L")
106             }
107             command {
108                 key("Shift")
109                 key("M")
110             }
111             contentDescription {
112                 "${shortcutInfoWithRepeatedLabel.label}, " +
113                     "Press key Meta plus H, or Meta plus L, or Shift plus M"
114             }
115         }
116 
117     private val goHomeShortcutInfo =
118         KeyboardShortcutInfo(
119             /* label = */ "Go to home screen",
120             /* keycode = */ KeyEvent.KEYCODE_B,
121             /* modifiers = */ KeyEvent.META_CTRL_ON or KeyEvent.META_ALT_ON,
122         )
123 
124     private val standardShortcutInfo1 =
125         KeyboardShortcutInfo(
126             /* label = */ "Standard shortcut 1",
127             /* keycode = */ KeyEvent.KEYCODE_N,
128             /* modifiers = */ META_META_ON,
129         )
130 
131     const val CYCLE_FORWARD_THROUGH_RECENT_APPS_SHORTCUT_LABEL = "Cycle forward through recent apps"
132     const val CYCLE_BACK_THROUGH_RECENT_APPS_SHORTCUT_LABEL = "Cycle backward through recent apps"
133 
134     private val recentAppsCycleForwardShortcutInfo =
135         KeyboardShortcutInfo(
136             /* label = */ CYCLE_FORWARD_THROUGH_RECENT_APPS_SHORTCUT_LABEL,
137             /* keycode = */ KeyEvent.KEYCODE_N,
138             /* modifiers = */ META_META_ON,
139         )
140 
141     private val recentAppsCycleBackShortcutInfo =
142         KeyboardShortcutInfo(
143             /* label = */ CYCLE_BACK_THROUGH_RECENT_APPS_SHORTCUT_LABEL,
144             /* keycode = */ KeyEvent.KEYCODE_N,
145             /* modifiers = */ META_META_ON,
146         )
147 
148     private val recentAppsCycleForwardShortcut =
<lambda>null149         shortcut(recentAppsCycleForwardShortcutInfo.label!!.toString()) {
150             command {
151                 key(R.drawable.ic_ksh_key_meta)
152                 key("N")
153             }
154             isCustomizable = false
155         }
156 
157     private val recentAppsCycleBackShortcut =
<lambda>null158         shortcut(recentAppsCycleBackShortcutInfo.label!!.toString()) {
159             command {
160                 key(R.drawable.ic_ksh_key_meta)
161                 key("N")
162             }
163             isCustomizable = false
164         }
165 
166     private val standardShortcut1 =
<lambda>null167         shortcut(standardShortcutInfo1.label!!.toString()) {
168             command {
169                 key(R.drawable.ic_ksh_key_meta)
170                 key("N")
171             }
172             contentDescription { "${standardShortcutInfo1.label}, Press key Meta plus N" }
173         }
174 
175     private val customGoHomeShortcut =
<lambda>null176         shortcut("Go to home screen") {
177             command {
178                 key("Ctrl")
179                 key("Alt")
180                 key("A")
181                 isCustom(true)
182             }
183             contentDescription { "Go to home screen, Press key Ctrl plus Alt plus A" }
184         }
185 
186     private val standardShortcutInfo2 =
187         KeyboardShortcutInfo(
188             /* label = */ "Standard shortcut 2",
189             /* keycode = */ KeyEvent.KEYCODE_Z,
190             /* modifiers = */ KeyEvent.META_ALT_ON or KeyEvent.META_SHIFT_ON,
191         )
192 
193     private val standardShortcut2 =
<lambda>null194         shortcut(standardShortcutInfo2.label!!.toString()) {
195             command {
196                 key("Alt")
197                 key("Shift")
198                 key("Z")
199             }
200             contentDescription { "${standardShortcutInfo2.label}, Press key Alt plus Shift plus Z" }
201         }
202 
203     private val standardShortcutInfo3 =
204         KeyboardShortcutInfo(
205             /* label = */ "Standard shortcut 3",
206             /* keycode = */ KeyEvent.KEYCODE_J,
207             /* modifiers = */ KeyEvent.META_CTRL_ON,
208         )
209 
210     private val standardShortcut3 =
<lambda>null211         shortcut(standardShortcutInfo3.label!!.toString()) {
212             command {
213                 key("Ctrl")
214                 key("J")
215             }
216             contentDescription { "${standardShortcutInfo3.label}, Press key Ctrl plus J" }
217         }
218 
219     private val shortcutInfoWithUnsupportedModifiers =
220         KeyboardShortcutInfo(
221             /* label = */ "Shortcut with unsupported modifiers",
222             /* keycode = */ KeyEvent.KEYCODE_A,
223             /* modifiers = */ META_META_ON or KeyEvent.KEYCODE_SPACE,
224         )
225 
226     private val groupWithRepeatedShortcutLabels =
227         KeyboardShortcutGroup(
228             "Group with duplicate labels",
229             listOf(
230                 shortcutInfoWithRepeatedLabel,
231                 shortcutInfoWithRepeatedLabelAlternate,
232                 shortcutInfoWithRepeatedLabelSecondAlternate,
233             ),
234         )
235 
236     private val subCategoryWithGroupedRepeatedShortcutLabels =
237         ShortcutSubCategory(
238             label = groupWithRepeatedShortcutLabels.label!!.toString(),
239             shortcuts = listOf(shortcutWithGroupedRepeatedLabel),
240         )
241 
242     private val groupWithStandardShortcutInfo =
243         KeyboardShortcutGroup("Standard group", listOf(standardShortcutInfo1))
244 
245     val groupWithGoHomeShortcutInfo =
246         KeyboardShortcutGroup("System controls", listOf(goHomeShortcutInfo))
247 
248     private val subCategoryWithStandardShortcut =
249         ShortcutSubCategory(
250             label = groupWithStandardShortcutInfo.label!!.toString(),
251             shortcuts = listOf(standardShortcut1),
252         )
253 
254     private val groupWithOnlyUnsupportedModifierShortcut =
255         KeyboardShortcutGroup(
256             "Group with unsupported modifiers",
257             listOf(shortcutInfoWithUnsupportedModifiers),
258         )
259 
260     private val groupWithSupportedAndUnsupportedModifierShortcut =
261         KeyboardShortcutGroup(
262             "Group with mix of supported and not supported modifiers",
263             listOf(standardShortcutInfo3, shortcutInfoWithUnsupportedModifiers),
264         )
265 
266     private val switchToNextLanguageShortcut =
<lambda>null267         shortcut("Switch to next language") {
268             command {
269                 key("Ctrl")
270                 key("Space")
271             }
272             contentDescription { "Switch to next language, Press key Ctrl plus Space" }
273         }
274 
275     private val switchToPreviousLanguageShortcut =
<lambda>null276         shortcut("Switch to previous language") {
277             command {
278                 key("Ctrl")
279                 key("Shift")
280                 key("Space")
281             }
282             contentDescription {
283                 "Switch to previous language, Press key Ctrl plus Shift plus Space"
284             }
285         }
286 
287     private val subCategoryForInputLanguageSwitchShortcuts =
288         ShortcutSubCategory(
289             "Input",
290             listOf(switchToNextLanguageShortcut, switchToPreviousLanguageShortcut),
291         )
292 
293     private val subCategoryWithUnsupportedShortcutsRemoved =
294         ShortcutSubCategory(
295             groupWithSupportedAndUnsupportedModifierShortcut.label!!.toString(),
296             listOf(standardShortcut3),
297         )
298 
299     val recentAppsGroup =
300         KeyboardShortcutGroup(
301             "Recent apps",
302             listOf(recentAppsCycleForwardShortcutInfo, recentAppsCycleBackShortcutInfo),
303         )
304 
305     private val standardGroup1 =
306         KeyboardShortcutGroup(
307             "Standard group 1",
308             listOf(standardShortcutInfo1, standardShortcutInfo2, standardShortcutInfo3),
309         )
310 
311     private val standardPackageName1 = "standard.app.group1"
312 
313     private val standardAppGroup1 =
314         KeyboardShortcutGroup(
315                 "Standard app group 1",
316                 listOf(standardShortcutInfo1, standardShortcutInfo2, standardShortcutInfo3),
317             )
<lambda>null318             .apply { packageName = standardPackageName1 }
319 
320     private val standardSystemAppSubcategoryWithCustomHomeShortcut =
321         ShortcutSubCategory("System controls", listOf(customGoHomeShortcut))
322 
323     private val recentAppsSubCategory =
324         ShortcutSubCategory(
325             recentAppsGroup.label!!.toString(),
326             listOf(recentAppsCycleForwardShortcut, recentAppsCycleBackShortcut),
327         )
328 
329     private val standardSubCategory1 =
330         ShortcutSubCategory(
331             standardGroup1.label!!.toString(),
332             listOf(standardShortcut1, standardShortcut2, standardShortcut3),
333         )
334 
335     private val standardGroup2 =
336         KeyboardShortcutGroup(
337             "Standard group 2",
338             listOf(standardShortcutInfo3, standardShortcutInfo2, standardShortcutInfo1),
339         )
340 
341     private val standardSubCategory2 =
342         ShortcutSubCategory(
343             standardGroup2.label!!.toString(),
344             listOf(standardShortcut3, standardShortcut2, standardShortcut1),
345         )
346     private val standardGroup3 =
347         KeyboardShortcutGroup(
348             "Standard group 3",
349             listOf(standardShortcutInfo2, standardShortcutInfo1),
350         )
351 
352     private val standardSubCategory3 =
353         ShortcutSubCategory(
354             standardGroup3.label!!.toString(),
355             listOf(standardShortcut2, standardShortcut1),
356         )
357 
358     private val systemSubCategoryWithGoHomeShortcuts =
359         ShortcutSubCategory(
360             label = "System controls",
361             shortcuts =
362                 listOf(
<lambda>null363                     shortcut("Go to home screen") {
364                         command {
365                             key("Ctrl")
366                             key("Alt")
367                             key("B")
368                         }
369                         command {
370                             key("Ctrl")
371                             key("Alt")
372                             key("A")
373                             isCustom(true)
374                         }
375                         contentDescription {
376                             "Go to home screen, Press key Ctrl plus Alt plus B, " +
377                                 "or Ctrl plus Alt plus A"
378                         }
379                     }
380                 ),
381         )
382 
383     val imeGroups = listOf(standardGroup1, standardGroup2, standardGroup3)
384     val imeCategory =
385         ShortcutCategory(
386             type = ShortcutCategoryType.InputMethodEditor,
387             subCategories =
388                 listOf(
389                     subCategoryForInputLanguageSwitchShortcuts,
390                     standardSubCategory1,
391                     standardSubCategory2,
392                     standardSubCategory3,
393                 ),
394         )
395 
396     val currentAppGroups = listOf(standardAppGroup1)
397     val currentAppPackageName = standardPackageName1
398 
399     val systemGroups = listOf(standardGroup3, standardGroup2, standardGroup1)
400     val systemCategory =
401         ShortcutCategory(
402             type = System,
403             subCategories = listOf(standardSubCategory3, standardSubCategory2, standardSubCategory1),
404         )
405 
406     val systemCategoryWithMergedGoHomeShortcut =
407         ShortcutCategory(
408             type = System,
409             subCategories = listOf(systemSubCategoryWithGoHomeShortcuts),
410         )
411 
412     val systemCategoryWithCustomHomeShortcut =
413         ShortcutCategory(
414             type = System,
415             subCategories =
416                 listOf(
417                     standardSubCategory3,
418                     standardSubCategory2,
419                     standardSubCategory1,
420                     standardSystemAppSubcategoryWithCustomHomeShortcut,
421                 ),
422         )
423 
424     val multitaskingCategoryWithRecentAppsGroup =
425         ShortcutCategory(type = MultiTasking, subCategories = listOf(recentAppsSubCategory))
426 
427     val multitaskingGroups = listOf(standardGroup2, standardGroup1)
428     val multitaskingCategory =
429         ShortcutCategory(
430             type = MultiTasking,
431             subCategories = listOf(standardSubCategory2, standardSubCategory1),
432         )
433 
434     val groupsWithDuplicateShortcutLabels =
435         listOf(groupWithRepeatedShortcutLabels, groupWithStandardShortcutInfo)
436 
437     val subCategoriesWithGroupedDuplicatedShortcutLabels =
438         listOf(subCategoryWithGroupedRepeatedShortcutLabels, subCategoryWithStandardShortcut)
439 
440     val imeSubCategoriesWithGroupedDuplicatedShortcutLabels =
441         listOf(
442             subCategoryForInputLanguageSwitchShortcuts,
443             subCategoryWithGroupedRepeatedShortcutLabels,
444             subCategoryWithStandardShortcut,
445         )
446 
447     val groupsWithUnsupportedModifier =
448         listOf(
449             groupWithStandardShortcutInfo,
450             groupWithOnlyUnsupportedModifierShortcut,
451             groupWithSupportedAndUnsupportedModifierShortcut,
452         )
453 
454     val groupWithDifferentSizeOfShortcutKeys =
455         KeyboardShortcutGroup(
456             "Group with different size of shortcut keys",
457             listOf(
458                 ShortcutsWithDiffSizeOfKeys3,
459                 ShortcutsWithDiffSizeOfKeys,
460                 ShortcutsWithDiffSizeOfKeys2,
461             ),
462         )
463 
464     val subCategoriesWithUnsupportedModifiersRemoved =
465         listOf(subCategoryWithStandardShortcut, subCategoryWithUnsupportedShortcutsRemoved)
466 
467     val imeSubCategoriesWithUnsupportedModifiersRemoved =
468         listOf(
469             subCategoryForInputLanguageSwitchShortcuts,
470             subCategoryWithStandardShortcut,
471             subCategoryWithUnsupportedShortcutsRemoved,
472         )
473 
474     val groupsWithOnlyUnsupportedModifiers = listOf(groupWithOnlyUnsupportedModifierShortcut)
475 
simpleInputGestureDatanull476     private fun simpleInputGestureData(
477         keyCode: Int = KeyEvent.KEYCODE_A,
478         modifiers: Int = KeyEvent.META_CTRL_ON or KeyEvent.META_ALT_ON,
479         keyGestureType: Int,
480     ): InputGestureData {
481         val builder = InputGestureData.Builder()
482         builder.setKeyGestureType(keyGestureType)
483         builder.setTrigger(createKeyTrigger(keyCode, modifiers))
484         return builder.build()
485     }
486 
simpleShortcutCategorynull487     private fun simpleShortcutCategory(
488         category: ShortcutCategoryType,
489         subcategoryLabel: String,
490         shortcutLabel: String,
491         includeInCustomization: Boolean = true,
492     ): ShortcutCategory {
493         return ShortcutCategory(
494             type = category,
495             subCategories =
496                 listOf(
497                     ShortcutSubCategory(
498                         label = subcategoryLabel,
499                         shortcuts = listOf(simpleShortcut(shortcutLabel, includeInCustomization)),
500                     )
501                 ),
502         )
503     }
504 
simpleShortcutnull505     private fun simpleShortcut(label: String, includeInCustomization: Boolean = true) =
506         Shortcut(
507             label = label,
508             commands =
509                 listOf(
510                     ShortcutCommand(
511                         isCustom = true,
512                         keys =
513                             listOf(
514                                 ShortcutKey.Text("Ctrl"),
515                                 ShortcutKey.Text("Alt"),
516                                 ShortcutKey.Text("A"),
517                             ),
518                     )
519                 ),
520             isCustomizable = includeInCustomization,
521         )
522 
523     val customizableInputGestureWithUnknownKeyGestureType =
524         // These key gesture events are currently not supported by shortcut helper customizer
525         listOf(
526             simpleInputGestureData(
527                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_GLOBAL_ACTIONS
528             ),
529             simpleInputGestureData(keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_MEDIA_KEY),
530         )
531 
532     val expectedShortcutCategoriesWithSimpleShortcutCombination =
533         listOf(
534             simpleShortcutCategory(System, "System apps", "Open assistant"),
535             simpleShortcutCategory(System, "System controls", "Go to home screen"),
536             simpleShortcutCategory(System, "System apps", "Open settings"),
537             simpleShortcutCategory(System, "System controls", "Lock screen"),
538             simpleShortcutCategory(System, "System controls", "View notifications"),
539             simpleShortcutCategory(System, "System apps", "Take a note"),
540             simpleShortcutCategory(System, "System controls", "Take screenshot"),
541             simpleShortcutCategory(System, "System controls", "Go back"),
542             simpleShortcutCategory(
543                 MultiTasking,
544                 "Split screen",
545                 "Switch to full screen",
546             ),
547             simpleShortcutCategory(
548                 MultiTasking,
549                 "Split screen",
550                 "Use split screen with app on the left",
551             ),
552             simpleShortcutCategory(
553                 MultiTasking,
554                 "Split screen",
555                 "Use split screen with app on the right",
556             ),
557             simpleShortcutCategory(System, "System controls", "Show shortcuts"),
558             simpleShortcutCategory(System, "System controls", "View recent apps"),
559         )
560     val customInputGestureTypeHome = simpleInputGestureData(keyGestureType = KEY_GESTURE_TYPE_HOME)
561 
562     val allCustomizableInputGesturesWithSimpleShortcutCombinations =
563         listOf(
564             simpleInputGestureData(
565                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_ASSISTANT
566             ),
567             simpleInputGestureData(keyGestureType = KEY_GESTURE_TYPE_HOME),
568             simpleInputGestureData(
569                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_SYSTEM_SETTINGS
570             ),
571             simpleInputGestureData(keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_LOCK_SCREEN),
572             simpleInputGestureData(
573                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_TOGGLE_NOTIFICATION_PANEL
574             ),
575             simpleInputGestureData(keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_OPEN_NOTES),
576             simpleInputGestureData(
577                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_TAKE_SCREENSHOT
578             ),
579             simpleInputGestureData(keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_BACK),
580             simpleInputGestureData(
581                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION
582             ),
583             simpleInputGestureData(
584                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION_LEFT
585             ),
586             simpleInputGestureData(
587                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_SPLIT_SCREEN_NAVIGATION_RIGHT
588             ),
589             simpleInputGestureData(
590                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_OPEN_SHORTCUT_HELPER
591             ),
592             simpleInputGestureData(keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_RECENT_APPS),
593             simpleInputGestureData(
594                 keyGestureType = KeyGestureEvent.KEY_GESTURE_TYPE_RECENT_APPS_SWITCHER
595             ),
596         )
597 
598     val allAppsShortcutAddRequest =
599         ShortcutCustomizationRequestInfo.Add(
600             label = "Open apps list",
601             categoryType = System,
602             subCategoryLabel = "System controls",
603         )
604 
605     val allAppsShortcutDeleteRequest =
606         ShortcutCustomizationRequestInfo.Delete(
607             label = "Open apps list",
608             categoryType = System,
609             subCategoryLabel = "System controls",
610         )
611 
612     val standardKeyCombination =
613         KeyCombination(
614             modifiers = META_META_ON or META_SHIFT_ON or META_META_LEFT_ON or META_SHIFT_RIGHT_ON,
615             keyCode = KEYCODE_A,
616         )
617 
618     const val ALL_SUPPORTED_MODIFIERS =
619         META_META_ON or
620             META_CTRL_ON or
621             META_FUNCTION_ON or
622             META_SHIFT_ON or
623             META_ALT_ON or
624             META_SYM_ON
625 
626     val allAppsInputGestureData: InputGestureData =
627         InputGestureData.Builder()
628             .setKeyGestureType(KEY_GESTURE_TYPE_ALL_APPS)
629             .setTrigger(
630                 createKeyTrigger(
631                     /* keycode = */ standardKeyCombination.keyCode!!,
632                     /* modifierState = */ standardKeyCombination.modifiers and
633                         ALL_SUPPORTED_MODIFIERS,
634                 )
635             )
636             .build()
637 
638     val goHomeInputGestureData: InputGestureData =
639         InputGestureData.Builder()
640             .setKeyGestureType(KEY_GESTURE_TYPE_HOME)
641             .setTrigger(
642                 createKeyTrigger(
643                     /* keycode = */ standardKeyCombination.keyCode!!,
644                     /* modifierState = */ standardKeyCombination.modifiers and
645                         ALL_SUPPORTED_MODIFIERS,
646                 )
647             )
648             .build()
649 
650     val allAppsShortcutCategory =
651         shortcutCategory(System) {
652             subCategory("System controls") {
653                 shortcut("Open apps list") {
654                     command {
655                         isCustom(true)
656                         key(ShortcutHelperKeys.metaModifierIconResId)
657                         key("Shift")
658                         key("A")
659                     }
660                 }
661             }
662         }
663 
664     val keyDownEventWithoutActionKeyPressed =
665         androidx.compose.ui.input.key.KeyEvent(
666             android.view.KeyEvent(
667                 /* downTime = */ SystemClock.uptimeMillis(),
668                 /* eventTime = */ SystemClock.uptimeMillis(),
669                 /* action = */ ACTION_DOWN,
670                 /* code = */ KEYCODE_A,
671                 /* repeat = */ 0,
672                 /* metaState = */ META_CTRL_ON,
673             )
674         )
675 
676     val keyDownEventWithActionKeyPressed =
677         androidx.compose.ui.input.key.KeyEvent(
678             android.view.KeyEvent(
679                 /* downTime = */ SystemClock.uptimeMillis(),
680                 /* eventTime = */ SystemClock.uptimeMillis(),
681                 /* action = */ ACTION_DOWN,
682                 /* code = */ KEYCODE_A,
683                 /* repeat = */ 0,
684                 /* metaState = */ META_CTRL_ON or META_META_ON,
685             )
686         )
687 
688     val keyUpEventWithActionKeyPressed =
689         androidx.compose.ui.input.key.KeyEvent(
690             android.view.KeyEvent(
691                 /* downTime = */ SystemClock.uptimeMillis(),
692                 /* eventTime = */ SystemClock.uptimeMillis(),
693                 /* action = */ ACTION_DOWN,
694                 /* code = */ KEYCODE_A,
695                 /* repeat = */ 0,
696                 /* metaState = */ 0,
697             )
698         )
699 
700     val standardAddShortcutRequest =
701         ShortcutCustomizationRequestInfo.Add(
702             label = "Standard shortcut",
703             categoryType = System,
704             subCategoryLabel = "Standard subcategory",
705         )
706 }
707