From 4c6e9830006f7aa67b5df33b896ef4a4fb8c7e92 Mon Sep 17 00:00:00 2001 From: Yigit Boyar Date: Thu, 12 May 2016 15:11:13 -0700 Subject: [PATCH] Respect add focusables flags This CL fixes 2 bugs in View's addFocusables implementations. 1) addFocusables(list, dir) method was always returning focusables in touch mode even if the device is not in touch mode. 2) addFocusables(list, dir, mode) was not respecting the provided mod. Bug: 28745577 Change-Id: I9b9e5af27f8f5b1bb3cc601584fdad7c73e54a5d --- core/java/android/view/View.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 4e7d19143385e..77884f6e4d778 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8740,7 +8740,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param direction The direction of the focus */ public void addFocusables(ArrayList views, @FocusDirection int direction) { - addFocusables(views, direction, FOCUSABLES_TOUCH_MODE); + addFocusables(views, direction, isInTouchMode() ? FOCUSABLES_TOUCH_MODE : FOCUSABLES_ALL); } /** @@ -8768,7 +8768,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return; } if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE - && isInTouchMode() && !isFocusableInTouchMode()) { + && !isFocusableInTouchMode()) { return; } views.add(this);