Use both mouse and touchpad sources for touchpads
Previously, touchpads only used `SOURCE_MOUSE`, unless they were
captured, in which case they only used `SOURCE_TOUCHPAD`. This made it
hard to distinguish connected touchpads from mice, e.g. when deciding
whether to display touchpad-specific settings. With this change,
uncaptured touchpads will have `SOURCE_MOUSE | SOURCE_TOUCHPAD`.
Bug: 245929943
Test: Check output of `dumpsys input`
Test: Check sources of incoming touchpad `MotionEvent`s in a test app
Test: atest inputflinger_tests
Change-Id: I74a75db63b7be211ad247b0c9c6c6b28853a4df8
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 615889e..16bc381 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -897,6 +897,8 @@
mDeviceMode = DeviceMode::POINTER;
if (hasStylus()) {
mSource |= AINPUT_SOURCE_STYLUS;
+ } else {
+ mSource |= AINPUT_SOURCE_TOUCHPAD;
}
} else if (isTouchScreen()) {
mSource = AINPUT_SOURCE_TOUCHSCREEN;