touchpad: add touchpad system gesture setting
This new setting is implemented as a simple boolean check before
handling three- and four-finger swipe gestures. The only gotcha is to
make sure we end any ongoing swipe when they're disabled, so we don't
produce an inconsistent event stream.
Test: disable the setting, check three- and four-finger swipes on the
touchpad stop working; re-enable, check they work again
Test: $ adb shell 'stop && setprop log.tag.InputDispatcherVerifyEvents
DEBUG && start'
then toggle the setting while performing gestures, check there are
no crashes
Test: atest inputflinger_tests
Flag: com.android.hardware.input.touchpad_system_gesture_disable
Bug: 353947750
Change-Id: I4333e3d3bb6f89d29332c701937ea4c870b1cbc5
diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h
index 580cde3..4d6b6c7 100644
--- a/services/inputflinger/include/InputReaderBase.h
+++ b/services/inputflinger/include/InputReaderBase.h
@@ -245,6 +245,9 @@
// True to use three-finger tap as a customizable shortcut; false to use it as a middle-click.
bool touchpadThreeFingerTapShortcutEnabled;
+ // True to enable system gestures (three- and four-finger swipes) on touchpads.
+ bool touchpadSystemGesturesEnabled;
+
// The set of currently disabled input devices.
std::set<int32_t> disabledDevices;
@@ -297,6 +300,7 @@
shouldNotifyTouchpadHardwareState(false),
touchpadRightClickZoneEnabled(false),
touchpadThreeFingerTapShortcutEnabled(false),
+ touchpadSystemGesturesEnabled(true),
stylusButtonMotionEventsEnabled(true),
stylusPointerIconEnabled(false),
mouseReverseVerticalScrollingEnabled(false),