diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 3cf61098f11cf..71dd6653f6a65 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -645,6 +645,11 @@ public final class InputMethodManager { @Override public void setCurrentRootView(ViewRootImpl rootView) { 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; } }