summaryrefslogtreecommitdiffstats
path: root/core/java/android/inputmethodservice
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2015-06-04 17:46:27 +0900
committerSeigo Nonaka <nona@google.com>2015-06-08 12:47:25 +0900
commite937216c330bfcaf523d9627fe315f89db00e36a (patch)
treec5e4c0794f83887c7abc9f63aca017441a088138 /core/java/android/inputmethodservice
parent683e3cfef17bb1a80d7c387200ac491e663d5af2 (diff)
downloadframeworks_base-e937216c330bfcaf523d9627fe315f89db00e36a.zip
frameworks_base-e937216c330bfcaf523d9627fe315f89db00e36a.tar.gz
frameworks_base-e937216c330bfcaf523d9627fe315f89db00e36a.tar.bz2
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
Diffstat (limited to 'core/java/android/inputmethodservice')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 81a65f8..a7afa91 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;
}