Loading core/java/android/hardware/input/InputSettings.java +73 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware.input; import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import android.Manifest; import android.annotation.FloatRange; import android.annotation.NonNull; Loading Loading @@ -58,6 +60,11 @@ public class InputSettings { */ public static final float DEFAULT_MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH = .8f; /** * The maximum allowed Accessibility bounce keys threshold. * @hide */ public static final int MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS = 5000; private InputSettings() { } Loading Loading @@ -328,4 +335,70 @@ public class InputSettings { .getBoolean(com.android.internal.R.bool.config_enableStylusPointerIcon) || InputProperties.force_enable_stylus_pointer_icon().orElse(false); } /** * Whether Accessibility bounce keys is enabled. * * <p> * ‘Bounce keys’ is an accessibility feature to aid users who have physical disabilities, * that allows the user to configure the device to ignore rapid, repeated keypresses of the * same key. * </p> * * @hide */ public static boolean isAccessibilityBounceKeysEnabled(@NonNull Context context) { return getAccessibilityBounceKeysThreshold(context) != 0; } /** * Get Accessibility bounce keys threshold duration in milliseconds. * * <p> * ‘Bounce keys’ is an accessibility feature to aid users who have physical disabilities, * that allows the user to configure the device to ignore rapid, repeated keypresses of the * same key. * </p> * * @hide */ public static int getAccessibilityBounceKeysThreshold(@NonNull Context context) { if (!keyboardA11yBounceKeysFlag()) { return 0; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, 0, UserHandle.USER_CURRENT); } /** * Set Accessibility bounce keys threshold duration in milliseconds. * @param thresholdTimeMillis time duration for which a key down will be ignored after a * previous key up for the same key on the same device between 0 and * {@link MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS} * * <p> * ‘Bounce keys’ is an accessibility feature to aid users who have physical disabilities, * that allows the user to configure the device to ignore rapid, repeated keypresses of the * same key. * </p> * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setAccessibilityBounceKeysThreshold(@NonNull Context context, int thresholdTimeMillis) { if (!keyboardA11yBounceKeysFlag()) { return; } if (thresholdTimeMillis < 0 || thresholdTimeMillis > MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS) { throw new IllegalArgumentException( "Provided Bounce keys threshold should be in range [0, " + MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS + "]"); } Settings.System.putIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, thresholdTimeMillis, UserHandle.USER_CURRENT); } } core/java/android/hardware/input/input_framework.aconfig +6 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,12 @@ flag { bug: "294546335" } flag { namespace: "input_native" name: "keyboard_a11y_bounce_keys_flag" description: "Controls if the bounce keys accessibility feature for physical keyboard is available to the user" bug: "294546335" } flag { namespace: "input_native" Loading core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -7739,6 +7739,16 @@ public final class Settings { @SuppressLint("NoSettingsProvider") public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; /** * Whether to enable bounce keys for Physical Keyboard accessibility. * * If set to non-zero value, any key press on physical keyboard within the provided * threshold duration (in milliseconds) of the same key, will be ignored. * * @hide */ public static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys"; /** * Whether stylus button presses are disabled. This is a boolean that * determines if stylus buttons are ignored. Loading Loading @@ -12057,6 +12067,7 @@ public final class Settings { CLONE_TO_MANAGED_PROFILE.add(LOCATION_CHANGER); CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_BOUNCE_KEYS); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_BUBBLES); } Loading packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class SecureSettings { Settings.Secure.TTS_ENABLED_PLUGINS, Settings.Secure.TTS_DEFAULT_LOCALE, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global Loading packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.TTS_ENABLED_PLUGINS, new PackageNameListValidator(" ")); VALIDATORS.put(Secure.TTS_DEFAULT_LOCALE, TTS_LIST_VALIDATOR); VALIDATORS.put(Secure.SHOW_IME_WITH_HARD_KEYBOARD, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_BOUNCE_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT, NON_NEGATIVE_INTEGER_VALIDATOR); Loading Loading
core/java/android/hardware/input/InputSettings.java +73 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.hardware.input; import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import android.Manifest; import android.annotation.FloatRange; import android.annotation.NonNull; Loading Loading @@ -58,6 +60,11 @@ public class InputSettings { */ public static final float DEFAULT_MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH = .8f; /** * The maximum allowed Accessibility bounce keys threshold. * @hide */ public static final int MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS = 5000; private InputSettings() { } Loading Loading @@ -328,4 +335,70 @@ public class InputSettings { .getBoolean(com.android.internal.R.bool.config_enableStylusPointerIcon) || InputProperties.force_enable_stylus_pointer_icon().orElse(false); } /** * Whether Accessibility bounce keys is enabled. * * <p> * ‘Bounce keys’ is an accessibility feature to aid users who have physical disabilities, * that allows the user to configure the device to ignore rapid, repeated keypresses of the * same key. * </p> * * @hide */ public static boolean isAccessibilityBounceKeysEnabled(@NonNull Context context) { return getAccessibilityBounceKeysThreshold(context) != 0; } /** * Get Accessibility bounce keys threshold duration in milliseconds. * * <p> * ‘Bounce keys’ is an accessibility feature to aid users who have physical disabilities, * that allows the user to configure the device to ignore rapid, repeated keypresses of the * same key. * </p> * * @hide */ public static int getAccessibilityBounceKeysThreshold(@NonNull Context context) { if (!keyboardA11yBounceKeysFlag()) { return 0; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, 0, UserHandle.USER_CURRENT); } /** * Set Accessibility bounce keys threshold duration in milliseconds. * @param thresholdTimeMillis time duration for which a key down will be ignored after a * previous key up for the same key on the same device between 0 and * {@link MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS} * * <p> * ‘Bounce keys’ is an accessibility feature to aid users who have physical disabilities, * that allows the user to configure the device to ignore rapid, repeated keypresses of the * same key. * </p> * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setAccessibilityBounceKeysThreshold(@NonNull Context context, int thresholdTimeMillis) { if (!keyboardA11yBounceKeysFlag()) { return; } if (thresholdTimeMillis < 0 || thresholdTimeMillis > MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS) { throw new IllegalArgumentException( "Provided Bounce keys threshold should be in range [0, " + MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS + "]"); } Settings.System.putIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, thresholdTimeMillis, UserHandle.USER_CURRENT); } }
core/java/android/hardware/input/input_framework.aconfig +6 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,12 @@ flag { bug: "294546335" } flag { namespace: "input_native" name: "keyboard_a11y_bounce_keys_flag" description: "Controls if the bounce keys accessibility feature for physical keyboard is available to the user" bug: "294546335" } flag { namespace: "input_native" Loading
core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -7739,6 +7739,16 @@ public final class Settings { @SuppressLint("NoSettingsProvider") public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; /** * Whether to enable bounce keys for Physical Keyboard accessibility. * * If set to non-zero value, any key press on physical keyboard within the provided * threshold duration (in milliseconds) of the same key, will be ignored. * * @hide */ public static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys"; /** * Whether stylus button presses are disabled. This is a boolean that * determines if stylus buttons are ignored. Loading Loading @@ -12057,6 +12067,7 @@ public final class Settings { CLONE_TO_MANAGED_PROFILE.add(LOCATION_CHANGER); CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_BOUNCE_KEYS); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_BUBBLES); } Loading
packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class SecureSettings { Settings.Secure.TTS_ENABLED_PLUGINS, Settings.Secure.TTS_DEFAULT_LOCALE, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global Loading
packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.TTS_ENABLED_PLUGINS, new PackageNameListValidator(" ")); VALIDATORS.put(Secure.TTS_DEFAULT_LOCALE, TTS_LIST_VALIDATOR); VALIDATORS.put(Secure.SHOW_IME_WITH_HARD_KEYBOARD, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_BOUNCE_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT, NON_NEGATIVE_INTEGER_VALIDATOR); Loading