Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8f5867f authored by Yuhan Yang's avatar Yuhan Yang
Browse files

Add mouse key shortcut in settings map

Bug: 393568199
Test: manual verify on DUT
Flag: com.android.server.accessibility.enable_mouse_key_enhancement
Change-Id: Ibf4f3e61ee633128fd4cd3141774a7a1c89b140c
parent 4677f132
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ public class AccessibilityShortcutController {
            new ComponentName("com.android.server.accessibility", "FontSize");
    public static final ComponentName AUTOCLICK_COMPONENT_NAME =
            new ComponentName("com.android.server.accessibility", "Autoclick");
    public static final ComponentName MOUSE_KEYS_COMPONENT_NAME =
            new ComponentName("com.android.server.accessibility", "MouseKeys");

    // The component name for the sub setting of Accessibility button in Accessibility settings
    public static final ComponentName ACCESSIBILITY_BUTTON_COMPONENT_NAME =
@@ -182,6 +184,11 @@ public class AccessibilityShortcutController {
                            Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED,
                            "1" /* Value to enable */, "0" /* Value to disable */,
                            R.string.autoclick_feature_name));
            featuresMap.put(MOUSE_KEYS_COMPONENT_NAME,
                    new ToggleableFrameworkFeatureInfo(
                            Settings.Secure.ACCESSIBILITY_MOUSE_KEYS_ENABLED,
                             "1" /* Value to enable */, "0" /* Value to disable */,
                            R.string.mouse_keys_feature_name));
            if (SUPPORT_ONE_HANDED_MODE) {
                featuresMap.put(ONE_HANDED_COMPONENT_NAME,
                        new ToggleableFrameworkFeatureInfo(
+14 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.internal.accessibility.AccessibilityShortcutController
import static com.android.internal.accessibility.AccessibilityShortcutController.COLOR_INVERSION_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.DALTONIZER_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.MOUSE_KEYS_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.ONE_HANDED_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.REDUCE_BRIGHT_COLORS_COMPONENT_NAME;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE;
@@ -227,6 +228,19 @@ public final class AccessibilityTargetHelper {
                        Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED);
        targets.add(autoclick);

        // TODO(b/394683600): Update Icon with the mouse keys asset.
        final ToggleAllowListingFeatureTarget mouseKeys =
                new ToggleAllowListingFeatureTarget(context,
                        shortcutType,
                        isShortcutContained(context, shortcutType,
                                MOUSE_KEYS_COMPONENT_NAME.flattenToString()),
                        MOUSE_KEYS_COMPONENT_NAME.flattenToString(),
                        uid,
                        context.getString(R.string.autoclick_feature_name),
                        context.getDrawable(R.drawable.ic_accessibility_generic),
                        Settings.Secure.ACCESSIBILITY_MOUSE_KEYS_ENABLED);
        targets.add(mouseKeys);

        if (SUPPORT_ONE_HANDED_MODE) {
            final ToggleAllowListingFeatureTarget oneHandedMode =
                    new ToggleAllowListingFeatureTarget(context,
+3 −0
Original line number Diff line number Diff line
@@ -5015,6 +5015,9 @@
    <!-- Title of autoclick feature, shown in the warning dialog about the accessibility shortcut. [CHAR LIMIT=none] -->
    <string name="autoclick_feature_name">Autoclick</string>
    <!-- Title of mouse keys feature, shown in the warning dialog about the mouse keys shortcut. [CHAR LIMIT=none] -->
    <string name="mouse_keys_feature_name">Mouse keys</string>
    <!-- Text of hearing device disconnected state. [CHAR LIMIT=20] -->
    <string name="hearing_device_status_disconnected">Disconnected</string>
+1 −0
Original line number Diff line number Diff line
@@ -3816,6 +3816,7 @@
  <java-symbol type="string" name="color_inversion_feature_name" />
  <java-symbol type="string" name="color_correction_feature_name" />
  <java-symbol type="string" name="autoclick_feature_name"/>
  <java-symbol type="string" name="mouse_keys_feature_name"/>
  <java-symbol type="string" name="reduce_bright_colors_feature_name" />
  <java-symbol type="string" name="config_defaultAccessibilityService" />
  <java-symbol type="string" name="config_defaultSelectToSpeakService" />