Bug 831862 - Force restart input during notifyIMEEnabled; r=cpeterson

This commit is contained in:
Jim Chen 2013-01-18 15:49:19 -05:00
parent 816905dd21
commit d3b8ad4552

View File

@ -200,14 +200,18 @@ class GeckoInputConnection
} }
} }
private void restartInput() { private void tryRestartInput() {
// Coalesce restartInput calls because InputMethodManager.restartInput() // Coalesce restartInput calls because InputMethodManager.restartInput()
// is expensive and successive calls to it can lock up the keyboard // is expensive and successive calls to it can lock up the keyboard
long time = SystemClock.uptimeMillis(); if (SystemClock.uptimeMillis() < mLastRestartInputTime + 200) {
if (time < mLastRestartInputTime + 200) {
return; return;
} }
mLastRestartInputTime = time; restartInput();
}
private void restartInput() {
mLastRestartInputTime = SystemClock.uptimeMillis();
final InputMethodManager imm = getInputMethodManager(); final InputMethodManager imm = getInputMethodManager();
if (imm == null) { if (imm == null) {
@ -515,7 +519,7 @@ class GeckoInputConnection
case NOTIFY_IME_RESETINPUTSTATE: case NOTIFY_IME_RESETINPUTSTATE:
// Commit and end composition // Commit and end composition
finishComposingText(); finishComposingText();
restartInput(); tryRestartInput();
break; break;
case NOTIFY_IME_FOCUSCHANGE: case NOTIFY_IME_FOCUSCHANGE: