Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf8403bc authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
       7b739a80

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
parent 12705131
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1258,6 +1258,10 @@ public class InputMethodService extends AbstractInputMethodService {
     */
     */
    @CallSuper
    @CallSuper
    public boolean onEvaluateInputViewShown() {
    public boolean onEvaluateInputViewShown() {
        if (mSettingsObserver == null) {
            Log.w(TAG, "onEvaluateInputViewShown: mSettingsObserver must not be null here.");
            return false;
        }
        if (mSettingsObserver.shouldShowImeWithHardKeyboard()) {
        if (mSettingsObserver.shouldShowImeWithHardKeyboard()) {
            return true;
            return true;
        }
        }