Skip to content

Commit b570c64

Browse files
author
Victoria Lease
committed
avert 2500ms wait in InputMethodManager
When dispatching input events to the main thread, the event is handled directly rather than queued. If we have a timeout waiting for the event to happen, it has to be registered before we call the dispatcher, otherwise we'll wait for the timeout even though the event has already been handled. Bug: 6734044 Change-Id: I6826163dbc6133b385cf1076bb077fb4e82870a1
1 parent 2e9aa74 commit b570c64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/java/android/view/inputmethod/InputMethodManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,8 @@ public void dispatchKeyEvent(Context context, int seq, KeyEvent key,
15771577
try {
15781578
if (DEBUG) Log.v(TAG, "DISPATCH KEY: " + mCurMethod);
15791579
final long startTime = SystemClock.uptimeMillis();
1580-
mCurMethod.dispatchKeyEvent(seq, key, mInputMethodCallback);
15811580
enqueuePendingEventLocked(startTime, seq, mCurId, callback);
1581+
mCurMethod.dispatchKeyEvent(seq, key, mInputMethodCallback);
15821582
return;
15831583
} catch (RemoteException e) {
15841584
Log.w(TAG, "IME died: " + mCurId + " dropping: " + key, e);
@@ -1602,8 +1602,8 @@ void dispatchTrackballEvent(Context context, int seq, MotionEvent motion,
16021602
try {
16031603
if (DEBUG) Log.v(TAG, "DISPATCH TRACKBALL: " + mCurMethod);
16041604
final long startTime = SystemClock.uptimeMillis();
1605-
mCurMethod.dispatchTrackballEvent(seq, motion, mInputMethodCallback);
16061605
enqueuePendingEventLocked(startTime, seq, mCurId, callback);
1606+
mCurMethod.dispatchTrackballEvent(seq, motion, mInputMethodCallback);
16071607
return;
16081608
} catch (RemoteException e) {
16091609
Log.w(TAG, "IME died: " + mCurId + " dropping trackball: " + motion, e);

0 commit comments

Comments
 (0)