From 9e3642a928042aef03c2686de485bfcd5bb34af0 Mon Sep 17 00:00:00 2001 From: czq Date: Wed, 23 Nov 2022 11:30:39 +0800 Subject: [PATCH] Fix bug of keyboard hidden after rotating to landscape mode. Add logic in IMS#onShowInputRequested: if IMS receives a Implicit show request and the keyboard is already shown in full screen mode, there is no need to hide it. Otherwise it would hide the keyboard after rotating to landscape mode, because the rotation causes recreation of the activity and triggers auto-show behavior of Ime. Bug: 256739702 Test: manually test Change-Id: I195c2c6bd6f6815806dc90f0a386b7c0bccee7a1 --- .../android/inputmethodservice/InputMethodService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index bf4fc4a72fdcf..fb66cb9cfcc61 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -2766,12 +2766,12 @@ public class InputMethodService extends AbstractInputMethodService { return false; } if ((flags&InputMethod.SHOW_EXPLICIT) == 0) { - if (!configChange && onEvaluateFullscreenMode()) { + if (!configChange && onEvaluateFullscreenMode() && !isInputViewShown()) { // Don't show if this is not explicitly requested by the user and - // the input method is fullscreen. That would be too disruptive. - // However, we skip this change for a config change, since if - // the IME is already shown we do want to go into fullscreen - // mode at this point. + // the input method is fullscreen unless it is already shown. That + // would be too disruptive. However, we skip this change for a + // config change, since if the IME is already shown we do want to + // go into fullscreen mode at this point. return false; } if (!mSettingsObserver.shouldShowImeWithHardKeyboard() &&