summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-02-04 08:13:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-02-04 08:13:29 +0000
commitae19a2d59632210dfa84c79ae4b8c399cfabdb42 (patch)
tree6f278eee50f72da621564f4013ccb2d8127f921a
parentbbc78d5d59c6ff4b5801544dc6c1213b1f6db1d5 (diff)
parent233164c924d7f14be201574287e0f7c4e1e9bba9 (diff)
Merge "Fix Keyboard won't show up in some cases"
-rw-r--r--core/java/android/view/ImeFocusController.java8
-rw-r--r--core/java/android/view/View.java7
-rw-r--r--core/java/android/view/ViewRootImpl.java3
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java5
4 files changed, 15 insertions, 8 deletions
diff --git a/core/java/android/view/ImeFocusController.java b/core/java/android/view/ImeFocusController.java
index 8d58ee83cd67..67e88a5a1831 100644
--- a/core/java/android/view/ImeFocusController.java
+++ b/core/java/android/view/ImeFocusController.java
@@ -253,4 +253,12 @@ public final class ImeFocusController {
public void setNextServedView(View view) {
mNextServedView = view;
}
+
+ /**
+ * Indicates whether the view's window has IME focused.
+ */
+ @UiThread
+ boolean hasImeFocus() {
+ return mHasImeFocus;
+ }
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 70475860cb4d..a407bd8f001e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -14470,7 +14470,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @hide
*/
public boolean hasImeFocus() {
- return mAttachInfo != null && mAttachInfo.mHasImeFocus;
+ return getViewRootImpl() != null && getViewRootImpl().getImeFocusController().hasImeFocus();
}
/**
@@ -28725,11 +28725,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
boolean mHasWindowFocus;
/**
- * Indicates whether the view's window has IME focused.
- */
- boolean mHasImeFocus;
-
- /**
* The current visibility of the window.
*/
int mWindowVisibility;
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 435c9113a7e8..4e3050c6b022 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -3145,8 +3145,7 @@ public final class ViewRootImpl implements ViewParent,
}
mAttachInfo.mHasWindowFocus = hasWindowFocus;
- mAttachInfo.mHasImeFocus = mImeFocusController.updateImeFocusable(
- mWindowAttributes, true /* force */);
+ mImeFocusController.updateImeFocusable(mWindowAttributes, true /* force */);
mImeFocusController.onPreWindowFocus(hasWindowFocus, mWindowAttributes);
if (mView != null) {
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 307abd2f5f65..f0c16aadf12f 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -671,6 +671,11 @@ public final class InputMethodManager {
mWindowFocusGainFuture = null;
}
synchronized (mH) {
+ if (mCurRootView != null) {
+ // Reset the last served view and restart window focus state of the root view.
+ mCurRootView.getImeFocusController().setServedView(null);
+ mRestartOnNextWindowFocus = true;
+ }
mCurRootView = rootView;
}
}