diff options
| author | 2010-10-24 14:36:23 -0700 | |
|---|---|---|
| committer | 2010-10-24 14:36:23 -0700 | |
| commit | 3ae4ac8538765d6cf5b8aceea8c81b21854321bd (patch) | |
| tree | d0e8ae9e1117ce1aeebf375a2807de5ed95c0655 /libs/ui/InputDispatcher.cpp | |
| parent | 4761b176ed241a88394968b983f06c5ae1aad26a (diff) | |
| parent | 2ef36763700eff5679d6012e7f078c57f1a4c465 (diff) | |
am 2ef36763: am 860c2df4: Merge "Add unit tests for native input and fix bugs identified." into gingerbread
Merge commit '2ef36763700eff5679d6012e7f078c57f1a4c465'
* commit '2ef36763700eff5679d6012e7f078c57f1a4c465':
Add unit tests for native input and fix bugs identified.
Diffstat (limited to 'libs/ui/InputDispatcher.cpp')
| -rw-r--r-- | libs/ui/InputDispatcher.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index d679ea258f59..629234b2682c 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -124,12 +124,19 @@ static bool validateMotionEvent(int32_t action, size_t pointerCount, pointerCount, MAX_POINTERS); return false; } + BitSet32 pointerIdBits; for (size_t i = 0; i < pointerCount; i++) { - if (pointerIds[i] < 0 || pointerIds[i] > MAX_POINTER_ID) { + int32_t id = pointerIds[i]; + if (id < 0 || id > MAX_POINTER_ID) { LOGE("Motion event has invalid pointer id %d; value must be between 0 and %d", - pointerIds[i], MAX_POINTER_ID); + id, MAX_POINTER_ID); return false; } + if (pointerIdBits.hasBit(id)) { + LOGE("Motion event has duplicate pointer id %d", id); + return false; + } + pointerIdBits.markBit(id); } return true; } |