summaryrefslogtreecommitdiffstats
path: root/libs/input
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-10-21 12:05:22 -0700
committerMichael Wright <michaelwr@google.com>2013-10-21 23:57:17 +0000
commit3223217aed6dcfa55b5b952cd6be71f70e41ba63 (patch)
tree6b8badd17124202bd1a2ca77cb15896a7e21d2f5 /libs/input
parent8507586903fa803abf535853a169913f2cf2e555 (diff)
downloadframeworks_native-3223217aed6dcfa55b5b952cd6be71f70e41ba63.zip
frameworks_native-3223217aed6dcfa55b5b952cd6be71f70e41ba63.tar.gz
frameworks_native-3223217aed6dcfa55b5b952cd6be71f70e41ba63.tar.bz2
Only consume touches up until the frame time
When resampling is disabled, it's currently possible to consume touches after the current frame time. This breaks some guarantees and could cause unexpected behaviors. Change-Id: I99908a2cac2df9f795dd4a07188b4451213cf3e4
Diffstat (limited to 'libs/input')
-rw-r--r--libs/input/InputTransport.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 9bd7fc6..09b2e7c 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -511,14 +511,17 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
status_t result;
for (size_t i = mBatches.size(); i-- > 0; ) {
Batch& batch = mBatches.editItemAt(i);
- if (frameTime < 0 || !mResampleTouch) {
+ if (frameTime < 0) {
result = consumeSamples(factory, batch, batch.samples.size(),
outSeq, outEvent);
mBatches.removeAt(i);
return result;
}
- nsecs_t sampleTime = frameTime - RESAMPLE_LATENCY;
+ nsecs_t sampleTime = frameTime;
+ if (mResampleTouch) {
+ sampleTime -= RESAMPLE_LATENCY;
+ }
ssize_t split = findSampleNoLaterThan(batch, sampleTime);
if (split < 0) {
continue;
@@ -532,7 +535,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
} else {
next = &batch.samples.itemAt(0);
}
- if (!result) {
+ if (!result && mResampleTouch) {
resampleTouchState(sampleTime, static_cast<MotionEvent*>(*outEvent), next);
}
return result;