From ea6892e02e10a57673a42f0922ad28694595dcaa Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 23 Aug 2011 17:31:25 -0700 Subject: 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 --- services/input/InputReader.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'services/input/InputReader.cpp') diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index 40c85fc7f053..643866b4efad 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -1220,6 +1220,9 @@ void TouchButtonAccumulator::reset(InputDevice* device) { 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 @@ void TouchButtonAccumulator::clearButtons() { mBtnToolAirbrush = 0; mBtnToolMouse = 0; mBtnToolLens = 0; + mBtnToolDoubleTap = 0; + mBtnToolTripleTap = 0; + mBtnToolQuadTap = 0; } void TouchButtonAccumulator::process(const RawEvent* rawEvent) { @@ -1272,6 +1278,15 @@ void TouchButtonAccumulator::process(const RawEvent* rawEvent) { 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 @@ int32_t TouchButtonAccumulator::getToolType() const { 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 @@ int32_t TouchButtonAccumulator::getToolType() const { bool TouchButtonAccumulator::isToolActive() const { return mBtnTouch || mBtnToolFinger || mBtnToolPen || mBtnToolRubber || mBtnToolBrush || mBtnToolPencil || mBtnToolAirbrush - || mBtnToolMouse || mBtnToolLens; + || mBtnToolMouse || mBtnToolLens + || mBtnToolDoubleTap || mBtnToolTripleTap || mBtnToolQuadTap; } bool TouchButtonAccumulator::isHovering() const { -- cgit v1.2.3-59-g8ed1b