Merge "InputSettings: fix touchpad tap-to-click default" into udc-qpr-dev

This commit is contained in:
Harry Cutts
2023-05-26 15:26:46 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 11 deletions

View File

@@ -266,7 +266,7 @@ public class InputSettings {
*/ */
public static boolean useTouchpadTapToClick(@NonNull Context context) { public static boolean useTouchpadTapToClick(@NonNull Context context) {
return Settings.System.getIntForUser(context.getContentResolver(), return Settings.System.getIntForUser(context.getContentResolver(),
Settings.System.TOUCHPAD_TAP_TO_CLICK, 0, UserHandle.USER_CURRENT) == 1; Settings.System.TOUCHPAD_TAP_TO_CLICK, 1, UserHandle.USER_CURRENT) == 1;
} }
/** /**

View File

@@ -115,35 +115,34 @@ class InputSettingsObserver extends ContentObserver {
return setting != 0; return setting != 0;
} }
private int getPointerSpeedValue(String settingName) { private int constrainPointerSpeedValue(int speed) {
int speed = Settings.System.getIntForUser(mContext.getContentResolver(),
settingName, InputSettings.DEFAULT_POINTER_SPEED, UserHandle.USER_CURRENT);
return Math.min(Math.max(speed, InputSettings.MIN_POINTER_SPEED), return Math.min(Math.max(speed, InputSettings.MIN_POINTER_SPEED),
InputSettings.MAX_POINTER_SPEED); InputSettings.MAX_POINTER_SPEED);
} }
private void updateMousePointerSpeed() { private void updateMousePointerSpeed() {
mNative.setPointerSpeed(getPointerSpeedValue(Settings.System.POINTER_SPEED)); int speed = Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.POINTER_SPEED, InputSettings.DEFAULT_POINTER_SPEED,
UserHandle.USER_CURRENT);
mNative.setPointerSpeed(constrainPointerSpeedValue(speed));
} }
private void updateTouchpadPointerSpeed() { private void updateTouchpadPointerSpeed() {
mNative.setTouchpadPointerSpeed( mNative.setTouchpadPointerSpeed(
getPointerSpeedValue(Settings.System.TOUCHPAD_POINTER_SPEED)); constrainPointerSpeedValue(InputSettings.getTouchpadPointerSpeed(mContext)));
} }
private void updateTouchpadNaturalScrollingEnabled() { private void updateTouchpadNaturalScrollingEnabled() {
mNative.setTouchpadNaturalScrollingEnabled( mNative.setTouchpadNaturalScrollingEnabled(
getBoolean(Settings.System.TOUCHPAD_NATURAL_SCROLLING, true)); InputSettings.useTouchpadNaturalScrolling(mContext));
} }
private void updateTouchpadTapToClickEnabled() { private void updateTouchpadTapToClickEnabled() {
mNative.setTouchpadTapToClickEnabled( mNative.setTouchpadTapToClickEnabled(InputSettings.useTouchpadTapToClick(mContext));
getBoolean(Settings.System.TOUCHPAD_TAP_TO_CLICK, true));
} }
private void updateTouchpadRightClickZoneEnabled() { private void updateTouchpadRightClickZoneEnabled() {
mNative.setTouchpadRightClickZoneEnabled( mNative.setTouchpadRightClickZoneEnabled(InputSettings.useTouchpadRightClickZone(mContext));
getBoolean(Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE, false));
} }
private void updateShowTouches() { private void updateShowTouches() {