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
This commit is contained in:
Yigit Boyar
2016-05-12 15:11:13 -07:00
parent 3f84c5cb34
commit 4c6e983000

View File

@@ -8740,7 +8740,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @param direction The direction of the focus
*/
public void addFocusables(ArrayList<View> 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);