From 49754db5a304d995c1cc108ff6f19e4ba4265572 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 1 Jul 2011 17:37:58 -0700 Subject: Handle stylus buttons and tool types. Added TOOL_TYPE_ERASER. Refactored the InputReader to share more code between the various input mappers that handle button states and to simplify the accumulator implementations by having each one only handle a single type of input. Removed the concept of direct/indirect tool types from the API. If we add it back, it should be done in a manner that is orthogonal to the tool type itself, perhaps as a flags field on the pointer. The device source may well provide sufficient information anyhow. Change-Id: I811c22d95e8304269b6ee4f6d11a6b04f3cfc1b2 --- services/input/EventHub.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'services/input/EventHub.cpp') diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index ca2540bfad20..7ea3de2f4266 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -460,6 +460,17 @@ void EventHub::setExcludedDevices(const Vector& devices) { mExcludedDevices = devices; } +bool EventHub::hasScanCode(int32_t deviceId, int32_t scanCode) const { + AutoMutex _l(mLock); + Device* device = getDeviceLocked(deviceId); + if (device && scanCode >= 0 && scanCode <= KEY_MAX) { + if (test_bit(scanCode, device->keyBitmask)) { + return true; + } + } + return false; +} + bool EventHub::hasLed(int32_t deviceId, int32_t led) const { AutoMutex _l(mLock); Device* device = getDeviceLocked(deviceId); -- cgit v1.2.3-59-g8ed1b