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

Commit a0aa5686 authored by Nergi Rahardi's avatar Nergi Rahardi
Browse files

Adds KeyRepeat info as a configurable setting.

- Listen to setting update.
- Propagate keyrepeat info to InputDispatcher
- Removes notifyKeyGestureTimeoutsChanged in favor of pushing
config changes directly.
- Implemented backward compatibility for key_repeat_timeout.
This defaults the value to long_press_timeout if key_repeat_timeout
was not set.

Bug: 251050590
Test: atest inputflinger_tests
Change-Id: I455011ed83b336e17601479d9ee0ce78597176b5
parent 3eb06511
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -8537,6 +8537,18 @@ public final class Settings {
        @Readable
        public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout";
        /**
         * The duration before a key repeat begins in milliseconds.
         * @hide
         */
        public static final String KEY_REPEAT_TIMEOUT_MS = "key_repeat_timeout";
        /**
         * The duration between successive key repeats in milliseconds.
         * @hide
         */
        public static final String KEY_REPEAT_DELAY_MS = "key_repeat_delay";
        /**
         * Setting that specifies recommended timeout in milliseconds for controls
         * which don't need user's interactions.
+9 −4
Original line number Diff line number Diff line
@@ -85,9 +85,9 @@ public class ViewConfiguration {
    private static final int DEFAULT_MULTI_PRESS_TIMEOUT = 300;

    /**
     * Defines the time between successive key repeats in milliseconds.
     * Defines the default duration between successive key repeats in milliseconds.
     */
    private static final int KEY_REPEAT_DELAY = 50;
    private static final int DEFAULT_KEY_REPEAT_DELAY_MS = 50;

    /**
     * Defines the duration in milliseconds a user needs to hold down the
@@ -669,14 +669,19 @@ public class ViewConfiguration {
     * @return the time before the first key repeat in milliseconds.
     */
    public static int getKeyRepeatTimeout() {
        return getLongPressTimeout();
        // Before the key repeat timeout was introduced, some users relied on changing
        // LONG_PRESS_TIMEOUT settings to also change the key repeat timeout. To support
        // this backward compatibility, we'll use the long press timeout as default value.
        return AppGlobals.getIntCoreSetting(Settings.Secure.KEY_REPEAT_TIMEOUT_MS,
                getLongPressTimeout());
    }

    /**
     * @return the time between successive key repeats in milliseconds.
     */
    public static int getKeyRepeatDelay() {
        return KEY_REPEAT_DELAY;
        return AppGlobals.getIntCoreSetting(Settings.Secure.KEY_REPEAT_DELAY_MS,
                DEFAULT_KEY_REPEAT_DELAY_MS);
    }

    /**
+3 −1
Original line number Diff line number Diff line
@@ -374,6 +374,8 @@ message SecureSettingsProto {
    optional SettingProto lock_to_app_exit_locked = 33 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto lockdown_in_power_menu = 34 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto long_press_timeout = 35 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto key_press_timeout_ms = 96 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto key_press_delay_ms = 97 [ (android.privacy).dest = DEST_AUTOMATIC ];

    message ManagedProfile {
        option (android.msg_privacy).dest = DEST_EXPLICIT;
@@ -705,5 +707,5 @@ message SecureSettingsProto {

    // Please insert fields in alphabetical order and group them into messages
    // if possible (to avoid reaching the method limit).
    // Next tag = 96;
    // Next tag = 98;
}
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ public class SecureSettings {
        Settings.Secure.DOUBLE_TAP_TO_WAKE,
        Settings.Secure.WAKE_GESTURE_ENABLED,
        Settings.Secure.LONG_PRESS_TIMEOUT,
        Settings.Secure.KEY_REPEAT_TIMEOUT_MS,
        Settings.Secure.KEY_REPEAT_DELAY_MS,
        Settings.Secure.CAMERA_GESTURE_DISABLED,
        Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED,
        Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,8 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.DOUBLE_TAP_TO_WAKE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.WAKE_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LONG_PRESS_TIMEOUT, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.KEY_REPEAT_TIMEOUT_MS, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.KEY_REPEAT_DELAY_MS, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.CAMERA_GESTURE_DISABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ACCESSIBILITY_AUTOCLICK_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ACCESSIBILITY_AUTOCLICK_DELAY, NON_NEGATIVE_INTEGER_VALIDATOR);
Loading