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) {
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;
}
private int getPointerSpeedValue(String settingName) {
int speed = Settings.System.getIntForUser(mContext.getContentResolver(),
settingName, InputSettings.DEFAULT_POINTER_SPEED, UserHandle.USER_CURRENT);
private int constrainPointerSpeedValue(int speed) {
return Math.min(Math.max(speed, InputSettings.MIN_POINTER_SPEED),
InputSettings.MAX_POINTER_SPEED);
}
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() {
mNative.setTouchpadPointerSpeed(
getPointerSpeedValue(Settings.System.TOUCHPAD_POINTER_SPEED));
constrainPointerSpeedValue(InputSettings.getTouchpadPointerSpeed(mContext)));
}
private void updateTouchpadNaturalScrollingEnabled() {
mNative.setTouchpadNaturalScrollingEnabled(
getBoolean(Settings.System.TOUCHPAD_NATURAL_SCROLLING, true));
InputSettings.useTouchpadNaturalScrolling(mContext));
}
private void updateTouchpadTapToClickEnabled() {
mNative.setTouchpadTapToClickEnabled(
getBoolean(Settings.System.TOUCHPAD_TAP_TO_CLICK, true));
mNative.setTouchpadTapToClickEnabled(InputSettings.useTouchpadTapToClick(mContext));
}
private void updateTouchpadRightClickZoneEnabled() {
mNative.setTouchpadRightClickZoneEnabled(
getBoolean(Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE, false));
mNative.setTouchpadRightClickZoneEnabled(InputSettings.useTouchpadRightClickZone(mContext));
}
private void updateShowTouches() {