diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-08-10 16:25:21 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-08-10 16:25:21 -0700 |
commit | 89ef0720ee8e0ac6ae1758faa917e4d6c9606fb4 (patch) | |
tree | 2c239993b3d2702dd8becc03a738f1b151a4c4f1 /services/input | |
parent | ba421dddfd558b34726df5dfbf8a3bf748e285b1 (diff) | |
download | frameworks_base-89ef0720ee8e0ac6ae1758faa917e4d6c9606fb4.zip frameworks_base-89ef0720ee8e0ac6ae1758faa917e4d6c9606fb4.tar.gz frameworks_base-89ef0720ee8e0ac6ae1758faa917e4d6c9606fb4.tar.bz2 |
Add input system to Watchdog.
Bug: 5094994
Change-Id: I153866958efc64ac19bda8b997c1c9f6ad425ec4
Diffstat (limited to 'services/input')
-rw-r--r-- | services/input/EventHub.cpp | 7 | ||||
-rw-r--r-- | services/input/EventHub.h | 5 | ||||
-rw-r--r-- | services/input/InputDispatcher.cpp | 8 | ||||
-rw-r--r-- | services/input/InputDispatcher.h | 4 | ||||
-rw-r--r-- | services/input/InputReader.cpp | 9 | ||||
-rw-r--r-- | services/input/InputReader.h | 4 | ||||
-rw-r--r-- | services/input/tests/InputReader_test.cpp | 3 |
7 files changed, 40 insertions, 0 deletions
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index 0a567fd..960e414 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -1294,4 +1294,11 @@ void EventHub::dump(String8& dump) { } // release lock } +void EventHub::monitor() { + // Acquire and release the lock to ensure that the event hub has not deadlocked. + mLock.lock(); + mLock.unlock(); +} + + }; // namespace android diff --git a/services/input/EventHub.h b/services/input/EventHub.h index 08f73ca..fae5d4f 100644 --- a/services/input/EventHub.h +++ b/services/input/EventHub.h @@ -208,7 +208,11 @@ public: /* Wakes up getEvents() if it is blocked on a read. */ virtual void wake() = 0; + /* Dump EventHub state to a string. */ virtual void dump(String8& dump) = 0; + + /* Called by the heatbeat to ensures that the reader has not deadlocked. */ + virtual void monitor() = 0; }; class EventHub : public EventHubInterface @@ -259,6 +263,7 @@ public: virtual void wake(); virtual void dump(String8& dump); + virtual void monitor(); protected: virtual ~EventHub(); diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index ce9e14f..22372cf 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -3919,6 +3919,8 @@ void InputDispatcher::updateDispatchStatisticsLocked(nsecs_t currentTime, const } void InputDispatcher::dump(String8& dump) { + AutoMutex _l(mLock); + dump.append("Input Dispatcher State:\n"); dumpDispatchStateLocked(dump); @@ -3928,6 +3930,12 @@ void InputDispatcher::dump(String8& dump) { dump.appendFormat(INDENT2 "KeyRepeatTimeout: %0.1fms\n", mConfig.keyRepeatTimeout * 0.000001f); } +void InputDispatcher::monitor() { + // Acquire and release the lock to ensure that the dispatcher has not deadlocked. + mLock.lock(); + mLock.unlock(); +} + // --- InputDispatcher::Queue --- diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h index 01c7b35..cae1610 100644 --- a/services/input/InputDispatcher.h +++ b/services/input/InputDispatcher.h @@ -282,6 +282,9 @@ public: * This method may be called on any thread (usually by the input manager). */ virtual void dump(String8& dump) = 0; + /* Called by the heatbeat to ensures that the dispatcher has not deadlocked. */ + virtual void monitor() = 0; + /* Runs a single iteration of the dispatch loop. * Nominally processes one queued event, a timeout, or a response from an input consumer. * @@ -370,6 +373,7 @@ public: explicit InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy); virtual void dump(String8& dump); + virtual void monitor(); virtual void dispatchOnce(); diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index dacc73f..2eacbeb 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -731,6 +731,15 @@ void InputReader::dump(String8& dump) { mConfig.pointerGestureZoomSpeedRatio); } +void InputReader::monitor() { + // Acquire and release the lock to ensure that the reader has not deadlocked. + mLock.lock(); + mLock.unlock(); + + // Check the EventHub + mEventHub->monitor(); +} + // --- InputReader::ContextImpl --- diff --git a/services/input/InputReader.h b/services/input/InputReader.h index e82c4e7..e9daef5 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -210,6 +210,9 @@ public: * This method may be called on any thread (usually by the input manager). */ virtual void dump(String8& dump) = 0; + /* Called by the heatbeat to ensures that the reader has not deadlocked. */ + virtual void monitor() = 0; + /* Runs a single iteration of the processing loop. * Nominally reads and processes one incoming message from the EventHub. * @@ -297,6 +300,7 @@ public: virtual ~InputReader(); virtual void dump(String8& dump); + virtual void monitor(); virtual void loopOnce(); diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp index 4a866a8..87f212b 100644 --- a/services/input/tests/InputReader_test.cpp +++ b/services/input/tests/InputReader_test.cpp @@ -631,6 +631,9 @@ private: virtual void dump(String8& dump) { } + virtual void monitor() { + } + virtual void requestReopenDevices() { } |