Skip to content
Commit 4d356f19 authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Reset mServedView when failing to start input by not target window

Fix a timing issue that when the window using ALT_FOCUSABLE_IM flag to
disable starting the input, if the next time the app attempts to remove the flag
and when focusing the editor to start the input but somehow added the flag
back during IMMS#startInputOrWindowGainedFocus, then the system will fail to
start the input with NOT_IME_TARGET_WINDOW result to client.

This will fall into a bad consequence to make InputMethodManager thought
the servedView (the editor) has already served but actually the input connection
was not being refreshed, then ends up showing the keyboard but no-ops
when typing the text.

Reset mServedView when failing to start input by NOT_IME_TARGET_WINDOW
to ensure InputMethodManager#checkFocus will fetch the next served view
to start the input again.

Bug: 260682160
Test: atest CtsInputMethodDeviceTests
Test: manual with test steps:
   0-1) Setup a password lock from Settings > Security
   0-2) make and install EditTextVariations
   0-3) In Setttings > Apps, enable "Notification" and
        "Display over other apps" for EditTextVariations app
   1) Launch EditTexVariations app
   2) Menu -> Select "Direct Reply" to popup a HUN
   3) Turn off/on the screen
   4) In the lockscreen, expand "Message from UserHandle" notification
      and press "Direct Reply Test" button
   5) Expect the password lock shows up and enter the password
   6) Verify the keyboard should show up and focusing on the
      notification editor.
   7) Verify the keyboard can input the text on the notification editor.

Change-Id: I788373d3fc28ce352f32856a195d04fa670d809f
parent 7be7d95f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment