From 130dc988c1dadbd7d3eeb69464f840196ae1bef6 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Fri, 3 Feb 2023 15:58:39 +0000 Subject: [PATCH] input: change touchpad scrolling and tap-to-click defaults I'd had them default to false when I added them, but they should actually be true by default (i.e. tap to click should be enabled, and moving two fingers upwards on the touchpad should scroll down). Bug: 267653650 Test: on a device without touchpad_natural_scrolling setting set, check scroll direction is "natural" and tap-to-click works Test: atest inputflinger_tests Change-Id: I7d07d599709241460da47d714b221583a7099fb0 --- .../android/server/input/InputSettingsObserver.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/input/InputSettingsObserver.java b/services/core/java/com/android/server/input/InputSettingsObserver.java index 8ee3a721fc635..a113d011b4577 100644 --- a/services/core/java/com/android/server/input/InputSettingsObserver.java +++ b/services/core/java/com/android/server/input/InputSettingsObserver.java @@ -103,9 +103,9 @@ class InputSettingsObserver extends ContentObserver { mObservers.get(uri).accept("setting changed"); } - private boolean getBoolean(String settingName) { + private boolean getBoolean(String settingName, boolean defaultValue) { final int setting = Settings.System.getIntForUser(mContext.getContentResolver(), - settingName, 0, UserHandle.USER_CURRENT); + settingName, defaultValue ? 1 : 0, UserHandle.USER_CURRENT); return setting != 0; } @@ -127,20 +127,21 @@ class InputSettingsObserver extends ContentObserver { private void updateTouchpadNaturalScrollingEnabled() { mNative.setTouchpadNaturalScrollingEnabled( - getBoolean(Settings.System.TOUCHPAD_NATURAL_SCROLLING)); + getBoolean(Settings.System.TOUCHPAD_NATURAL_SCROLLING, true)); } private void updateTouchpadTapToClickEnabled() { - mNative.setTouchpadTapToClickEnabled(getBoolean(Settings.System.TOUCHPAD_TAP_TO_CLICK)); + mNative.setTouchpadTapToClickEnabled( + getBoolean(Settings.System.TOUCHPAD_TAP_TO_CLICK, true)); } private void updateTouchpadRightClickZoneEnabled() { mNative.setTouchpadRightClickZoneEnabled( - getBoolean(Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE)); + getBoolean(Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE, false)); } private void updateShowTouches() { - mNative.setShowTouches(getBoolean(Settings.System.SHOW_TOUCHES)); + mNative.setShowTouches(getBoolean(Settings.System.SHOW_TOUCHES, false)); } private void updateAccessibilityLargePointer() {