Loading core/java/android/hardware/input/InputSettings.java +66 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,24 @@ public class InputSettings { @SuppressLint("UnflaggedApi") // TestApi without associated feature. public static final int DEFAULT_POINTER_SPEED = 0; /** * Pointer Speed: The minimum (slowest) mouse scrolling speed (-7). * @hide */ public static final int MIN_MOUSE_SCROLLING_SPEED = -7; /** * Pointer Speed: The maximum (fastest) mouse scrolling speed (7). * @hide */ public static final int MAX_MOUSE_SCROLLING_SPEED = 7; /** * Pointer Speed: The default mouse scrolling speed (0). * @hide */ public static final int DEFAULT_MOUSE_SCROLLING_SPEED = 0; /** * Bounce Keys Threshold: The default value of the threshold (500 ms). * Loading Loading @@ -649,6 +667,54 @@ public class InputSettings { UserHandle.USER_CURRENT); } /** * Gets the mouse scrolling speed. * * The returned value only applies when mouse scrolling acceleration is not enabled. * * @param context The application context. * @return The mouse scrolling speed as a value between {@link #MIN_MOUSE_SCROLLING_SPEED} and * {@link #MAX_MOUSE_SCROLLING_SPEED}, or the default value * {@link #DEFAULT_MOUSE_SCROLLING_SPEED}. * * @hide */ public static int getMouseScrollingSpeed(@NonNull Context context) { if (!isMouseScrollingAccelerationFeatureFlagEnabled()) { return 0; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_SPEED, DEFAULT_MOUSE_SCROLLING_SPEED, UserHandle.USER_CURRENT); } /** * Sets the mouse scrolling speed, and saves it in the settings. * * The new speed will only apply when mouse scrolling acceleration is not enabled. * * @param context The application context. * @param speed The mouse scrolling speed as a value between {@link #MIN_MOUSE_SCROLLING_SPEED} * and {@link #MAX_MOUSE_SCROLLING_SPEED}, or the default value * {@link #DEFAULT_MOUSE_SCROLLING_SPEED}. * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setMouseScrollingSpeed(@NonNull Context context, int speed) { if (isMouseScrollingAccelerationEnabled(context)) { return; } if (speed < MIN_MOUSE_SCROLLING_SPEED || speed > MAX_MOUSE_SCROLLING_SPEED) { throw new IllegalArgumentException("speed out of range"); } Settings.System.putIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_SPEED, speed, UserHandle.USER_CURRENT); } /** * Whether mouse vertical scrolling is reversed. This applies only to connected mice. * Loading core/java/android/provider/Settings.java +14 −0 Original line number Diff line number Diff line Loading @@ -6371,6 +6371,19 @@ public final class Settings { public static final String MOUSE_POINTER_ACCELERATION_ENABLED = "mouse_pointer_acceleration_enabled"; /** * Mouse scrolling speed setting. * * This is an integer value in a range between -7 and +7, so there are 15 possible values. * The setting only applies when mouse scrolling acceleration is not enabled. * -7 = slowest * 0 = default speed * +7 = fastest * * @hide */ public static final String MOUSE_SCROLLING_SPEED = "mouse_scrolling_speed"; /** * Pointer fill style, specified by * {@link android.view.PointerIcon.PointerIconVectorStyleFill} constants. Loading Loading @@ -6623,6 +6636,7 @@ public final class Settings { PRIVATE_SETTINGS.add(MOUSE_POINTER_ACCELERATION_ENABLED); PRIVATE_SETTINGS.add(PREFERRED_REGION); PRIVATE_SETTINGS.add(MOUSE_SCROLLING_ACCELERATION); PRIVATE_SETTINGS.add(MOUSE_SCROLLING_SPEED); } /** Loading core/proto/android/providers/settings/system.proto +1 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,7 @@ message SystemSettingsProto { 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 SettingProto scrolling_speed = 5 [ (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 @@ -109,6 +109,7 @@ public class SystemSettings { Settings.System.LOCALE_PREFERENCES, Settings.System.MOUSE_REVERSE_VERTICAL_SCROLLING, Settings.System.MOUSE_SCROLLING_ACCELERATION, Settings.System.MOUSE_SCROLLING_SPEED, Settings.System.MOUSE_SWAP_PRIMARY_BUTTON, Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, Settings.System.TOUCHPAD_POINTER_SPEED, Loading packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,7 @@ public class SystemSettingsValidators { 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.MOUSE_SCROLLING_SPEED, new InclusiveIntegerRangeValidator(-7, 7)); 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 +66 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,24 @@ public class InputSettings { @SuppressLint("UnflaggedApi") // TestApi without associated feature. public static final int DEFAULT_POINTER_SPEED = 0; /** * Pointer Speed: The minimum (slowest) mouse scrolling speed (-7). * @hide */ public static final int MIN_MOUSE_SCROLLING_SPEED = -7; /** * Pointer Speed: The maximum (fastest) mouse scrolling speed (7). * @hide */ public static final int MAX_MOUSE_SCROLLING_SPEED = 7; /** * Pointer Speed: The default mouse scrolling speed (0). * @hide */ public static final int DEFAULT_MOUSE_SCROLLING_SPEED = 0; /** * Bounce Keys Threshold: The default value of the threshold (500 ms). * Loading Loading @@ -649,6 +667,54 @@ public class InputSettings { UserHandle.USER_CURRENT); } /** * Gets the mouse scrolling speed. * * The returned value only applies when mouse scrolling acceleration is not enabled. * * @param context The application context. * @return The mouse scrolling speed as a value between {@link #MIN_MOUSE_SCROLLING_SPEED} and * {@link #MAX_MOUSE_SCROLLING_SPEED}, or the default value * {@link #DEFAULT_MOUSE_SCROLLING_SPEED}. * * @hide */ public static int getMouseScrollingSpeed(@NonNull Context context) { if (!isMouseScrollingAccelerationFeatureFlagEnabled()) { return 0; } return Settings.System.getIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_SPEED, DEFAULT_MOUSE_SCROLLING_SPEED, UserHandle.USER_CURRENT); } /** * Sets the mouse scrolling speed, and saves it in the settings. * * The new speed will only apply when mouse scrolling acceleration is not enabled. * * @param context The application context. * @param speed The mouse scrolling speed as a value between {@link #MIN_MOUSE_SCROLLING_SPEED} * and {@link #MAX_MOUSE_SCROLLING_SPEED}, or the default value * {@link #DEFAULT_MOUSE_SCROLLING_SPEED}. * * @hide */ @RequiresPermission(Manifest.permission.WRITE_SETTINGS) public static void setMouseScrollingSpeed(@NonNull Context context, int speed) { if (isMouseScrollingAccelerationEnabled(context)) { return; } if (speed < MIN_MOUSE_SCROLLING_SPEED || speed > MAX_MOUSE_SCROLLING_SPEED) { throw new IllegalArgumentException("speed out of range"); } Settings.System.putIntForUser(context.getContentResolver(), Settings.System.MOUSE_SCROLLING_SPEED, speed, UserHandle.USER_CURRENT); } /** * Whether mouse vertical scrolling is reversed. This applies only to connected mice. * Loading
core/java/android/provider/Settings.java +14 −0 Original line number Diff line number Diff line Loading @@ -6371,6 +6371,19 @@ public final class Settings { public static final String MOUSE_POINTER_ACCELERATION_ENABLED = "mouse_pointer_acceleration_enabled"; /** * Mouse scrolling speed setting. * * This is an integer value in a range between -7 and +7, so there are 15 possible values. * The setting only applies when mouse scrolling acceleration is not enabled. * -7 = slowest * 0 = default speed * +7 = fastest * * @hide */ public static final String MOUSE_SCROLLING_SPEED = "mouse_scrolling_speed"; /** * Pointer fill style, specified by * {@link android.view.PointerIcon.PointerIconVectorStyleFill} constants. Loading Loading @@ -6623,6 +6636,7 @@ public final class Settings { PRIVATE_SETTINGS.add(MOUSE_POINTER_ACCELERATION_ENABLED); PRIVATE_SETTINGS.add(PREFERRED_REGION); PRIVATE_SETTINGS.add(MOUSE_SCROLLING_ACCELERATION); PRIVATE_SETTINGS.add(MOUSE_SCROLLING_SPEED); } /** Loading
core/proto/android/providers/settings/system.proto +1 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,7 @@ message SystemSettingsProto { 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 SettingProto scrolling_speed = 5 [ (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 @@ -109,6 +109,7 @@ public class SystemSettings { Settings.System.LOCALE_PREFERENCES, Settings.System.MOUSE_REVERSE_VERTICAL_SCROLLING, Settings.System.MOUSE_SCROLLING_ACCELERATION, Settings.System.MOUSE_SCROLLING_SPEED, Settings.System.MOUSE_SWAP_PRIMARY_BUTTON, Settings.System.MOUSE_POINTER_ACCELERATION_ENABLED, Settings.System.TOUCHPAD_POINTER_SPEED, Loading
packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,7 @@ public class SystemSettingsValidators { 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.MOUSE_SCROLLING_SPEED, new InclusiveIntegerRangeValidator(-7, 7)); 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