summaryrefslogtreecommitdiff
path: root/libs/androidfw/CursorWindow.cpp
diff options
context:
space:
mode:
authorMing-Shin Lu <lumark@google.com>2021-07-15 23:37:00 +0800
committerMing-Shin Lu <lumark@google.com>2021-07-15 17:01:06 +0000
commitf87534c43bce8d7628b958c8c64fdc8a8fc92e9c (patch)
tree9755f0005b43e6de23a43f4b96fcd8ed6f4a99cc /libs/androidfw/CursorWindow.cpp
parent09cb5879a1feaf43d673e966914b674391dd0453 (diff)
Using WindowInsets API to hide keyboard on LockScreen when screen-off
This CL is aim to resolve InputMethodManager#hideSoftInputFromWindow somehow may not succeed even the focused editor won't changed when screen turned off. As CL[1] that we introduced the new app compatibility setting (FINISH_INPUT_NO_FALLBACK_CONNECTION) for IME apps which the targetSdkVersion >= 31. That settings slightly changes the behavior of invoking InputMethodManager#hideSoftInputFromWindow when device screen is off. Since when the device screen-off, system will finish the current input connection and clear the served view on InputMethodManager in order to resolve a long standing unexpected started input connection problem. With that change, SystemUI side may not succeed to call InputMethodManager#hideSoftInputFromWindow when device screen is Off because InputMethodManager side thought the served connection has finished. so InputMethodManager side by default will not pass the hide request if there is no served editor or the served editor has changed that differnce with the caller. Generally, even with or without FINISH_INPUT_NO_FALLBACK_CONNECTION behavior chagnge, we are not expecting the normal app will be able to call hideSoftInputFromWindow when device screen is off, because the window focus will be changed to NotificiationShade, so the hide request won't be succeed because of the served view change. To make the minimun change for SystemUI use case, using WindowInsetsController#hide(ime()) to fix the issue. Since unlike IMM#hideSoftInputFromWindow that requires more restrictions checking the caller's input connection state, WindowInsets API natually tells InputMethodService to hide soft-keyboard if WM thought the IME insets is still controllable by the window. [1]: Id4e71a822bfde5fe6a263bbe094c0d238017efe1 Fix: 192644416 Test: manual as follow steps: 0) from " Settings -> Develop options -> AppCompatibility Changes" -> Select Gboard app, make sure the "FINISH_INPUT_NO_FALLBACK_CONNECTION" has enabled. 1) Select Gboard as default IME apps. 2) Setup a password lock. 3) Pressing power key to turn off and turn on the screen 4) Swiping up to to make keyboard shown when the Password Lock focused the editor. 5) Pressing power key to turn off and turn on the screen again 6) Verify if keyboard is hidden as expected. Test: atest KeyboardVisibilityControlTest Test: atest InputMethodStartInputLifecycleTest Change-Id: I1ab2f0c012ba26f78bb0132e1447e020a74cca43
Diffstat (limited to 'libs/androidfw/CursorWindow.cpp')
0 files changed, 0 insertions, 0 deletions