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

Commit 9d91b43c authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Do not pass null to IInputMethod#setSessionEnabled

It doen't make sense to pass null as IInputMethodSession
for IInputMethod#setSessionEnabled. If we do this, it
causes NPE.

BUG: 14980068
Change-Id: Ide48d098d5e7640890257e31f8872e79b9821eb2
parent b0650e8f
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -2369,23 +2369,23 @@ public class InputMethodManagerService extends IInputMethodManager.Stub

    void setEnabledSessionInMainThread(SessionState session) {
        if (mEnabledSession != session) {
            if (mEnabledSession != null) {
            if (mEnabledSession != null && mEnabledSession.session != null) {
                try {
                    if (DEBUG) Slog.v(TAG, "Disabling: " + mEnabledSession);
                    mEnabledSession.method.setSessionEnabled(
                            mEnabledSession.session, false);
                    mEnabledSession.method.setSessionEnabled(mEnabledSession.session, false);
                } catch (RemoteException e) {
                }
            }
            mEnabledSession = session;
            if (mEnabledSession != null && mEnabledSession.session != null) {
                try {
                    if (DEBUG) Slog.v(TAG, "Enabling: " + mEnabledSession);
                session.method.setSessionEnabled(
                        session.session, true);
                    mEnabledSession.method.setSessionEnabled(mEnabledSession.session, true);
                } catch (RemoteException e) {
                }
            }
        }
    }

    @Override
    public boolean handleMessage(Message msg) {