diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index 0aabc44a5a99d..4de0b01bb466f 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -574,38 +574,9 @@ final class AccessibilityInteractionController {
root = mViewRootImpl.mView;
}
if (root != null && isShown(root)) {
- if ((direction & View.FOCUS_ACCESSIBILITY) == View.FOCUS_ACCESSIBILITY) {
- AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider();
- if (provider != null) {
- next = provider.accessibilityFocusSearch(direction, virtualDescendantId);
- if (next != null) {
- return;
- }
- }
- View nextView = root.focusSearch(direction);
- while (nextView != null) {
- // If the focus search reached a node with a provider
- // we delegate to the provider to find the next one.
- // If the provider does not return a virtual view to
- // take accessibility focus we try the next view found
- // by the focus search algorithm.
- provider = nextView.getAccessibilityNodeProvider();
- if (provider != null) {
- next = provider.accessibilityFocusSearch(direction, View.NO_ID);
- if (next != null) {
- break;
- }
- nextView = nextView.focusSearch(direction);
- } else {
- next = nextView.createAccessibilityNodeInfo();
- break;
- }
- }
- } else {
- View nextView = root.focusSearch(direction);
- if (nextView != null) {
- next = nextView.createAccessibilityNodeInfo();
- }
+ View nextView = root.focusSearch(direction);
+ if (nextView != null) {
+ next = nextView.createAccessibilityNodeInfo();
}
}
} finally {
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java
index 31a9f05a10540..351c5c31f2707 100644
--- a/core/java/android/view/FocusFinder.java
+++ b/core/java/android/view/FocusFinder.java
@@ -79,17 +79,9 @@ public class FocusFinder {
}
private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, int direction) {
- if ((direction & View.FOCUS_ACCESSIBILITY) != View.FOCUS_ACCESSIBILITY) {
- return findNextInputFocus(root, focused, focusedRect, direction);
- } else {
- return findNextAccessibilityFocus(root, focused, focusedRect, direction);
- }
- }
-
- private View findNextInputFocus(ViewGroup root, View focused, Rect focusedRect, int direction) {
View next = null;
if (focused != null) {
- next = findNextUserSpecifiedInputFocus(root, focused, direction);
+ next = findNextUserSpecifiedFocus(root, focused, direction);
}
if (next != null) {
return next;
@@ -107,7 +99,7 @@ public class FocusFinder {
return next;
}
- private View findNextUserSpecifiedInputFocus(ViewGroup root, View focused, int direction) {
+ private View findNextUserSpecifiedFocus(ViewGroup root, View focused, int direction) {
// check for user specified next focus
View userSetNextFocus = focused.findUserSetNextFocus(root, direction);
if (userSetNextFocus != null && userSetNextFocus.isFocusable()
@@ -120,7 +112,6 @@ public class FocusFinder {
private View findNextFocus(ViewGroup root, View focused, Rect focusedRect,
int direction, ArrayList
- * Such a view is consideted by the focus search if it is:
- *
- *
- * An accessibility srvice can request putting accessibility focus on such a view.
- *
- * A view that can take accessibility focus is always considered during focus - * search and an accessibility service can request putting accessibility focus - * on it. - *
- * - * @hide - */ - public static final int ACCESSIBILITY_FOCUSABLE_YES = 0x00000001; - - /** - * The view can not take accessibility focus. - *- * A view that can not take accessibility focus is never considered during focus - * search and an accessibility service can not request putting accessibility focus - * on it. - *
- * - * @hide - */ - public static final int ACCESSIBILITY_FOCUSABLE_NO = 0x00000002; - - /** - * The default whether the view is accessiblity focusable. - */ - static final int ACCESSIBILITY_FOCUSABLE_DEFAULT = ACCESSIBILITY_FOCUSABLE_AUTO; - - /** - * Mask for obtainig the bits which specifies how to determine - * whether a view is accessibility focusable. - */ - static final int ACCESSIBILITY_FOCUSABLE_MASK = (ACCESSIBILITY_FOCUSABLE_AUTO - | ACCESSIBILITY_FOCUSABLE_YES | ACCESSIBILITY_FOCUSABLE_NO) - << ACCESSIBILITY_FOCUSABLE_SHIFT; - + // There are a couple of flags left in mPrivateFlags2 /* End of masks for mPrivateFlags2 */ @@ -3216,8 +3092,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags2 = (LAYOUT_DIRECTION_DEFAULT << LAYOUT_DIRECTION_MASK_SHIFT) | (TEXT_DIRECTION_DEFAULT << TEXT_DIRECTION_MASK_SHIFT) | (TEXT_ALIGNMENT_DEFAULT << TEXT_ALIGNMENT_MASK_SHIFT) | - (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << IMPORTANT_FOR_ACCESSIBILITY_SHIFT) | - (ACCESSIBILITY_FOCUSABLE_DEFAULT << ACCESSIBILITY_FOCUSABLE_SHIFT); + (IMPORTANT_FOR_ACCESSIBILITY_DEFAULT << IMPORTANT_FOR_ACCESSIBILITY_SHIFT); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS); mUserPaddingStart = -1; @@ -4860,10 +4735,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } if (!isAccessibilityFocused()) { - final int mode = getAccessibilityFocusable(); - if (mode == ACCESSIBILITY_FOCUSABLE_YES || mode == ACCESSIBILITY_FOCUSABLE_AUTO) { - info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); - } + info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } else { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } @@ -6166,12 +6038,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (views == null) { return; } - if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { - if (isAccessibilityFocusable()) { - views.add(this); - return; - } - } if (!isFocusable()) { return; } @@ -6336,29 +6202,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } - private void requestAccessibilityFocusFromHover() { - if (includeForAccessibility() && isActionableForAccessibility()) { - requestAccessibilityFocus(); - } else { - if (mParent != null) { - View nextFocus = mParent.findViewToTakeAccessibilityFocusFromHover(this, this); - if (nextFocus != null) { - nextFocus.requestAccessibilityFocus(); - } - } - } - } - - private boolean canTakeAccessibilityFocusFromHover() { - if (includeForAccessibility() && isActionableForAccessibility()) { - return true; - } - if (mParent != null) { - return (mParent.findViewToTakeAccessibilityFocusFromHover(this, this) == this); - } - return false; - } - /** * Clears accessibility focus without calling any callback methods * normally invoked in {@link #clearAccessibilityFocus()}. This method @@ -6573,73 +6416,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } - /** - * Gets the mode for determining whether this View can take accessibility focus. - * - * @return The mode for determining whether a View can take accessibility focus. - * - * @attr ref android.R.styleable#View_accessibilityFocusable - * - * @see #ACCESSIBILITY_FOCUSABLE_YES - * @see #ACCESSIBILITY_FOCUSABLE_NO - * @see #ACCESSIBILITY_FOCUSABLE_AUTO - * - * @hide - */ - @ViewDebug.ExportedProperty(category = "accessibility", mapping = { - @ViewDebug.IntToString(from = ACCESSIBILITY_FOCUSABLE_AUTO, to = "auto"), - @ViewDebug.IntToString(from = ACCESSIBILITY_FOCUSABLE_YES, to = "yes"), - @ViewDebug.IntToString(from = ACCESSIBILITY_FOCUSABLE_NO, to = "no") - }) - public int getAccessibilityFocusable() { - return (mPrivateFlags2 & ACCESSIBILITY_FOCUSABLE_MASK) >>> ACCESSIBILITY_FOCUSABLE_SHIFT; - } - - /** - * Sets how to determine whether this view can take accessibility focus. - * - * @param mode How to determine whether this view can take accessibility focus. - * - * @attr ref android.R.styleable#View_accessibilityFocusable - * - * @see #ACCESSIBILITY_FOCUSABLE_YES - * @see #ACCESSIBILITY_FOCUSABLE_NO - * @see #ACCESSIBILITY_FOCUSABLE_AUTO - * - * @hide - */ - public void setAccessibilityFocusable(int mode) { - if (mode != getAccessibilityFocusable()) { - mPrivateFlags2 &= ~ACCESSIBILITY_FOCUSABLE_MASK; - mPrivateFlags2 |= (mode << ACCESSIBILITY_FOCUSABLE_SHIFT) - & ACCESSIBILITY_FOCUSABLE_MASK; - notifyAccessibilityStateChanged(); - } - } - - /** - * Gets whether this view can take accessibility focus. - * - * @return Whether the view can take accessibility focus. - * - * @hide - */ - public boolean isAccessibilityFocusable() { - final int mode = (mPrivateFlags2 & ACCESSIBILITY_FOCUSABLE_MASK) - >>> ACCESSIBILITY_FOCUSABLE_SHIFT; - switch (mode) { - case ACCESSIBILITY_FOCUSABLE_YES: - return true; - case ACCESSIBILITY_FOCUSABLE_NO: - return false; - case ACCESSIBILITY_FOCUSABLE_AUTO: - return canTakeAccessibilityFocusFromHover() - || getAccessibilityNodeProvider() != null; - default: - throw new IllegalArgumentException("Unknow accessibility focusable mode: " + mode); - } - } - /** * Gets the parent for accessibility purposes. Note that the parent for * accessibility is not necessary the immediate parent. It is the first @@ -6821,10 +6597,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } break; case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - final int mode = getAccessibilityFocusable(); - if (!isAccessibilityFocused() - && (mode == ACCESSIBILITY_FOCUSABLE_YES - || mode == ACCESSIBILITY_FOCUSABLE_AUTO)) { + if (!isAccessibilityFocused()) { return requestAccessibilityFocus(); } } break; diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index f66c4dedda8bb..102b504ce394a 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -624,11 +624,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * FOCUS_RIGHT, or 0 for not applicable. */ public View focusSearch(View focused, int direction) { - // If we are moving accessibility focus we want to consider all - // views no matter if they are on the screen. It is responsibility - // of the accessibility service to check whether the result is in - // the screen. - if (isRootNamespace() && (direction & FOCUS_ACCESSIBILITY) == 0) { + if (isRootNamespace()) { // root namespace means we should consider ourselves the top of the // tree for focus searching; otherwise we could be focus searching // into other tabs. see LocalActivityManager and TabHost for more info @@ -863,8 +859,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final int descendantFocusability = getDescendantFocusability(); - if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS - || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { + if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS) { final int count = mChildrenCount; final View[] children = mChildren; @@ -882,9 +877,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // among the focusable children would be more interesting. if (descendantFocusability != FOCUS_AFTER_DESCENDANTS // No focusable descendants - || (focusableCount == views.size()) - // We are collecting accessibility focusables. - || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) { + || (focusableCount == views.size())) { super.addFocusables(views, direction, focusableMode); } } @@ -1653,20 +1646,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } - /** - * @hide - */ - @Override - public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) { - if (includeForAccessibility() && isActionableForAccessibility()) { - return this; - } - if (mParent != null) { - return mParent.findViewToTakeAccessibilityFocusFromHover(this, descendant); - } - return null; - } - /** * Implement this method to intercept hover events before they are handled * by child views. diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java index d93b996085786..ddff91de0ac92 100644 --- a/core/java/android/view/ViewParent.java +++ b/core/java/android/view/ViewParent.java @@ -295,16 +295,4 @@ public interface ViewParent { * @hide */ public void childAccessibilityStateChanged(View child); - - /** - * A descendant requests this view to find a candidate to take accessibility - * focus from hover. - * - * @param child The child making the call. - * @param descendant The descendant that made the initial request. - * @return A view to take accessibility focus. - * - * @hide - */ - public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant); } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 17783a49c9eae..e03c7d3fc59e4 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -76,7 +76,6 @@ import android.widget.Scroller; import com.android.internal.R; import com.android.internal.policy.PolicyManager; import com.android.internal.view.BaseSurfaceHolder; -import com.android.internal.view.IInputMethodSession; import com.android.internal.view.RootViewSurfaceTaker; import java.io.IOException; @@ -2278,14 +2277,6 @@ public final class ViewRootImpl implements ViewParent, return true; } - @Override - public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) { - if (descendant.includeForAccessibility()) { - return descendant; - } - return null; - } - /** * We want to draw a highlight around the current accessibility focused. * Since adding a style for all possible view is not a viable option we diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 3ad3a5557053f..68983e2ff9b68 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -1343,12 +1343,6 @@ public class AccessibilityNodeInfo implements Parcelable { case View.FOCUS_RIGHT: case View.FOCUS_FORWARD: case View.FOCUS_BACKWARD: - case View.ACCESSIBILITY_FOCUS_DOWN: - case View.ACCESSIBILITY_FOCUS_UP: - case View.ACCESSIBILITY_FOCUS_LEFT: - case View.ACCESSIBILITY_FOCUS_RIGHT: - case View.ACCESSIBILITY_FOCUS_FORWARD: - case View.ACCESSIBILITY_FOCUS_BACKWARD: return; default: throw new IllegalArgumentException("Unknown direction: " + direction); diff --git a/core/java/android/view/accessibility/AccessibilityNodeProvider.java b/core/java/android/view/accessibility/AccessibilityNodeProvider.java index b3f3cee430a7d..688cbdf3c9f7a 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeProvider.java +++ b/core/java/android/view/accessibility/AccessibilityNodeProvider.java @@ -132,60 +132,4 @@ public abstract class AccessibilityNodeProvider { int virtualViewId) { return null; } - - /** - * Finds the accessibility focused {@link AccessibilityNodeInfo}. The search is - * relative to the virtual view, i.e. a descendant of the host View, with the - * givenvirtualViewId or the host View itself
- * virtualViewId equals to {@link View#NO_ID}.
- *
- * Note: Normally the system is responsible to transparently find
- * accessibility focused view starting from a given root but for virtual view
- * hierarchies it is a responsibility of this provider's implementor to find
- * the accessibility focused virtual view.
- *
- * @param virtualViewId A client defined virtual view id which defined
- * the root of the tree in which to perform the search.
- * @return A list of node info.
- *
- * @see #createAccessibilityNodeInfo(int)
- * @see AccessibilityNodeInfo
- *
- * @hide
- */
- public AccessibilityNodeInfo findAccessibilityFocus(int virtualViewId) {
- return null;
- }
-
- /**
- * Finds {@link AccessibilityNodeInfo} to take accessibility focus in the given
- * direction. The search is relative to the virtual view, i.e. a
- * descendant of the host View, with the given virtualViewId or
- * the host View itself virtualViewId equals to {@link View#NO_ID}.
- *
- * Note: Normally the system is responsible to transparently find
- * the next view to take accessibility focus but for virtual view hierarchies
- * it is a responsibility of this provider's implementor to compute the next
- * focusable.
- *
- * @param direction The direction in which to search for a focus candidate.
- * Values are
- * {@link View#ACCESSIBILITY_FOCUS_FORWARD},
- * {@link View#ACCESSIBILITY_FOCUS_BACKWARD},
- * {@link View#ACCESSIBILITY_FOCUS_UP},
- * {@link View#ACCESSIBILITY_FOCUS_DOWN},
- * {@link View#ACCESSIBILITY_FOCUS_LEFT},
- * {@link View#ACCESSIBILITY_FOCUS_RIGHT}.
- * @param virtualViewId A client defined virtual view id which defined
- * the root of the tree in which to perform the search.
- * @return A list of node info.
- *
- * @see #createAccessibilityNodeInfo(int)
- * @see AccessibilityNodeInfo
- *
- * @hide
- */
- public AccessibilityNodeInfo accessibilityFocusSearch(int direction, int virtualViewId) {
- return null;
- }
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 19aef8eaf0546..130f0eeaac3f4 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -42,7 +42,6 @@ import android.util.SparseBooleanArray;
import android.util.StateSet;
import android.view.ActionMode;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.FocusFinder;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
@@ -1328,150 +1327,6 @@ public abstract class AbsListView extends AdapterView