Fix blocked event handling in InputDispatcher.
Bug: 5161854

The InputDispatcher contains code to recover from ANRs more quickly
when the user touches a different application.  When triggered,
it sets mNextUnblockedEvent to the next event it should dispatch
(to the next application).  All prior events are dropped.

This change fixes a bug where mNextUnblockedEvent could potentially
never be reset back to NULL if the inbound queue was drained
for some reason.

Change-Id: I21be2f02c9fc770bd260ea414db8bb184df89ada
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 22372cf1..cbdfe8c 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -666,6 +666,9 @@
 #endif
         setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_FAILED);
     }
+    if (entry == mNextUnblockedEvent) {
+        mNextUnblockedEvent = NULL;
+    }
     entry->release();
 }