diff options
| author | 2012-01-27 17:32:06 -0800 | |
|---|---|---|
| committer | 2012-01-27 17:33:42 -0800 | |
| commit | 112b5f52c5a4b6743eeb7b26a8896c7636c74455 (patch) | |
| tree | b9e6ce9e78630475cea99044392dbb3c183626c4 /services/input/InputReader.cpp | |
| parent | 75ea64fc54f328d37b115cfb1ded1e45c30380ed (diff) | |
Improve watchdog monitor for InputReader and InputDispatcher.
Try harder to test for liveness. There are situations where
the lock might not be held but the input system is stuck in
a callback into the window manager policy that has hung.
Bug: 5094994
Change-Id: Iff88655512a5dc8bbb4615be65f4115e975c020b
Diffstat (limited to 'services/input/InputReader.cpp')
| -rw-r--r-- | services/input/InputReader.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index fa0b3d8ee1da..4be06e43d112 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -278,17 +278,20 @@ void InputReader::loopOnce() { { // acquire lock AutoMutex _l(mLock); + mReaderIsAliveCondition.broadcast(); if (count) { processEventsLocked(mEventBuffer, count); } if (!count || timeoutMillis == 0) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + if (now >= mNextTimeout) { #if DEBUG_RAW_EVENTS - ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); + ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); #endif - mNextTimeout = LLONG_MAX; - timeoutExpiredLocked(now); + mNextTimeout = LLONG_MAX; + timeoutExpiredLocked(now); + } } } // release lock @@ -772,6 +775,8 @@ void InputReader::dump(String8& dump) { void InputReader::monitor() { // Acquire and release the lock to ensure that the reader has not deadlocked. mLock.lock(); + mEventHub->wake(); + mReaderIsAliveCondition.wait(mLock); mLock.unlock(); // Check the EventHub |