diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index ed2139d5f044a..47b976bc2f4d9 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -1408,8 +1408,8 @@ public final class ViewRoot extends Handler implements ViewParent, // When in touch mode, focus points to the previously focused view, // which may have been removed from the view hierarchy. The following - // line checks whether the view is still in the hierarchy - if (focus == null || focus.getParent() == null) { + // line checks whether the view is still in our hierarchy. + if (focus == null || focus.mAttachInfo != mAttachInfo) { mRealFocusedView = null; return false; }