Skip to content

Commit 09dd116

Browse files
committed
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
1 parent a0e9d0f commit 09dd116

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2977,7 +2977,10 @@ private boolean enterTouchMode() {
29772977
// be when the window is first being added, and mFocused isn't
29782978
// set yet.
29792979
final View focused = mView.findFocus();
2980-
if (focused != null && !focused.isFocusableInTouchMode()) {
2980+
if (focused != null) {
2981+
if (focused.isFocusableInTouchMode()) {
2982+
return true;
2983+
}
29812984
final ViewGroup ancestorToTakeFocus =
29822985
findAncestorToTakeFocusInTouchMode(focused);
29832986
if (ancestorToTakeFocus != null) {

0 commit comments

Comments
 (0)