am dcfbb618: Merge "Catch BadTokenException and continue in clearInsetofPreviousIme." into mnc-dev

* commit 'dcfbb618e33f432d83c56a79e71aeec5d81bbacd':
  Catch BadTokenException and continue in clearInsetofPreviousIme.
This commit is contained in:
Seigo Nonaka
2015-06-08 16:42:38 +00:00
committed by Android Git Automerger

View File

@@ -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;
}