diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-06-30 23:53:07 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-07-01 02:59:26 -0700 |
commit | 2717eff2ac04bed60e5fd577bcb8ec1ea7c2ccde (patch) | |
tree | 4a9c6d1b14c4a9f80f386ae2578763942b0d046b /services/input/tests/InputReader_test.cpp | |
parent | d0c18aabac682709e47b9b4a2fdd19cbb6820b7c (diff) | |
download | frameworks_base-2717eff2ac04bed60e5fd577bcb8ec1ea7c2ccde.zip frameworks_base-2717eff2ac04bed60e5fd577bcb8ec1ea7c2ccde.tar.gz frameworks_base-2717eff2ac04bed60e5fd577bcb8ec1ea7c2ccde.tar.bz2 |
Query input device for initial slot index.
This fixes a problem where touches can get stuck because the
driver and the framework have different ideas of what the
initial slot index is. The framework assumed it was slot 0
but it could in principle be any slot, such as slot 1. When
that happened, the framework would start tracking the first
touch as slot 0, but it might never receive an "up" for that slot.
Change-Id: Idaffc4534b275d66b9d4360987b28dc2d0f63218
Diffstat (limited to 'services/input/tests/InputReader_test.cpp')
-rw-r--r-- | services/input/tests/InputReader_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp index e349248..d3c5ece 100644 --- a/services/input/tests/InputReader_test.cpp +++ b/services/input/tests/InputReader_test.cpp @@ -429,6 +429,7 @@ class FakeEventHub : public EventHubInterface { KeyedVector<int32_t, int32_t> keyCodeStates; KeyedVector<int32_t, int32_t> scanCodeStates; KeyedVector<int32_t, int32_t> switchStates; + KeyedVector<int32_t, int32_t> absoluteAxisValue; KeyedVector<int32_t, KeyInfo> keys; KeyedVector<int32_t, bool> leds; Vector<VirtualKeyDefinition> virtualKeys; @@ -514,6 +515,11 @@ public: device->switchStates.replaceValueFor(switchCode, state); } + void setAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t value) { + Device* device = getDevice(deviceId); + device->absoluteAxisValue.replaceValueFor(axis, value); + } + void addKey(int32_t deviceId, int32_t scanCode, int32_t keyCode, uint32_t flags) { Device* device = getDevice(deviceId); KeyInfo info; @@ -677,6 +683,20 @@ private: return AKEY_STATE_UNKNOWN; } + virtual status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, + int32_t* outValue) const { + Device* device = getDevice(deviceId); + if (device) { + ssize_t index = device->absoluteAxisValue.indexOfKey(axis); + if (index >= 0) { + *outValue = device->absoluteAxisValue.valueAt(index); + return OK; + } + } + *outValue = 0; + return -1; + } + virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) const { bool result = false; |