diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-04-06 17:22:26 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-04-06 17:22:26 -0700 |
commit | ae4dd53e8d92c3fbd5eb27d90bade1db3b1d3540 (patch) | |
tree | 03cc0a61d1c907138fe8e8b47c5fb92300e874b5 /services | |
parent | 6a839703cd9aa72f5c6f107d0a8f894601d5c308 (diff) | |
parent | f6989da7c7727ad433b75ad2c8d8d23c2651f70b (diff) | |
download | frameworks_base-ae4dd53e8d92c3fbd5eb27d90bade1db3b1d3540.zip frameworks_base-ae4dd53e8d92c3fbd5eb27d90bade1db3b1d3540.tar.gz frameworks_base-ae4dd53e8d92c3fbd5eb27d90bade1db3b1d3540.tar.bz2 |
Merge "Allow batching samples onto the pending motion event."
Diffstat (limited to 'services')
-rw-r--r-- | services/input/InputDispatcher.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index 253d070..810b709 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -2524,6 +2524,34 @@ void InputDispatcher::notifyMotion(nsecs_t eventTime, int32_t deviceId, uint32_t return; // done! } + // BATCHING ONTO PENDING EVENT CASE + // + // Try to append a move sample to the currently pending event, if there is one. + // We can do this as long as we are still waiting to find the targets for the + // event. Once the targets are locked-in we can only do streaming. + if (mPendingEvent + && (!mPendingEvent->dispatchInProgress || !mCurrentInputTargetsValid) + && mPendingEvent->type == EventEntry::TYPE_MOTION) { + MotionEntry* motionEntry = static_cast<MotionEntry*>(mPendingEvent); + if (motionEntry->deviceId == deviceId && motionEntry->source == source) { + if (motionEntry->action != action + || motionEntry->pointerCount != pointerCount + || motionEntry->isInjected()) { + // Pending event is not compatible for appending new samples. Stop here. + goto NoBatchingOrStreaming; + } + + // The pending motion event is a move and is compatible for appending. + // Do the batching magic. + mAllocator.appendMotionSample(motionEntry, eventTime, pointerCoords); +#if DEBUG_BATCHING + LOGD("Appended motion sample onto batch for the pending motion event."); +#endif + mLock.unlock(); + return; // done! + } + } + // STREAMING CASE // // There is no pending motion event (of any kind) for this device in the inbound queue. |