Fix NPE when IMM#invalidateInput() is called too early

This is a follow up CL to my previous CL [1], which introduced

  InputMethodManager#invalidateInput(View).

One thing I overlooked is that apps may call that API even before

  InputMethodManager#mCurrentInputMethodSession,

which results in a NullPointerException.

With this CL, such a case will be gracefully fallen back into

  InputMethodManager#restartInput(View)

like other cases when IMM#invalidateInput() is not available.

 [1]: I3161755779080f98bcef0e47dd0c5247d8a3a256
      daa6695c2ee8f7a8a9d724e4169ced4d28edc54d

Fix: 213350732
Test: atest CtsInputMethodTestCases:InputMethodStartInputLifecycleTest
Change-Id: I67458494b3069498a1395e3278f6a975e821e610
2 files changed