Loading core/java/android/hardware/input/InputSettings.java +51 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag; import static com.android.hardware.input.Flags.mouseScrollingAcceleration; import static com.android.hardware.input.Flags.mouseReverseVerticalScrolling; import static com.android.hardware.input.Flags.mouseSwapPrimaryButton; import static com.android.hardware.input.Flags.pointerAcceleration; import static com.android.hardware.input.Flags.touchpadSystemGestureDisable; import static com.android.hardware.input.Flags.touchpadThreeFingerTapShortcut; import static com.android.hardware.input.Flags.touchpadVisualizer; Loading Loading @@ -417,6 +418,15 @@ public class InputSettings { return mouseSwapPrimaryButton(); } /** * Returns true if the feature flag for the pointer acceleration toggle is * enabled. * @hide */ public static boolean isPointerAccelerationFeatureFlagEnabled() { return pointerAcceleration(); } /** * Returns true if the touchpad visualizer is allowed to appear. * Loading Loading @@ -719,6 +729,47 @@ public class InputSettings { UserHandle.USER_CURRENT); } /** * Whether cursor acceleration is enabled or not for connected mice. * * @param context The application context. * * @hide */ public static boolean isMousePointerAccelerationEnabled(@NonNull Context context) { if (!isPointerAccelerationFeatureFlagEnabled()) { return false; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, 1, UserHandle.USER_CURRENT) == 1; } /** * Sets whether mouse acceleration is enabled. * * When enabled, the mouse cursor moves farther when it is moved faster. * When disabled, the mouse cursor speed becomes directly proportional to * the speed at which the mouse is moved. * * @param context The application context. * @param enabled Will enable mouse acceleration if true, disable it if * false. * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setMouseAccelerationEnabled(@NonNull Context context, boolean enabled) { if (!isPointerAccelerationFeatureFlagEnabled()) { return; } Settings.System.putIntForUser(context.getContentResolver(), Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, enabled ? 1 : 0, UserHandle.USER_CURRENT); } /** * Whether Accessibility bounce keys feature is enabled. * Loading core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -6361,6 +6361,16 @@ public final class Settings { */ public static final String MOUSE_SCROLLING_ACCELERATION = "mouse_scrolling_acceleration"; /** * Whether mouse acceleration is enabled. * * When enabled, the mouse cursor will accelerate as the mouse moves faster. * * @hide */ public static final String MOUSE_POINTER_ACCELERATION_ENABLED = "mouse_pointer_acceleration_enabled"; /** * Pointer fill style, specified by * {@link android.view.PointerIcon.PointerIconVectorStyleFill} constants. Loading Loading @@ -6610,6 +6620,7 @@ public final class Settings { PRIVATE_SETTINGS.add(DEFAULT_DEVICE_FONT_SCALE); PRIVATE_SETTINGS.add(MOUSE_REVERSE_VERTICAL_SCROLLING); PRIVATE_SETTINGS.add(MOUSE_SWAP_PRIMARY_BUTTON); PRIVATE_SETTINGS.add(MOUSE_POINTER_ACCELERATION_ENABLED); PRIVATE_SETTINGS.add(PREFERRED_REGION); PRIVATE_SETTINGS.add(MOUSE_SCROLLING_ACCELERATION); } Loading core/proto/android/providers/settings/system.proto +1 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ message SystemSettingsProto { optional SettingProto reverse_vertical_scrolling = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto swap_primary_button = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto scrolling_acceleration = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto pointer_acceleration_enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Mouse mouse = 38; Loading packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public class SystemSettings { Settings.System.MOUSE_REVERSE_VERTICAL_SCROLLING, Settings.System.MOUSE_SCROLLING_ACCELERATION, Settings.System.MOUSE_SWAP_PRIMARY_BUTTON, Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, Settings.System.TOUCHPAD_POINTER_SPEED, Settings.System.TOUCHPAD_NATURAL_SCROLLING, Settings.System.TOUCHPAD_TAP_TO_CLICK, Loading packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ public class SystemSettingsValidators { VALIDATORS.put(System.MOUSE_REVERSE_VERTICAL_SCROLLING, BOOLEAN_VALIDATOR); VALIDATORS.put(System.MOUSE_SWAP_PRIMARY_BUTTON, BOOLEAN_VALIDATOR); VALIDATORS.put(System.MOUSE_SCROLLING_ACCELERATION, BOOLEAN_VALIDATOR); VALIDATORS.put(System.MOUSE_POINTER_ACCELERATION_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(System.TOUCHPAD_POINTER_SPEED, new InclusiveIntegerRangeValidator(-7, 7)); VALIDATORS.put(System.TOUCHPAD_NATURAL_SCROLLING, BOOLEAN_VALIDATOR); VALIDATORS.put(System.TOUCHPAD_TAP_TO_CLICK, BOOLEAN_VALIDATOR); Loading Loading
core/java/android/hardware/input/InputSettings.java +51 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag; import static com.android.hardware.input.Flags.mouseScrollingAcceleration; import static com.android.hardware.input.Flags.mouseReverseVerticalScrolling; import static com.android.hardware.input.Flags.mouseSwapPrimaryButton; import static com.android.hardware.input.Flags.pointerAcceleration; import static com.android.hardware.input.Flags.touchpadSystemGestureDisable; import static com.android.hardware.input.Flags.touchpadThreeFingerTapShortcut; import static com.android.hardware.input.Flags.touchpadVisualizer; Loading Loading @@ -417,6 +418,15 @@ public class InputSettings { return mouseSwapPrimaryButton(); } /** * Returns true if the feature flag for the pointer acceleration toggle is * enabled. * @hide */ public static boolean isPointerAccelerationFeatureFlagEnabled() { return pointerAcceleration(); } /** * Returns true if the touchpad visualizer is allowed to appear. * Loading Loading @@ -719,6 +729,47 @@ public class InputSettings { UserHandle.USER_CURRENT); } /** * Whether cursor acceleration is enabled or not for connected mice. * * @param context The application context. * * @hide */ public static boolean isMousePointerAccelerationEnabled(@NonNull Context context) { if (!isPointerAccelerationFeatureFlagEnabled()) { return false; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, 1, UserHandle.USER_CURRENT) == 1; } /** * Sets whether mouse acceleration is enabled. * * When enabled, the mouse cursor moves farther when it is moved faster. * When disabled, the mouse cursor speed becomes directly proportional to * the speed at which the mouse is moved. * * @param context The application context. * @param enabled Will enable mouse acceleration if true, disable it if * false. * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setMouseAccelerationEnabled(@NonNull Context context, boolean enabled) { if (!isPointerAccelerationFeatureFlagEnabled()) { return; } Settings.System.putIntForUser(context.getContentResolver(), Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, enabled ? 1 : 0, UserHandle.USER_CURRENT); } /** * Whether Accessibility bounce keys feature is enabled. * Loading
core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -6361,6 +6361,16 @@ public final class Settings { */ public static final String MOUSE_SCROLLING_ACCELERATION = "mouse_scrolling_acceleration"; /** * Whether mouse acceleration is enabled. * * When enabled, the mouse cursor will accelerate as the mouse moves faster. * * @hide */ public static final String MOUSE_POINTER_ACCELERATION_ENABLED = "mouse_pointer_acceleration_enabled"; /** * Pointer fill style, specified by * {@link android.view.PointerIcon.PointerIconVectorStyleFill} constants. Loading Loading @@ -6610,6 +6620,7 @@ public final class Settings { PRIVATE_SETTINGS.add(DEFAULT_DEVICE_FONT_SCALE); PRIVATE_SETTINGS.add(MOUSE_REVERSE_VERTICAL_SCROLLING); PRIVATE_SETTINGS.add(MOUSE_SWAP_PRIMARY_BUTTON); PRIVATE_SETTINGS.add(MOUSE_POINTER_ACCELERATION_ENABLED); PRIVATE_SETTINGS.add(PREFERRED_REGION); PRIVATE_SETTINGS.add(MOUSE_SCROLLING_ACCELERATION); } Loading
core/proto/android/providers/settings/system.proto +1 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ message SystemSettingsProto { optional SettingProto reverse_vertical_scrolling = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto swap_primary_button = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto scrolling_acceleration = 3 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto pointer_acceleration_enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Mouse mouse = 38; Loading
packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public class SystemSettings { Settings.System.MOUSE_REVERSE_VERTICAL_SCROLLING, Settings.System.MOUSE_SCROLLING_ACCELERATION, Settings.System.MOUSE_SWAP_PRIMARY_BUTTON, Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, Settings.System.TOUCHPAD_POINTER_SPEED, Settings.System.TOUCHPAD_NATURAL_SCROLLING, Settings.System.TOUCHPAD_TAP_TO_CLICK, Loading
packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ public class SystemSettingsValidators { VALIDATORS.put(System.MOUSE_REVERSE_VERTICAL_SCROLLING, BOOLEAN_VALIDATOR); VALIDATORS.put(System.MOUSE_SWAP_PRIMARY_BUTTON, BOOLEAN_VALIDATOR); VALIDATORS.put(System.MOUSE_SCROLLING_ACCELERATION, BOOLEAN_VALIDATOR); VALIDATORS.put(System.MOUSE_POINTER_ACCELERATION_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(System.TOUCHPAD_POINTER_SPEED, new InclusiveIntegerRangeValidator(-7, 7)); VALIDATORS.put(System.TOUCHPAD_NATURAL_SCROLLING, BOOLEAN_VALIDATOR); VALIDATORS.put(System.TOUCHPAD_TAP_TO_CLICK, BOOLEAN_VALIDATOR); Loading