From 869347fc62bcb1f1e5ccdd403c952b21bc9b1ab7 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 19 Aug 2010 11:55:13 -0700 Subject: [PATCH] Make the throttling more sensitive to end-to-end latency. The code now takes into account the time when the event was generated. So with a 60Hz throttling rate, it ensures that a motion event will not be delayed due to throttling by any more than 1/60th of second past the time it was generated. Change-Id: Iaea1d4f76e79036b4a18873485230731c3cd63c3 --- libs/ui/InputDispatcher.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index ce616a475..e35050cb6 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -201,7 +201,8 @@ void InputDispatcher::dispatchOnce() { } #endif - mThrottleState.lastEventTime = currentTime; + mThrottleState.lastEventTime = entry->eventTime < currentTime + ? entry->eventTime : currentTime; mThrottleState.lastDeviceId = deviceId; mThrottleState.lastSource = source; }