Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb3516fe authored by Harry Cutts's avatar Harry Cutts Committed by Android (Google) Code Review
Browse files

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

parents 46a3050c 85dd8de7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
    }

    /**
+9 −10
Original line number Diff line number Diff line
@@ -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() {