summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/gui/IGraphicBufferProducer.cpp6
-rw-r--r--libs/input/InputTransport.cpp13
2 files changed, 14 insertions, 5 deletions
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp
index d7a78850dd..8bdbc22ec9 100644
--- a/libs/gui/IGraphicBufferProducer.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -348,7 +348,7 @@ status_t BnGraphicBufferProducer::onTransact(
uint32_t height = data.readUint32();
PixelFormat format = static_cast<PixelFormat>(data.readInt32());
uint32_t usage = data.readUint32();
- int buf;
+ int buf = 0;
sp<Fence> fence;
int result = dequeueBuffer(&buf, &fence, async, width, height,
format, usage);
@@ -389,7 +389,7 @@ status_t BnGraphicBufferProducer::onTransact(
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
sp<GraphicBuffer> buffer = new GraphicBuffer();
data.read(*buffer.get());
- int slot;
+ int slot = 0;
int result = attachBuffer(&slot, buffer);
reply->writeInt32(slot);
reply->writeInt32(result);
@@ -416,7 +416,7 @@ status_t BnGraphicBufferProducer::onTransact(
}
case QUERY: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
- int value;
+ int value = 0;
int what = data.readInt32();
int res = query(what, &value);
reply->writeInt32(value);
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 0382f5788f..7f83da523f 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -51,6 +51,10 @@ static const nsecs_t RESAMPLE_LATENCY = 5 * NANOS_PER_MS;
// Minimum time difference between consecutive samples before attempting to resample.
static const nsecs_t RESAMPLE_MIN_DELTA = 2 * NANOS_PER_MS;
+// Maximum time difference between consecutive samples before attempting to resample
+// by extrapolation.
+static const nsecs_t RESAMPLE_MAX_DELTA = 20 * NANOS_PER_MS;
+
// Maximum time to predict forward from the last known state, to avoid predicting too
// far into the future. This time is further bounded by 50% of the last time delta.
static const nsecs_t RESAMPLE_MAX_PREDICTION = 8 * NANOS_PER_MS;
@@ -724,7 +728,7 @@ void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
nsecs_t delta = future.eventTime - current->eventTime;
if (delta < RESAMPLE_MIN_DELTA) {
#if DEBUG_RESAMPLING
- ALOGD("Not resampled, delta time is %lld ns.", delta);
+ ALOGD("Not resampled, delta time is too small: %lld ns.", delta);
#endif
return;
}
@@ -736,7 +740,12 @@ void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
nsecs_t delta = current->eventTime - other->eventTime;
if (delta < RESAMPLE_MIN_DELTA) {
#if DEBUG_RESAMPLING
- ALOGD("Not resampled, delta time is %lld ns.", delta);
+ ALOGD("Not resampled, delta time is too small: %lld ns.", delta);
+#endif
+ return;
+ } else if (delta > RESAMPLE_MAX_DELTA) {
+#if DEBUG_RESAMPLING
+ ALOGD("Not resampled, delta time is too large: %lld ns.", delta);
#endif
return;
}