OSDN Git Service

fix KeyEvent can't correctly finish when inputmethod time out happend
authorgaoshang <gaoshang@xiaomi.com>
Thu, 20 Apr 2017 06:14:18 +0000 (14:14 +0800)
committerMichael Wright <michaelwr@google.com>
Thu, 20 Apr 2017 14:22:13 +0000 (15:22 +0100)
Symptom: If inputmethod handle an KeyEvent time out ,
Did not finish this event correctly , eventually lead to app ANR
Root Cause: without seq number when obtainMessage MSG_TIMEOUT_INPUT_EVENT
Solution: add seq parameter

Test: Input
Test: InputMethod
Bug: 28635475

Change-Id: I3a2b964b34aa57267bd777305200a2bfdc66f65c
Signed-off-by: gaoshang <gaoshang@xiaomi.com>
core/java/android/view/inputmethod/InputMethodManager.java

index 958d761..da9316c 100644 (file)
@@ -1954,7 +1954,7 @@ public final class InputMethodManager {
                 Trace.traceCounter(Trace.TRACE_TAG_INPUT, PENDING_EVENT_COUNTER,
                         mPendingEvents.size());
 
-                Message msg = mH.obtainMessage(MSG_TIMEOUT_INPUT_EVENT, p);
+                Message msg = mH.obtainMessage(MSG_TIMEOUT_INPUT_EVENT, seq, 0, p);
                 msg.setAsynchronous(true);
                 mH.sendMessageDelayed(msg, INPUT_METHOD_NOT_RESPONDING_TIMEOUT);
                 return DISPATCH_IN_PROGRESS;