diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-01-27 17:37:31 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-27 17:37:31 -0800 |
commit | cb0af4f1b0709b236a030f41c75edd97cf0bf1fd (patch) | |
tree | 772ae4db2d2ccfe56cb6e6ef2532a565b2ea6670 /services | |
parent | 2d2d7d6f42fe22ecc2b1dc8bb96a19e503a61a20 (diff) | |
parent | 112b5f52c5a4b6743eeb7b26a8896c7636c74455 (diff) | |
download | frameworks_base-cb0af4f1b0709b236a030f41c75edd97cf0bf1fd.zip frameworks_base-cb0af4f1b0709b236a030f41c75edd97cf0bf1fd.tar.gz frameworks_base-cb0af4f1b0709b236a030f41c75edd97cf0bf1fd.tar.bz2 |
Merge "Improve watchdog monitor for InputReader and InputDispatcher."
Diffstat (limited to 'services')
-rw-r--r-- | services/input/InputDispatcher.cpp | 4 | ||||
-rw-r--r-- | services/input/InputDispatcher.h | 2 | ||||
-rw-r--r-- | services/input/InputReader.cpp | 11 | ||||
-rw-r--r-- | services/input/InputReader.h | 2 |
4 files changed, 16 insertions, 3 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index 9f09062..ad64ccd 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -238,6 +238,8 @@ void InputDispatcher::dispatchOnce() { nsecs_t nextWakeupTime = LONG_LONG_MAX; { // acquire lock AutoMutex _l(mLock); + mDispatcherIsAliveCondition.broadcast(); + dispatchOnceInnerLocked(&nextWakeupTime); if (runCommandsLockedInterruptible()) { @@ -4086,6 +4088,8 @@ void InputDispatcher::dump(String8& dump) { void InputDispatcher::monitor() { // Acquire and release the lock to ensure that the dispatcher has not deadlocked. mLock.lock(); + mLooper->wake(); + mDispatcherIsAliveCondition.wait(mLock); mLock.unlock(); } diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h index 1478d67..a1d42e1 100644 --- a/services/input/InputDispatcher.h +++ b/services/input/InputDispatcher.h @@ -862,6 +862,8 @@ private: Mutex mLock; + Condition mDispatcherIsAliveCondition; + sp<Looper> mLooper; EventEntry* mPendingEvent; diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index fa0b3d8..4be06e4 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 diff --git a/services/input/InputReader.h b/services/input/InputReader.h index a122c97..ad89a22 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -363,6 +363,8 @@ protected: private: Mutex mLock; + Condition mReaderIsAliveCondition; + sp<EventHubInterface> mEventHub; sp<InputReaderPolicyInterface> mPolicy; sp<QueuedInputListener> mQueuedListener; |