• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1The Accessibility Menu is an accessibility service
2that presents a large on-screen menu to control your Android device.
3This service can be enabled from the Accessibility page in the Settings app.
4You can control gestures, hardware buttons, navigation, and more. From the menu, you can:
5
6- Take screenshots
7- Lock your screen
8- Open the device's voice assistant
9- Open Quick Settings and Notifications
10- Turn volume up or down
11- Turn brightness up or down
12
13The UI consists of a `ViewPager` populated by multiple pages of shortcut buttons.
14In the settings for the menu, there is an option to display the buttons in a 3x3 grid per page,
15or a 2x2 grid with larger buttons.
16
17Upon activation, most buttons will close the menu while performing their function.
18The exception to this are buttons that adjust a value, like volume or brightness,
19where the user is likely to want to press the button multiple times.
20In addition, touching other parts of the screen or locking the phone through other means
21should dismiss the menu.
22
23A majority of the shortcuts correspond directly to an existing accessibility service global action
24(see `AccessibilityService#performGlobalAction()` constants) that is performed when pressed.
25Shortcuts that navigate to a different menu, such as Quick Settings, use an intent to do so.
26Shortcuts that adjust brightness or volume interface directly with
27`DisplayManager` & `AudioManager` respectively.
28
29To add a new shortcut:
30
311. Add a value for the new shortcut to the `ShortcutId` enum in `A11yMenuShortcut`.
322. Put an entry for the enum value into the `sShortcutResource` `HashMap` in `A11yMenuShortcut`.
33This will require resources for a drawable icon, a color for the icon,
34the displayed name of the shortcut and the desired text-to-speech output.
353. Add the enum value to the `SHORTCUT_LIST_DEFAULT` & `LARGE_SHORTCUT_LIST_DEFAULT` arrays
36in `A11yMenuOverlayLayout`.
374. For functionality, add a code block to the if-else chain in
38`AccessibilityMenuService.handleClick()`, detailing the effect of the shortcut.
39If you don't want the shortcut to close the menu,
40include a return statement at the end of the code block.
41