Loading core/java/android/hardware/input/InputSettings.java +48 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yMouseKeys; import static com.android.hardware.input.Flags.keyboardA11ySlowKeysFlag; 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.touchpadSystemGestureDisable; Loading Loading @@ -391,6 +392,15 @@ public class InputSettings { return isCustomizableInputGesturesFeatureFlagEnabled() && touchpadThreeFingerTapShortcut(); } /** * Returns true if the feature flag for toggling the mouse scrolling acceleration is enabled. * * @hide */ public static boolean isMouseScrollingAccelerationFeatureFlagEnabled() { return mouseScrollingAcceleration(); } /** * Returns true if the feature flag for mouse reverse vertical scrolling is enabled. * @hide Loading Loading @@ -593,7 +603,44 @@ public class InputSettings { } /** * Whether mouse vertical scrolling is enabled, this applies only to connected mice. * Whether mouse scrolling acceleration is enabled. This applies only to connected mice. * * @param context The application context. * @return Whether the mouse scrolling is accelerated based on the user's scrolling speed. * * @hide */ public static boolean isMouseScrollingAccelerationEnabled(@NonNull Context context) { if (!isMouseScrollingAccelerationFeatureFlagEnabled()) { return true; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_ACCELERATION, 0, UserHandle.USER_CURRENT) != 0; } /** * Sets whether the connected mouse scrolling acceleration is enabled. * * @param context The application context. * @param scrollingAcceleration Whether mouse scrolling acceleration is enabled. * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setMouseScrollingAcceleration(@NonNull Context context, boolean scrollingAcceleration) { if (!isMouseScrollingAccelerationFeatureFlagEnabled()) { return; } Settings.System.putIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_ACCELERATION, scrollingAcceleration ? 1 : 0, UserHandle.USER_CURRENT); } /** * Whether mouse vertical scrolling is reversed. This applies only to connected mice. * * @param context The application context. * @return Whether the mouse will have its vertical scrolling reversed Loading core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -6351,6 +6351,16 @@ public final class Settings { public static final String MOUSE_SWAP_PRIMARY_BUTTON = "mouse_swap_primary_button"; /** * Whether to enable mouse scrolling acceleration. * * When enabled, mouse scrolling is accelerated based on the user's scrolling speed. * When disabled, mouse scrolling speed becomes directly proportional to the speed at which * the wheel is turned. * @hide */ public static final String MOUSE_SCROLLING_ACCELERATION = "mouse_scrolling_acceleration"; /** * Pointer fill style, specified by * {@link android.view.PointerIcon.PointerIconVectorStyleFill} constants. Loading Loading @@ -6601,6 +6611,7 @@ public final class Settings { PRIVATE_SETTINGS.add(MOUSE_REVERSE_VERTICAL_SCROLLING); PRIVATE_SETTINGS.add(MOUSE_SWAP_PRIMARY_BUTTON); 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 @@ -227,6 +227,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 Mouse mouse = 38; Loading packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class SystemSettings { Settings.System.AUTO_LAUNCH_MEDIA_CONTROLS, Settings.System.LOCALE_PREFERENCES, Settings.System.MOUSE_REVERSE_VERTICAL_SCROLLING, Settings.System.MOUSE_SCROLLING_ACCELERATION, Settings.System.MOUSE_SWAP_PRIMARY_BUTTON, Settings.System.TOUCHPAD_POINTER_SPEED, Settings.System.TOUCHPAD_NATURAL_SCROLLING, Loading packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -225,6 +225,7 @@ public class SystemSettingsValidators { new InclusiveFloatRangeValidator(DEFAULT_POINTER_SCALE, LARGE_POINTER_SCALE)); 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.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 +48 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static com.android.hardware.input.Flags.keyboardA11yBounceKeysFlag; import static com.android.hardware.input.Flags.keyboardA11yMouseKeys; import static com.android.hardware.input.Flags.keyboardA11ySlowKeysFlag; 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.touchpadSystemGestureDisable; Loading Loading @@ -391,6 +392,15 @@ public class InputSettings { return isCustomizableInputGesturesFeatureFlagEnabled() && touchpadThreeFingerTapShortcut(); } /** * Returns true if the feature flag for toggling the mouse scrolling acceleration is enabled. * * @hide */ public static boolean isMouseScrollingAccelerationFeatureFlagEnabled() { return mouseScrollingAcceleration(); } /** * Returns true if the feature flag for mouse reverse vertical scrolling is enabled. * @hide Loading Loading @@ -593,7 +603,44 @@ public class InputSettings { } /** * Whether mouse vertical scrolling is enabled, this applies only to connected mice. * Whether mouse scrolling acceleration is enabled. This applies only to connected mice. * * @param context The application context. * @return Whether the mouse scrolling is accelerated based on the user's scrolling speed. * * @hide */ public static boolean isMouseScrollingAccelerationEnabled(@NonNull Context context) { if (!isMouseScrollingAccelerationFeatureFlagEnabled()) { return true; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_ACCELERATION, 0, UserHandle.USER_CURRENT) != 0; } /** * Sets whether the connected mouse scrolling acceleration is enabled. * * @param context The application context. * @param scrollingAcceleration Whether mouse scrolling acceleration is enabled. * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setMouseScrollingAcceleration(@NonNull Context context, boolean scrollingAcceleration) { if (!isMouseScrollingAccelerationFeatureFlagEnabled()) { return; } Settings.System.putIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_ACCELERATION, scrollingAcceleration ? 1 : 0, UserHandle.USER_CURRENT); } /** * Whether mouse vertical scrolling is reversed. This applies only to connected mice. * * @param context The application context. * @return Whether the mouse will have its vertical scrolling reversed Loading
core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -6351,6 +6351,16 @@ public final class Settings { public static final String MOUSE_SWAP_PRIMARY_BUTTON = "mouse_swap_primary_button"; /** * Whether to enable mouse scrolling acceleration. * * When enabled, mouse scrolling is accelerated based on the user's scrolling speed. * When disabled, mouse scrolling speed becomes directly proportional to the speed at which * the wheel is turned. * @hide */ public static final String MOUSE_SCROLLING_ACCELERATION = "mouse_scrolling_acceleration"; /** * Pointer fill style, specified by * {@link android.view.PointerIcon.PointerIconVectorStyleFill} constants. Loading Loading @@ -6601,6 +6611,7 @@ public final class Settings { PRIVATE_SETTINGS.add(MOUSE_REVERSE_VERTICAL_SCROLLING); PRIVATE_SETTINGS.add(MOUSE_SWAP_PRIMARY_BUTTON); 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 @@ -227,6 +227,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 Mouse mouse = 38; Loading
packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,7 @@ public class SystemSettings { Settings.System.AUTO_LAUNCH_MEDIA_CONTROLS, Settings.System.LOCALE_PREFERENCES, Settings.System.MOUSE_REVERSE_VERTICAL_SCROLLING, Settings.System.MOUSE_SCROLLING_ACCELERATION, Settings.System.MOUSE_SWAP_PRIMARY_BUTTON, Settings.System.TOUCHPAD_POINTER_SPEED, Settings.System.TOUCHPAD_NATURAL_SCROLLING, Loading
packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -225,6 +225,7 @@ public class SystemSettingsValidators { new InclusiveFloatRangeValidator(DEFAULT_POINTER_SCALE, LARGE_POINTER_SCALE)); 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.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