Fix Keyboard not show up when launch device control with security lock

When keyguard bouncer visiblity changes,
KeyguardPasswordViewController#onResume will be invoked when in password
lock, and then calling IMM#showSoftInput to show soft-keyboard.

However, if the visiblity change timing is come before the notification
focus changed, invoking IMM#showSoftInput may be ignored because the
window of the editor is not yet to be IME served window.

Using WindowInsetsController#show(ime()) to fix this invoking timing
issue as the show request will be scheduled once the window is focused
and ensure checking the served view focus is up-to-date with CL[1].

[1]: Ib41412d5d5636bdc236aa94c4ee4702686b6d10f

Fix: 200051968
Test: manual as issue steps:
   0. Download google home app with setup home control.
   1. Device is setup with "Password" screen lock.
   2. From lock screen, tap on "Device control" (Home symbol) >
      Click 3 dot menu > Select "Add / Edit" controls and observe
   4. Expect the passowrd view with soft-keyboard is shown.
Change-Id: I0e3d35cd656cbb13de9fc77f67f499c11495d89c
This commit is contained in:
Ming-Shin Lu
2021-09-17 10:20:52 +08:00
parent a7efb5e025
commit 4951270992

View File

@@ -208,8 +208,7 @@ public class KeyguardPasswordViewController
mView.post(() -> {
if (mView.isShown()) {
mPasswordEntry.requestFocus();
mInputMethodManager.showSoftInput(
mPasswordEntry, InputMethodManager.SHOW_IMPLICIT);
mPasswordEntry.getWindowInsetsController().show(WindowInsets.Type.ime());
}
});
}