Merge "Support accessibility shortcut secondary action (8/n)"

This commit is contained in:
TreeHugger Robot
2020-01-17 01:10:53 +00:00
committed by Android (Google) Code Review
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;