diff options
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 81a65f8f38ea..a7afa91e3fae 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -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; } |
