diff options
| author | 2010-10-24 14:31:41 -0700 | |
|---|---|---|
| committer | 2010-10-24 14:31:41 -0700 | |
| commit | 2ef36763700eff5679d6012e7f078c57f1a4c465 (patch) | |
| tree | 3b36010de56350d0b88914c4fbd729afa38acd00 /libs/ui/InputDispatcher.cpp | |
| parent | b34fe2f0258eb1ed512b682206b7fe65116f1dbd (diff) | |
| parent | 860c2df4132a2a0be9bcb0e91bfb7e79588c000f (diff) | |
am 860c2df4: Merge "Add unit tests for native input and fix bugs identified." into gingerbread
Merge commit '860c2df4132a2a0be9bcb0e91bfb7e79588c000f' into gingerbread-plus-aosp
* commit '860c2df4132a2a0be9bcb0e91bfb7e79588c000f':
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 303075f1bc7c..fef814818313 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; } |