Support accessibility shortcut secondary action (8/n)

Integrate with the multiple shortcut selections and change the behavior as below:
- Get the shortcut type from system provider or shared_prefs if this is first time to use.
- Update the shared_prefs for what user seen.

Bug: 142530063
Bug: 142531156
Test: make RunSettingsRoboTests2
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityUtilTest
Change-Id: I58aeb960e2c4aa0bc2432be34c1372c0de89117a
This commit is contained in:
menghanli
2020-01-15 10:41:51 +08:00
parent 5f4fadb949
commit 5d0f336fec
6 changed files with 181 additions and 83 deletions

View File

@@ -142,6 +142,29 @@ public final class AccessibilityUtilTest {
DUMMY_COMPONENT_NAME)).isTrue();
}
@Test
public void getUserShortcutTypeFromSettings_putOneValue_hasValue() {
putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, DUMMY_COMPONENT_NAME.flattenToString());
final int shortcutType = AccessibilityUtil.getUserShortcutTypesFromSettings(mContext,
DUMMY_COMPONENT_NAME);
assertThat(
(shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE).isTrue();
}
@Test
public void getUserShortcutTypeFromSettings_putTwoValues_hasValue() {
putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, DUMMY_COMPONENT_NAME.flattenToString());
putStringIntoSettings(HARDWARE_SHORTCUT_KEY, DUMMY_COMPONENT_NAME.flattenToString());
final int shortcutType = AccessibilityUtil.getUserShortcutTypesFromSettings(mContext,
DUMMY_COMPONENT_NAME);
assertThat(
(shortcutType & UserShortcutType.SOFTWARE) == UserShortcutType.SOFTWARE).isTrue();
assertThat(
(shortcutType & UserShortcutType.HARDWARE) == UserShortcutType.HARDWARE).isTrue();
}
@Test
public void optInAllValuesToSettings_optInValue_haveMatchString() {
int shortcutTypes = UserShortcutType.SOFTWARE | UserShortcutType.HARDWARE;