am 3223217a: Only consume touches up until the frame time

* commit '3223217aed6dcfa55b5b952cd6be71f70e41ba63':
  Only consume touches up until the frame time
This commit is contained in:
Michael Wright 2013-10-21 17:23:55 -07:00 committed by Android Git Automerger
commit 47f0b9894b

View File

@ -511,14 +511,17 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
status_t result; status_t result;
for (size_t i = mBatches.size(); i-- > 0; ) { for (size_t i = mBatches.size(); i-- > 0; ) {
Batch& batch = mBatches.editItemAt(i); Batch& batch = mBatches.editItemAt(i);
if (frameTime < 0 || !mResampleTouch) { if (frameTime < 0) {
result = consumeSamples(factory, batch, batch.samples.size(), result = consumeSamples(factory, batch, batch.samples.size(),
outSeq, outEvent); outSeq, outEvent);
mBatches.removeAt(i); mBatches.removeAt(i);
return result; return result;
} }
nsecs_t sampleTime = frameTime - RESAMPLE_LATENCY; nsecs_t sampleTime = frameTime;
if (mResampleTouch) {
sampleTime -= RESAMPLE_LATENCY;
}
ssize_t split = findSampleNoLaterThan(batch, sampleTime); ssize_t split = findSampleNoLaterThan(batch, sampleTime);
if (split < 0) { if (split < 0) {
continue; continue;
@ -532,7 +535,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
} else { } else {
next = &batch.samples.itemAt(0); next = &batch.samples.itemAt(0);
} }
if (!result) { if (!result && mResampleTouch) {
resampleTouchState(sampleTime, static_cast<MotionEvent*>(*outEvent), next); resampleTouchState(sampleTime, static_cast<MotionEvent*>(*outEvent), next);
} }
return result; return result;