From 0f4d7bc1844af4934a0288e715a4f1350fd5dac2 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 19 Aug 2010 11:55:13 -0700 Subject: 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(-) (limited to 'libs/ui/InputDispatcher.cpp') diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index ce616a475c42..e35050cb6e4c 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; } -- cgit v1.2.3-59-g8ed1b