From 3cb889caa3726256bd00976c2662f51a14d91d49 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Mon, 16 Apr 2012 19:10:30 -0700 Subject: [PATCH] Fixing broken add focusables behavior I have introduced. bug:6344608 Change-Id: I1d241c02bc22c5ef3f4b4b69a756772e8b2ef902 --- core/java/android/view/View.java | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 962e13abb1f80..6c1f02d0da2d7 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5807,18 +5807,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @see #FOCUSABLES_ALL * @see #FOCUSABLES_TOUCH_MODE - * @see #FOCUSABLES_ACCESSIBILITY */ public void addFocusables(ArrayList views, int direction, int focusableMode) { if (views == null) { return; } - if ((focusableMode & FOCUSABLE_IN_TOUCH_MODE) == FOCUSABLE_IN_TOUCH_MODE) { - if (isFocusable() && (!isInTouchMode() || isFocusableInTouchMode())) { - views.add(this); - return; - } - } if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { if (AccessibilityManager.getInstance(mContext).isEnabled() && includeForAccessibility()) { @@ -5826,14 +5819,14 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal return; } } - if ((focusableMode & FOCUSABLES_ALL) == FOCUSABLES_ALL) { - if (isFocusable()) { - views.add(this); - return; - } - } else { - throw new IllegalArgumentException("Unknow focusable mode: " + focusableMode); + if (!isFocusable()) { + return; } + if ((focusableMode & FOCUSABLES_TOUCH_MODE) == FOCUSABLES_TOUCH_MODE + && isInTouchMode() && !isFocusableInTouchMode()) { + return; + } + views.add(this); } /**