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

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

Add autoclick to shortcut features map

Bug: 390460480
Test: verified manually on test devices.
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: If6710459946ee5db13afd238378c5a38e84811c8
parent 93538ad7
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ public class AccessibilityShortcutController {
            new ComponentName("com.android.server.accessibility", "ReduceBrightColors");
    public static final ComponentName FONT_SIZE_COMPONENT_NAME =
            new ComponentName("com.android.server.accessibility", "FontSize");
    public static final ComponentName AUTOCLICK_COMPONENT_NAME =
            new ComponentName("com.android.server.accessibility", "Autoclick");

    // The component name for the sub setting of Accessibility button in Accessibility settings
    public static final ComponentName ACCESSIBILITY_BUTTON_COMPONENT_NAME =
@@ -163,7 +165,7 @@ public class AccessibilityShortcutController {
            getFrameworkShortcutFeaturesMap() {

        if (sFrameworkShortcutFeaturesMap == null) {
            Map<ComponentName, FrameworkFeatureInfo> featuresMap = new ArrayMap<>(4);
            Map<ComponentName, FrameworkFeatureInfo> featuresMap = new ArrayMap<>(8);
            featuresMap.put(COLOR_INVERSION_COMPONENT_NAME,
                    new ToggleableFrameworkFeatureInfo(
                            Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
@@ -174,6 +176,11 @@ public class AccessibilityShortcutController {
                            Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
                            "1" /* Value to enable */, "0" /* Value to disable */,
                            R.string.color_correction_feature_name));
            featuresMap.put(AUTOCLICK_COMPONENT_NAME,
                    new ToggleableFrameworkFeatureInfo(
                            Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED,
                            "1" /* Value to enable */, "0" /* Value to disable */,
                            R.string.autoclick_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
@@ -17,6 +17,7 @@
package com.android.internal.accessibility.dialog;

import static com.android.internal.accessibility.AccessibilityShortcutController.ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.AUTOCLICK_COMPONENT_NAME;
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;
@@ -214,6 +215,19 @@ public final class AccessibilityTargetHelper {
                        Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
        targets.add(colorInversion);

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

        if (SUPPORT_ONE_HANDED_MODE) {
            final ToggleAllowListingFeatureTarget oneHandedMode =
                    new ToggleAllowListingFeatureTarget(context,
+3 −0
Original line number Diff line number Diff line
@@ -4960,6 +4960,9 @@
    <!-- Title of hearing aids feature, shown in the warning dialog about the accessibility shortcut. [CHAR LIMIT=none] -->
    <string name="hearing_aids_feature_name">Hearing devices</string>
    <!-- Title of autoclick feature, shown in the warning dialog about the accessibility shortcut. [CHAR LIMIT=none] -->
    <string name="autoclick_feature_name">Autoclick</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
@@ -3787,6 +3787,7 @@
  <java-symbol type="string" name="accessibility_shortcut_disabling_service" />
  <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="reduce_bright_colors_feature_name" />
  <java-symbol type="string" name="config_defaultAccessibilityService" />
  <java-symbol type="string" name="config_defaultSelectToSpeakService" />