Loading core/java/android/hardware/input/InputSettings.java +87 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.hardware.input; package android.hardware.input; import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import static com.android.hardware.input.Flags.keyboardA11ySlowKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag; import static com.android.input.flags.Flags.enableInputFilterRustImpl; import static com.android.input.flags.Flags.enableInputFilterRustImpl; Loading Loading @@ -68,6 +69,12 @@ public class InputSettings { */ */ public static final int MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS = 5000; public static final int MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS = 5000; /** * The maximum allowed Accessibility slow keys threshold. * @hide */ public static final int MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS = 5000; private InputSettings() { private InputSettings() { } } Loading Loading @@ -418,6 +425,86 @@ public class InputSettings { UserHandle.USER_CURRENT); UserHandle.USER_CURRENT); } } /** * Whether Accessibility slow keys feature flags is enabled. * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ public static boolean isAccessibilitySlowKeysFeatureFlagEnabled() { return keyboardA11ySlowKeysFlag() && enableInputFilterRustImpl(); } /** * Whether Accessibility slow keys is enabled. * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ public static boolean isAccessibilitySlowKeysEnabled(@NonNull Context context) { return getAccessibilitySlowKeysThreshold(context) != 0; } /** * Get Accessibility slow keys threshold duration in milliseconds. * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ public static int getAccessibilitySlowKeysThreshold(@NonNull Context context) { if (!isAccessibilitySlowKeysFeatureFlagEnabled()) { return 0; } return Settings.Secure.getIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_SLOW_KEYS, 0, UserHandle.USER_CURRENT); } /** * Set Accessibility slow keys threshold duration in milliseconds. * @param thresholdTimeMillis time duration for which a key should be pressed to be registered * in the system. The threshold must be between 0 and * {@link MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS} * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setAccessibilitySlowKeysThreshold(@NonNull Context context, int thresholdTimeMillis) { if (!isAccessibilitySlowKeysFeatureFlagEnabled()) { return; } if (thresholdTimeMillis < 0 || thresholdTimeMillis > MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS) { throw new IllegalArgumentException( "Provided Slow keys threshold should be in range [0, " + MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS + "]"); } Settings.Secure.putIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_SLOW_KEYS, thresholdTimeMillis, UserHandle.USER_CURRENT); } /** /** * Whether Accessibility sticky keys feature is enabled. * Whether Accessibility sticky keys feature is enabled. * * Loading core/java/android/hardware/input/input_framework.aconfig +7 −0 Original line number Original line Diff line number Diff line Loading @@ -30,3 +30,10 @@ flag { description: "Makes MotionEvent.PointerCoords#isResampled() a public API" description: "Makes MotionEvent.PointerCoords#isResampled() a public API" bug: "298197511" bug: "298197511" } } flag { namespace: "input_native" name: "keyboard_a11y_slow_keys_flag" description: "Controls if the slow keys accessibility feature for physical keyboard is available to the user" bug: "294546335" } No newline at end of file core/java/android/provider/Settings.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -7880,6 +7880,17 @@ public final class Settings { */ */ public static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys"; public static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys"; /** * Whether to enable slow keys for Physical Keyboard accessibility. * * If set to non-zero value, any key press on physical keyboard needs to be pressed and * held for the provided threshold duration (in milliseconds) to be registered in the * system. * * @hide */ public static final String ACCESSIBILITY_SLOW_KEYS = "accessibility_slow_keys"; /** /** * Whether to enable sticky keys for Physical Keyboard accessibility. * Whether to enable sticky keys for Physical Keyboard accessibility. * * Loading Loading @@ -12276,6 +12287,8 @@ public final class Settings { CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD); CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_BOUNCE_KEYS); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_BOUNCE_KEYS); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_SLOW_KEYS); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_STICKY_KEYS); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_BUBBLES); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_BUBBLES); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_HISTORY_ENABLED); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_HISTORY_ENABLED); } } Loading packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class SecureSettings { Settings.Secure.TTS_DEFAULT_LOCALE, Settings.Secure.TTS_DEFAULT_LOCALE, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, Settings.Secure.ACCESSIBILITY_SLOW_KEYS, Settings.Secure.ACCESSIBILITY_STICKY_KEYS, Settings.Secure.ACCESSIBILITY_STICKY_KEYS, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global Loading packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -120,6 +120,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.TTS_DEFAULT_LOCALE, TTS_LIST_VALIDATOR); VALIDATORS.put(Secure.TTS_DEFAULT_LOCALE, TTS_LIST_VALIDATOR); VALIDATORS.put(Secure.SHOW_IME_WITH_HARD_KEYBOARD, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.SHOW_IME_WITH_HARD_KEYBOARD, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_BOUNCE_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_BOUNCE_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_SLOW_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_STICKY_KEYS, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_STICKY_KEYS, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, BOOLEAN_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_NETWORKS_AVAILABLE_REPEAT_DELAY, NON_NEGATIVE_INTEGER_VALIDATOR); Loading Loading
core/java/android/hardware/input/InputSettings.java +87 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.hardware.input; package android.hardware.input; import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import static com.android.hardware.input.Flags.keyboardA11ySlowKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag; import static com.android.input.flags.Flags.enableInputFilterRustImpl; import static com.android.input.flags.Flags.enableInputFilterRustImpl; Loading Loading @@ -68,6 +69,12 @@ public class InputSettings { */ */ public static final int MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS = 5000; public static final int MAX_ACCESSIBILITY_BOUNCE_KEYS_THRESHOLD_MILLIS = 5000; /** * The maximum allowed Accessibility slow keys threshold. * @hide */ public static final int MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS = 5000; private InputSettings() { private InputSettings() { } } Loading Loading @@ -418,6 +425,86 @@ public class InputSettings { UserHandle.USER_CURRENT); UserHandle.USER_CURRENT); } } /** * Whether Accessibility slow keys feature flags is enabled. * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ public static boolean isAccessibilitySlowKeysFeatureFlagEnabled() { return keyboardA11ySlowKeysFlag() && enableInputFilterRustImpl(); } /** * Whether Accessibility slow keys is enabled. * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ public static boolean isAccessibilitySlowKeysEnabled(@NonNull Context context) { return getAccessibilitySlowKeysThreshold(context) != 0; } /** * Get Accessibility slow keys threshold duration in milliseconds. * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ public static int getAccessibilitySlowKeysThreshold(@NonNull Context context) { if (!isAccessibilitySlowKeysFeatureFlagEnabled()) { return 0; } return Settings.Secure.getIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_SLOW_KEYS, 0, UserHandle.USER_CURRENT); } /** * Set Accessibility slow keys threshold duration in milliseconds. * @param thresholdTimeMillis time duration for which a key should be pressed to be registered * in the system. The threshold must be between 0 and * {@link MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS} * * <p> * 'Slow keys' is an accessibility feature to aid users who have physical disabilities, that * allows the user to specify the duration for which one must press-and-hold a key before the * system accepts the keypress. * </p> * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setAccessibilitySlowKeysThreshold(@NonNull Context context, int thresholdTimeMillis) { if (!isAccessibilitySlowKeysFeatureFlagEnabled()) { return; } if (thresholdTimeMillis < 0 || thresholdTimeMillis > MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS) { throw new IllegalArgumentException( "Provided Slow keys threshold should be in range [0, " + MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS + "]"); } Settings.Secure.putIntForUser(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_SLOW_KEYS, thresholdTimeMillis, UserHandle.USER_CURRENT); } /** /** * Whether Accessibility sticky keys feature is enabled. * Whether Accessibility sticky keys feature is enabled. * * Loading
core/java/android/hardware/input/input_framework.aconfig +7 −0 Original line number Original line Diff line number Diff line Loading @@ -30,3 +30,10 @@ flag { description: "Makes MotionEvent.PointerCoords#isResampled() a public API" description: "Makes MotionEvent.PointerCoords#isResampled() a public API" bug: "298197511" bug: "298197511" } } flag { namespace: "input_native" name: "keyboard_a11y_slow_keys_flag" description: "Controls if the slow keys accessibility feature for physical keyboard is available to the user" bug: "294546335" } No newline at end of file
core/java/android/provider/Settings.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -7880,6 +7880,17 @@ public final class Settings { */ */ public static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys"; public static final String ACCESSIBILITY_BOUNCE_KEYS = "accessibility_bounce_keys"; /** * Whether to enable slow keys for Physical Keyboard accessibility. * * If set to non-zero value, any key press on physical keyboard needs to be pressed and * held for the provided threshold duration (in milliseconds) to be registered in the * system. * * @hide */ public static final String ACCESSIBILITY_SLOW_KEYS = "accessibility_slow_keys"; /** /** * Whether to enable sticky keys for Physical Keyboard accessibility. * Whether to enable sticky keys for Physical Keyboard accessibility. * * Loading Loading @@ -12276,6 +12287,8 @@ public final class Settings { CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE); CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD); CLONE_TO_MANAGED_PROFILE.add(SHOW_IME_WITH_HARD_KEYBOARD); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_BOUNCE_KEYS); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_BOUNCE_KEYS); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_SLOW_KEYS); CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_STICKY_KEYS); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_BUBBLES); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_BUBBLES); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_HISTORY_ENABLED); CLONE_TO_MANAGED_PROFILE.add(NOTIFICATION_HISTORY_ENABLED); } } Loading
packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class SecureSettings { Settings.Secure.TTS_DEFAULT_LOCALE, Settings.Secure.TTS_DEFAULT_LOCALE, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS, Settings.Secure.ACCESSIBILITY_SLOW_KEYS, Settings.Secure.ACCESSIBILITY_STICKY_KEYS, Settings.Secure.ACCESSIBILITY_STICKY_KEYS, Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global Loading
packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -120,6 +120,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.TTS_DEFAULT_LOCALE, TTS_LIST_VALIDATOR); VALIDATORS.put(Secure.TTS_DEFAULT_LOCALE, TTS_LIST_VALIDATOR); VALIDATORS.put(Secure.SHOW_IME_WITH_HARD_KEYBOARD, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.SHOW_IME_WITH_HARD_KEYBOARD, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_BOUNCE_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_BOUNCE_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_SLOW_KEYS, ANY_INTEGER_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_STICKY_KEYS, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_STICKY_KEYS, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, BOOLEAN_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_NETWORKS_AVAILABLE_REPEAT_DELAY, NON_NEGATIVE_INTEGER_VALIDATOR); Loading