Skip to content
Commit 0df88124 authored by lumark's avatar lumark Committed by Ming-Shin Lu
Browse files

Finish input when the screen state is off

Add ImeFocusController#onScreenStateChanged callback for ViewRootImpl to
callback the screen state for ImeFocusController, and then check the served
view to finish input connection when the screen state is off.

With this change, we can remove InputMethodManagerService#setInteractive
related codes, since we still can finish current input connection
once the device is screen off, ensures the security behavior remains
the same.

This change is expected to reduce accumulated technical debt introduced
by [Prior works] to address multiple edge cases [1][2][3][4], especially
around window focus changes and display-off events.

[Prior works]
 [1]. Re-start input when the IME is deactivated but window is focused
        (Bug 6188159)
          I9189e6d2ac90aa8c621fdb44989728101e00329d
          31e4e149
 [2]. Fix a crash in InputMethodManager when switching the IME in the
      system process
        (Bug  6789252)
          I66f51da1299532793ef8fa700f35b0811670f235
          4e5184f9
 [3]. Call startInput on return from sleep mode
        (Bug 17558972)
          I95d05110bc1cf310fad23ea1bcbc5890f642d1fc
          82ae3ff4
 [4]. Make IMM more robust to spurious window focus-in
        (Bug 26851566)
          I60adb38013b063918b074c7b947649eada77b2c8
          8e9214b4

Note that one behavior change is that when the screen is on and window focus
back to the app, if the app previously did't request show soft input explictly,
InputMethodManager will not request to show soft-keyboard explicitly for the
next served view.

Fix: 26851566
Bug: 141738570
Bug: 9216494

Test: atest SearchViewTest, FocusHandlingTest
Test: atest ActivityViewTest, MultiDisplayClientTests,
      MultiDisplaySystemDecorationTests

Change-Id: Ic11956fe745a829da1ec7c09ea214e9b3961c8e0
parent a72d7e53
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