GestureConverter: add option to make 3-finger tap a shortcut
By default, it will remain as middle-click, but if the user chooses to
customize it we'll handle it like a special keyboard shortcut by sending
a JNI call up to InputManagerService.
Test: 3-finger tap with flag enabled, check log line appears
Test: 3-finger tap with flag disabled, check button events appear at
https://w3c.github.io/uievents/tools/mouse-event-viewer.html
Test: atest inputflinger_test:GestureConverterTest
Test: m checkinput
Flag: com.android.hardware.input.touchpad_three_finger_tap_shortcut
Bug: 365063048
Change-Id: I771d46e1aafe9164dd32771cfdb55a3b259b5a0d
diff --git a/services/inputflinger/include/InputReaderBase.h b/services/inputflinger/include/InputReaderBase.h
index 6ef4a3d..305feab 100644
--- a/services/inputflinger/include/InputReaderBase.h
+++ b/services/inputflinger/include/InputReaderBase.h
@@ -242,6 +242,9 @@
// context (a.k.a. "right") clicks.
bool touchpadRightClickZoneEnabled;
+ // True to use three-finger tap as a customizable shortcut; false to use it as a middle-click.
+ bool touchpadThreeFingerTapShortcutEnabled;
+
// The set of currently disabled input devices.
std::set<int32_t> disabledDevices;
@@ -293,6 +296,7 @@
touchpadTapDraggingEnabled(false),
shouldNotifyTouchpadHardwareState(false),
touchpadRightClickZoneEnabled(false),
+ touchpadThreeFingerTapShortcutEnabled(false),
stylusButtonMotionEventsEnabled(true),
stylusPointerIconEnabled(false),
mouseReverseVerticalScrollingEnabled(false),
@@ -496,6 +500,9 @@
/* Sends the Info of gestures that happen on the touchpad. */
virtual void notifyTouchpadGestureInfo(GestureType type, int32_t deviceId) = 0;
+ /* Notifies the policy that the user has performed a three-finger touchpad tap. */
+ virtual void notifyTouchpadThreeFingerTap() = 0;
+
/* Gets the keyboard layout for a particular input device. */
virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay(
const InputDeviceIdentifier& identifier,