Skip to content

Commit 3cb889c

Browse files
committed
Fixing broken add focusables behavior I have introduced.
bug:6344608 Change-Id: I1d241c02bc22c5ef3f4b4b69a756772e8b2ef902
1 parent 4213804 commit 3cb889c

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

core/java/android/view/View.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5807,33 +5807,26 @@ public void addFocusables(ArrayList<View> views, int direction) {
58075807
*
58085808
* @see #FOCUSABLES_ALL
58095809
* @see #FOCUSABLES_TOUCH_MODE
5810-
* @see #FOCUSABLES_ACCESSIBILITY
58115810
*/
58125811
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
58135812
if (views == null) {
58145813
return;
58155814
}
5816-
if ((focusableMode & FOCUSABLE_IN_TOUCH_MODE) == FOCUSABLE_IN_TOUCH_MODE) {
5817-
if (isFocusable() && (!isInTouchMode() || isFocusableInTouchMode())) {
5818-
views.add(this);
5819-
return;
5820-
}
5821-
}
58225815
if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) {
58235816
if (AccessibilityManager.getInstance(mContext).isEnabled()
58245817
&& includeForAccessibility()) {
58255818
views.add(this);
58265819
return;
58275820
}
58285821
}
5829-
if ((focusableMode & FOCUSABLES_ALL) == FOCUSABLES_ALL) {
5830-
if (isFocusable()) {
5831-
views.add(this);
5832-
return;
5833-
}
5834-
} else {
5835-
throw new IllegalArgumentException("Unknow focusable mode: " + focusableMode);
5822+
if (!isFocusable()) {
5823+
return;
5824+
}
5825+
if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE
5826+
&& isInTouchMode() && !isFocusableInTouchMode()) {
5827+
return;
58365828
}
5829+
views.add(this);
58375830
}
58385831

58395832
/**

0 commit comments

Comments
 (0)