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
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 @@
nsecs_t nextWakeupTime = LONG_LONG_MAX;
{ // acquire lock
AutoMutex _l(mLock);
+ mDispatcherIsAliveCondition.broadcast();
+
dispatchOnceInnerLocked(&nextWakeupTime);
if (runCommandsLockedInterruptible()) {
@@ -4086,6 +4088,8 @@
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();
}