Support BTN_TOOL_*TAP as synonyms for BTN_TOOL_FINGER.
Bug: 5205301
Some drivers report one finger as BTN_TOOL_FINGER, two as
BTN_TOOL_DOUBLETAP, three as BTN_TOOL_TRIPLETAP and four
as BTN_TOOL_QUADTAP. Since we care about the tool type,
we need to handle _DOUBLE/_TRIPLE/_QUAD tap in the same way
we handle _FINGER.
Change-Id: I8eb83d2a2bada9ac32d07619c7eea84e924316b8
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 40c85fc..643866b 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1220,6 +1220,9 @@
mBtnToolAirbrush = device->isKeyPressed(BTN_TOOL_AIRBRUSH);
mBtnToolMouse = device->isKeyPressed(BTN_TOOL_MOUSE);
mBtnToolLens = device->isKeyPressed(BTN_TOOL_LENS);
+ mBtnToolDoubleTap = device->isKeyPressed(BTN_TOOL_DOUBLETAP);
+ mBtnToolTripleTap = device->isKeyPressed(BTN_TOOL_TRIPLETAP);
+ mBtnToolQuadTap = device->isKeyPressed(BTN_TOOL_QUADTAP);
}
void TouchButtonAccumulator::clearButtons() {
@@ -1234,6 +1237,9 @@
mBtnToolAirbrush = 0;
mBtnToolMouse = 0;
mBtnToolLens = 0;
+ mBtnToolDoubleTap = 0;
+ mBtnToolTripleTap = 0;
+ mBtnToolQuadTap = 0;
}
void TouchButtonAccumulator::process(const RawEvent* rawEvent) {
@@ -1272,6 +1278,15 @@
case BTN_TOOL_LENS:
mBtnToolLens = rawEvent->value;
break;
+ case BTN_TOOL_DOUBLETAP:
+ mBtnToolDoubleTap = rawEvent->value;
+ break;
+ case BTN_TOOL_TRIPLETAP:
+ mBtnToolTripleTap = rawEvent->value;
+ break;
+ case BTN_TOOL_QUADTAP:
+ mBtnToolQuadTap = rawEvent->value;
+ break;
}
}
}
@@ -1297,7 +1312,7 @@
if (mBtnToolPen || mBtnToolBrush || mBtnToolPencil || mBtnToolAirbrush) {
return AMOTION_EVENT_TOOL_TYPE_STYLUS;
}
- if (mBtnToolFinger) {
+ if (mBtnToolFinger || mBtnToolDoubleTap || mBtnToolTripleTap || mBtnToolQuadTap) {
return AMOTION_EVENT_TOOL_TYPE_FINGER;
}
return AMOTION_EVENT_TOOL_TYPE_UNKNOWN;
@@ -1306,7 +1321,8 @@
bool TouchButtonAccumulator::isToolActive() const {
return mBtnTouch || mBtnToolFinger || mBtnToolPen || mBtnToolRubber
|| mBtnToolBrush || mBtnToolPencil || mBtnToolAirbrush
- || mBtnToolMouse || mBtnToolLens;
+ || mBtnToolMouse || mBtnToolLens
+ || mBtnToolDoubleTap || mBtnToolTripleTap || mBtnToolQuadTap;
}
bool TouchButtonAccumulator::isHovering() const {