diff options
| author | 2015-06-08 05:36:07 +0000 | |
|---|---|---|
| committer | 2015-06-08 05:36:10 +0000 | |
| commit | dcfbb618e33f432d83c56a79e71aeec5d81bbacd (patch) | |
| tree | d9511b7d155ecc4710ead7605754d690fdf22059 | |
| parent | dc540ea067c939cc58fc05e29925b2928abefc79 (diff) | |
| parent | e937216c330bfcaf523d9627fe315f89db00e36a (diff) | |
Merge "Catch BadTokenException and continue in clearInsetofPreviousIme." into mnc-dev
| -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; } |