From 09dd116cd39613a3736dbbf028544e1655002430 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 17 Apr 2012 14:29:05 -0700 Subject: [PATCH] Fix a bug with enterTouchMode removing focus Bug: 6347083 Fix an issue where enterTouchMode would remove focus from the view that already has focus and is focusableInTouchMode. This causes issues with WebView, as it updates internal state when losing and gaining focus. Change-Id: I5c1f72cc08baf3445e2be9e0496606a53fb9929e --- core/java/android/view/ViewRootImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index b4554d594e337..147299307853c 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2977,7 +2977,10 @@ public final class ViewRootImpl implements ViewParent, // be when the window is first being added, and mFocused isn't // set yet. final View focused = mView.findFocus(); - if (focused != null && !focused.isFocusableInTouchMode()) { + if (focused != null) { + if (focused.isFocusableInTouchMode()) { + return true; + } final ViewGroup ancestorToTakeFocus = findAncestorToTakeFocusInTouchMode(focused); if (ancestorToTakeFocus != null) {