summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ming-Shin Lu <lumark@google.com> 2020-04-13 23:23:34 +0800
committer Ming-Shin Lu <lumark@google.com> 2020-04-16 20:39:54 +0800
commita56779d1ab1f73385881cab4a945f376df27a84c (patch)
treed81722adc91ba53bf6f034e96aba1d178c221ec3
parentb839af1f4586f9256dd494032825a96539523939 (diff)
Fix the logics in ImeFocusController#onPostWindowFocus
In ImeFocusController#onPostWindowFocus -> onViewFocusChanged, it implies that the view has focus after onPostWindowFocus, this logics we keep leveraged from IMM#onPostWindowFocus -> focusInLocked() long ago, which may not always be true as SearchView layout may call View#clearFocus when size changed after IME switcher shown. When IME switched and back to app activity, in the above call path, even activity window focused, and set the fallback focus view as activity's root view, but the root view is not actually focused, if we set this view as the next served view, then calling View#onCreateInputConnection will return null, because it's not an editor. Use correct view focus state when calling onViewFocusChanged. Fix: 153612876 Test: manual as below: 1) Launch Files app, taps SearchView EditText 2) switch IMEs with IME switcher dialog 3) see if Password keyboard shown. 4) keeps 2) and 3) several time. Expected: There is no password keyboard and the keyboard input is still workable. Change-Id: I68bb95fc3cbfe1f5992ccf87694b34c3e52bb31f
-rw-r--r--core/java/android/view/ImeFocusController.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/view/ImeFocusController.java b/core/java/android/view/ImeFocusController.java
index dbbe4b61c81c..d6d9fc628ac9 100644
--- a/core/java/android/view/ImeFocusController.java
+++ b/core/java/android/view/ImeFocusController.java
@@ -123,7 +123,7 @@ public final class ImeFocusController {
}
// Update mNextServedView when focusedView changed.
final View viewForWindowFocus = focusedView != null ? focusedView : mViewRootImpl.mView;
- onViewFocusChanged(viewForWindowFocus, true);
+ onViewFocusChanged(viewForWindowFocus, viewForWindowFocus.hasFocus());
immDelegate.startInputAsyncOnWindowFocusGain(viewForWindowFocus,
windowAttribute.softInputMode, windowAttribute.flags, forceFocus);