From 68d6075b4ad2205c10064c78cde552e3210cca91 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 17 Mar 2011 01:34:19 -0700 Subject: Refactor how timeouts are calculated. (DO NOT MERGE) Added a timeout mechanism to EventHub and InputReader so that InputMappers can request timeouts to perform delayed processing of input when needed. Change-Id: I89c1171c9326c6e413042e3ee13aa9f7f1fc0454 --- services/input/InputDispatcher.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'services/input/InputDispatcher.cpp') diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index 53dc769309dd..ce8f076707a9 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -246,15 +246,7 @@ void InputDispatcher::dispatchOnce() { // Wait for callback or timeout or wake. (make sure we round up, not down) nsecs_t currentTime = now(); - int32_t timeoutMillis; - if (nextWakeupTime > currentTime) { - uint64_t timeout = uint64_t(nextWakeupTime - currentTime); - timeout = (timeout + 999999LL) / 1000000LL; - timeoutMillis = timeout > INT_MAX ? -1 : int32_t(timeout); - } else { - timeoutMillis = 0; - } - + int timeoutMillis = toMillisecondTimeoutDelay(currentTime, nextWakeupTime); mLooper->pollOnce(timeoutMillis); } -- cgit v1.2.3-59-g8ed1b