diff options
author | 2011-03-17 01:34:19 -0700 | |
---|---|---|
committer | 2011-03-17 17:29:09 -0700 | |
commit | aa3855d5836d2a2d83baafdf6e40caf90d3dad1c (patch) | |
tree | 5f19b7bd1c42abf7e145637ed3459cf377fa94b9 /services/input/InputDispatcher.cpp | |
parent | 843e29d3751017267b96565c543df0301c31a9f7 (diff) |
Refactor how timeouts are calculated.
Added a timeout mechanism to EventHub and InputReader so that
InputMappers can request timeouts to perform delayed processing of
input when needed.
Change-Id: Iec2045baaf4e67690b15eef3c09a58d5cac76897
Diffstat (limited to 'services/input/InputDispatcher.cpp')
-rw-r--r-- | services/input/InputDispatcher.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index ff26fc96ad89..456e0e6ecb41 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -238,15 +238,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); } |