Fix max touch count calculation in TouchpadInputMapper
It seems I got confused between InputDeviceContext.hasKeyCode and
hasScanCode.
Bug: 251196347
Test: check that max_touch_cnt in the HardwareProperties is set
correctly (e.g. with the tests from ag/20691427)
Change-Id: Ief9144deb90360e1f12f35316b174a40de8c3db4
diff --git a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
index de6e4b0..956a7aa 100644
--- a/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchpadInputMapper.cpp
@@ -28,11 +28,11 @@
namespace {
short getMaxTouchCount(const InputDeviceContext& context) {
- if (context.hasKeyCode(BTN_TOOL_QUINTTAP)) return 5;
- if (context.hasKeyCode(BTN_TOOL_QUADTAP)) return 4;
- if (context.hasKeyCode(BTN_TOOL_TRIPLETAP)) return 3;
- if (context.hasKeyCode(BTN_TOOL_DOUBLETAP)) return 2;
- if (context.hasKeyCode(BTN_TOOL_FINGER)) return 1;
+ if (context.hasScanCode(BTN_TOOL_QUINTTAP)) return 5;
+ if (context.hasScanCode(BTN_TOOL_QUADTAP)) return 4;
+ if (context.hasScanCode(BTN_TOOL_TRIPLETAP)) return 3;
+ if (context.hasScanCode(BTN_TOOL_DOUBLETAP)) return 2;
+ if (context.hasScanCode(BTN_TOOL_FINGER)) return 1;
return 0;
}