From 4951270992b781b0cfc42c30c5d8482e248b6100 Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Fri, 17 Sep 2021 10:20:52 +0800 Subject: [PATCH] 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 --- .../com/android/keyguard/KeyguardPasswordViewController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java index 92f8454fc93eb..0529cdbcbb139 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java @@ -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()); } }); }