diff options
| author | 2010-10-24 14:18:19 -0700 | |
|---|---|---|
| committer | 2010-10-24 14:18:19 -0700 | |
| commit | f35c87350171260ccfb9742bc623e1a4b857c021 (patch) | |
| tree | 48004ee9a8dcdcbb625d8fcc0ac3d2c45973d806 /libs/ui/InputDispatcher.cpp | |
| parent | 48a862ef5f1a9fe9f646f0862d676170fd8dc51d (diff) | |
| parent | 3c3cc62e243a7796f5c1e88773d34e2054cc26c6 (diff) | |
Merge "Add unit tests for native input and fix bugs identified." into gingerbread
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 303075f1bc..fef8148183 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; } |