Catch BadTokenException and continue in clearInsetofPreviousIme.
This is a follow up CL for Ib04967f39b2529251e4835c42e9f99dba2cf43f2. As well explained in the I2c21573cf972145ab08e66604cdb9344139a3f31, the race condition here cannot be avoided without an unacceptable performance penalty. For now, we follow the same way. Bug: 21600287 Change-Id: I0ffdf8bf7e8a53cf8aba1339024b32da65d4f32d
This commit is contained in:
@@ -1565,11 +1565,17 @@ public class InputMethodService extends AbstractInputMethodService {
|
||||
if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme() "
|
||||
+ " mShouldClearInsetOfPreviousIme=" + mShouldClearInsetOfPreviousIme);
|
||||
if (!mShouldClearInsetOfPreviousIme || mWindow == null) return;
|
||||
// We do not call onWindowShown() and onWindowHidden() so as not to make the IME author
|
||||
// confused.
|
||||
// TODO: Find out a better way which has less side-effect.
|
||||
mWindow.show();
|
||||
mWindow.hide();
|
||||
try {
|
||||
// We do not call onWindowShown() and onWindowHidden() so as not to make the IME author
|
||||
// confused.
|
||||
// TODO: Find out a better way which has less side-effect.
|
||||
mWindow.show();
|
||||
mWindow.hide();
|
||||
} catch (WindowManager.BadTokenException e) {
|
||||
if (DEBUG) Log.v(TAG, "clearInsetOfPreviousIme: BadTokenException: IME is done.");
|
||||
mWindowVisible = false;
|
||||
mWindowAdded = false;
|
||||
}
|
||||
mShouldClearInsetOfPreviousIme = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user