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

Commit 16f8bd72 authored by David Padlipsky's avatar David Padlipsky Committed by Android (Google) Code Review
Browse files

Merge changes from topic "select-to-speak-key-gesture" into main

* changes:
  Implement key gesture to activate Select to Speak
  Implement magnification toggle keyboard shortcut
parents 7639344e 1a239822
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ public final class KeyGestureEvent {
    public static final int KEY_GESTURE_TYPE_RESTORE_FREEFORM_WINDOW_SIZE = 71;
    public static final int KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_IN = 72;
    public static final int KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_OUT = 73;
    public static final int KEY_GESTURE_TYPE_TOGGLE_MAGNIFICATION = 74;
    public static final int KEY_GESTURE_TYPE_ACTIVATE_SELECT_TO_SPEAK = 75;

    public static final int FLAG_CANCELLED = 1;

@@ -207,6 +209,8 @@ public final class KeyGestureEvent {
            KEY_GESTURE_TYPE_RESTORE_FREEFORM_WINDOW_SIZE,
            KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_IN,
            KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_OUT,
            KEY_GESTURE_TYPE_TOGGLE_MAGNIFICATION,
            KEY_GESTURE_TYPE_ACTIVATE_SELECT_TO_SPEAK,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface KeyGestureType {
@@ -781,6 +785,10 @@ public final class KeyGestureEvent {
                return "KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_IN";
            case KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_OUT:
                return "KEY_GESTURE_TYPE_MAGNIFIER_ZOOM_OUT";
            case KEY_GESTURE_TYPE_TOGGLE_MAGNIFICATION:
                return "KEY_GESTURE_TYPE_TOGGLE_MAGNIFICATION";
            case KEY_GESTURE_TYPE_ACTIVATE_SELECT_TO_SPEAK:
                return "KEY_GESTURE_TYPE_ACTIVATE_SELECT_TO_SPEAK";
            default:
                return Integer.toHexString(value);
        }
+8 −2
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ public final class ShortcutConstants {
     * quickly tapping screen 2 times with two fingers as preferred shortcut.
     * {@code QUICK_SETTINGS} for displaying specifying the accessibility services or features which
     * choose Quick Settings as preferred shortcut.
     * {@code KEY_GESTURE} for shortcuts which are directly from key gestures and should be
     * activated always.
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
@@ -73,6 +75,7 @@ public final class ShortcutConstants {
            UserShortcutType.TWOFINGER_DOUBLETAP,
            UserShortcutType.QUICK_SETTINGS,
            UserShortcutType.GESTURE,
            UserShortcutType.KEY_GESTURE,
            UserShortcutType.ALL
    })
    public @interface UserShortcutType {
@@ -84,8 +87,10 @@ public final class ShortcutConstants {
        int TWOFINGER_DOUBLETAP = 1 << 3;
        int QUICK_SETTINGS = 1 << 4;
        int GESTURE = 1 << 5;
        int KEY_GESTURE = 1 << 6;
        // LINT.ThenChange(:shortcut_type_array)
        int ALL = SOFTWARE | HARDWARE | TRIPLETAP | TWOFINGER_DOUBLETAP | QUICK_SETTINGS | GESTURE;
        int ALL = SOFTWARE | HARDWARE | TRIPLETAP | TWOFINGER_DOUBLETAP | QUICK_SETTINGS | GESTURE
                | KEY_GESTURE;
    }

    /**
@@ -99,7 +104,8 @@ public final class ShortcutConstants {
            UserShortcutType.TRIPLETAP,
            UserShortcutType.TWOFINGER_DOUBLETAP,
            UserShortcutType.QUICK_SETTINGS,
            UserShortcutType.GESTURE
            UserShortcutType.GESTURE,
            UserShortcutType.KEY_GESTURE
            // LINT.ThenChange(:shortcut_type_intdef)
    };

+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.internal.accessibility.common.ShortcutConstants.SERVIC
import static com.android.internal.accessibility.common.ShortcutConstants.USER_SHORTCUT_TYPES;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.GESTURE;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.HARDWARE;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.KEY_GESTURE;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.QUICK_SETTINGS;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.TRIPLETAP;
@@ -187,6 +188,7 @@ public final class ShortcutUtils {
            case TWOFINGER_DOUBLETAP ->
                    Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED;
            case QUICK_SETTINGS -> Settings.Secure.ACCESSIBILITY_QS_TARGETS;
            case KEY_GESTURE -> Settings.Secure.ACCESSIBILITY_KEY_GESTURE_TARGETS;
            default -> throw new IllegalArgumentException(
                    "Unsupported user shortcut type: " + type);
        };
@@ -209,6 +211,7 @@ public final class ShortcutUtils {
                    TRIPLETAP;
            case Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED ->
                    TWOFINGER_DOUBLETAP;
            case Settings.Secure.ACCESSIBILITY_KEY_GESTURE_TARGETS -> KEY_GESTURE;
            default -> throw new IllegalArgumentException(
                    "Unsupported user shortcut key: " + key);
        };
+5 −0
Original line number Diff line number Diff line
@@ -4596,6 +4596,11 @@
         exists on the device, the accessibility shortcut will be disabled by default. -->
    <string name="config_defaultAccessibilityService" translatable="false"></string>

    <!-- The component name, flattened to a string, for the default select to speak service to be
         enabled by the accessibility keyboard shortcut. If the service with the specified component
         name is not preinstalled then this shortcut will do nothing. -->
    <string name="config_defaultSelectToSpeakService" translatable="false"></string>

    <!-- URI for default Accessibility notification sound when to enable accessibility shortcut. -->
    <string name="config_defaultAccessibilityNotificationSound" translatable="false"></string>

+1 −0
Original line number Diff line number Diff line
@@ -3718,6 +3718,7 @@
  <java-symbol type="string" name="color_correction_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" />
  <java-symbol type="string" name="config_defaultAccessibilityNotificationSound" />
  <java-symbol type="string" name="accessibility_shortcut_spoken_feedback" />
  <java-symbol type="array" name="config_trustedAccessibilityServices" />
Loading