summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2016-01-12 11:54:58 -0800
committerYohei Yukawa <yukawa@google.com>2016-01-12 12:17:42 -0800
commitcf8403bc36395eecd9ab03c6b5e128272c3592e9 (patch)
tree55db2332cd30737b8315063b0d8d1dfcbd5a8859 /core/java/android/inputmethodservice/InputMethodService.java
parent12705131b95d5d6bcfae79d7991ff3e6f02457e4 (diff)
Suppress NPE in IMS#onEvaluateInputViewShown().
This is a follow up CL for the previous commit [1], which may have triggered an unknown bug in either Android Framework or LatinIME. [1]: Id4d332e3909590c68345e10e1f2e18650efb2eb7 7b739a802cb7d97460a0bf8a1e9774efe96fa552 InputMethodService#mSettingsObserver is initialized in #onCreate() and cleard with null in #onDestroy(). Hence hitting NPE against it implies that InputMethodService#onEvaluateInputViewShown() can be called before InputMethodService#onCreate() or after InputMethodService#onDestroy(). Both possibilities are equaly problematic. Note that this might be a long-standing issue that just became obvious because of [1]. This CL does not attempt to fix the root cause but just tries to suppresses the NPE to unblock QA tasks. A proper fix should be made in subsequent CLs. Bug: 22517687 Bug: 26511607 Change-Id: I6bc87c3d18b560fe2253fb9f05557b95b04d0cf0
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index f642f08df76e..282688295fee 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1258,6 +1258,10 @@ public class InputMethodService extends AbstractInputMethodService {
*/
@CallSuper
public boolean onEvaluateInputViewShown() {
+ if (mSettingsObserver == null) {
+ Log.w(TAG, "onEvaluateInputViewShown: mSettingsObserver must not be null here.");
+ return false;
+ }
if (mSettingsObserver.shouldShowImeWithHardKeyboard()) {
return true;
}