From 6ee82749b8a7992cc0f02271eb3c46f13d1506a6 Mon Sep 17 00:00:00 2001 From: Felix Stern Date: Tue, 10 Dec 2024 14:19:27 +0000 Subject: Set window visibility when user switch is triggered Change-Id: I6c2f68b25e2c3f2040a59bc77e4de404da45c0d2 Test: open work profile chat with IME; go to Launcher and receive chat message; click on notification Fix: 379482310 Flag: android.view.inputmethod.refactor_insets_controller --- .../android/server/inputmethod/InputMethodManagerService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 02dd884ad60d..68001428e567 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -1209,8 +1209,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // Hide soft input before user switch task since switch task may block main handler a while // and delayed the hideCurrentInputLocked(). final var userData = getUserData(userId); - hideCurrentInputLocked(userData.mImeBindingState.mFocusedWindow, 0 /* flags */, - SoftInputShowHideReason.HIDE_SWITCH_USER, userId); + if (Flags.refactorInsetsController()) { + final var statsToken = createStatsTokenForFocusedClient(false /* show */, + SoftInputShowHideReason.HIDE_SWITCH_USER, userId); + setImeVisibilityOnFocusedWindowClient(false, userData, statsToken); + } else { + hideCurrentInputLocked(userData.mImeBindingState.mFocusedWindow, 0 /* flags */, + SoftInputShowHideReason.HIDE_SWITCH_USER, userId); + } final UserSwitchHandlerTask task = new UserSwitchHandlerTask(this, userId, clientToBeReset); mUserSwitchHandlerTask = task; -- cgit v1.2.3-59-g8ed1b