summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2010-07-16 15:14:35 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-07-16 15:14:35 -0700
commit7b8df313f714d6e8d536e0f8bbe5496fe9a6c26d (patch)
treef86e5c3da26cf14a3b8c4fdfc3ce1117649c7461
parentaba4bf19fbdedb2f4f438895e8165a3b34a15633 (diff)
parent00ba884436dc8b222ad850c73c936d87bf4e84de (diff)
am 00ba8844: Fix individual pointer id up/down reporting.
Merge commit '00ba884436dc8b222ad850c73c936d87bf4e84de' into gingerbread-plus-aosp * commit '00ba884436dc8b222ad850c73c936d87bf4e84de': Fix individual pointer id up/down reporting.
-rw-r--r--include/ui/InputReader.h3
-rw-r--r--libs/ui/InputReader.cpp19
-rw-r--r--services/jni/com_android_server_InputManager.cpp10
3 files changed, 19 insertions, 13 deletions
diff --git a/include/ui/InputReader.h b/include/ui/InputReader.h
index 85a0084720ac..14bea6504c9e 100644
--- a/include/ui/InputReader.h
+++ b/include/ui/InputReader.h
@@ -286,7 +286,8 @@ private:
int32_t keyEventAction, int32_t keyEventFlags);
void dispatchTouches(nsecs_t when, InputDevice* device, uint32_t policyFlags);
void dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
- InputDevice::TouchData* touch, BitSet32 idBits, int32_t motionEventAction);
+ InputDevice::TouchData* touch, BitSet32 idBits, uint32_t changedId,
+ int32_t motionEventAction);
// display
void resetDisplayProperties();
diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp
index cd4654a6899f..403afe7601d0 100644
--- a/libs/ui/InputReader.cpp
+++ b/libs/ui/InputReader.cpp
@@ -766,7 +766,7 @@ void InputReader::dispatchTouches(nsecs_t when,
// The dispatcher takes care of batching moves so we don't have to deal with that here.
int32_t motionEventAction = AMOTION_EVENT_ACTION_MOVE;
dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
- currentIdBits, motionEventAction);
+ currentIdBits, -1, motionEventAction);
} else {
// There may be pointers going up and pointers going down at the same time when pointer
// ids are reported by the device driver.
@@ -784,12 +784,11 @@ void InputReader::dispatchTouches(nsecs_t when,
if (activeIdBits.isEmpty()) {
motionEventAction = AMOTION_EVENT_ACTION_UP;
} else {
- motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP
- | (upId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
+ motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP;
}
dispatchTouch(when, device, policyFlags, & device->touchScreen.lastTouch,
- oldActiveIdBits, motionEventAction);
+ oldActiveIdBits, upId, motionEventAction);
}
while (! downIdBits.isEmpty()) {
@@ -803,18 +802,17 @@ void InputReader::dispatchTouches(nsecs_t when,
motionEventAction = AMOTION_EVENT_ACTION_DOWN;
device->touchScreen.downTime = when;
} else {
- motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN
- | (downId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
+ motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN;
}
dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
- activeIdBits, motionEventAction);
+ activeIdBits, downId, motionEventAction);
}
}
}
void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
- InputDevice::TouchData* touch, BitSet32 idBits,
+ InputDevice::TouchData* touch, BitSet32 idBits, uint32_t changedId,
int32_t motionEventAction) {
int32_t orientedWidth, orientedHeight;
switch (mDisplayOrientation) {
@@ -904,12 +902,15 @@ void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t poli
pointerCoords[pointerCount].toolMinor = toolMinor;
pointerCoords[pointerCount].orientation = orientation;
+ if (id == changedId) {
+ motionEventAction |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+ }
+
pointerCount += 1;
}
// Check edge flags by looking only at the first pointer since the flags are
// global to the event.
- // XXX Maybe we should revise the edge flags API to work on a per-pointer basis.
int32_t motionEventEdgeFlags = 0;
if (motionEventAction == AMOTION_EVENT_ACTION_DOWN) {
if (pointerCoords[0].x <= 0) {
diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_InputManager.cpp
index f19f1ec6931d..0992b33f877d 100644
--- a/services/jni/com_android_server_InputManager.cpp
+++ b/services/jni/com_android_server_InputManager.cpp
@@ -410,7 +410,11 @@ NativeInputManager::~NativeInputManager() {
String8 NativeInputManager::dump() {
String8 dump;
dump.append("Native Input Dispatcher State:\n");
- dumpDispatchStateLd(dump);
+
+ { // acquire lock
+ AutoMutex _l(mDisplayLock);
+ dumpDispatchStateLd(dump);
+ } // release lock
return dump;
}
@@ -984,8 +988,8 @@ void NativeInputManager::setInputWindows(JNIEnv* env, jobjectArray windowObjArra
mTempTouchedWallpaperChannels.clear();
- if (hadFocusedWindow && ! mFocusedWindow
- || mFocusedWindow && ! mFocusedWindow->visible) {
+ if ((hadFocusedWindow && ! mFocusedWindow)
+ || (mFocusedWindow && ! mFocusedWindow->visible)) {
preemptInputDispatch();
}