diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-08 15:58:32 -0700 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-14 16:21:29 -0700 |
| commit | e5dfa47d84668376b84074c04570fb961870adeb (patch) | |
| tree | 3be9fe55e6170d33bbfb7fe57af3a1cc05c05266 /core/java/android/view/ViewRootImpl.java | |
| parent | 0d607fbe546ac943de38dad33ae681b09efec6ea (diff) | |
Improving accessibility focus traversal.
1. Now the views considered during the accessibility focus search
are the ones that would get accessibility focus when thovered
over. This way the user will get the same items i.e. feedback
if he touch explores the screen and uses focus traversal. This
is imperative for a good user experience.
2. Updated which focusables are considered when searching for access
focus in ViewGroup. Generally accessibility focus ignores focus
before/after descendants.
3. Implemented focus search strategy in AbsListView that will traverse
the items of the current list (and the stuff withing one item
before moving to the next) before continuing the search if
forward and backward accessibility focus direction.
4. View focus search stops at root namespace. This is not the right
way to prevent some stuff that is not supposed to get a focus in
a container for a specific state. Actually the addFocusables
for that container has to be overriden. Further this approach
leads to focus getting stuck. The accessibility focus ignores
root names space since we want to traverse the entire screen.
5. Fixed an bug in AccessibilityInteractionController which was not
starting to search from the root of a virtual node tree.
6. Fixed a couple of bugs in FocusFinder where it was possible to
get index out of bounds exception if the focusables list is empty.
bug:5932640
Change-Id: Ic3bdd11767a7d40fbb21f35dcd79a4746af784d4
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 131071917469..0eee17deca08 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2340,6 +2340,14 @@ 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 @@ -2535,6 +2543,20 @@ public final class ViewRootImpl implements ViewParent, return handled; } + /** + * @hide + */ + public View getAccessibilityFocusedHost() { + return mAccessibilityFocusedHost; + } + + /** + * @hide + */ + public AccessibilityNodeInfo getAccessibilityFocusedVirtualView() { + return mAccessibilityFocusedVirtualView; + } + void setAccessibilityFocusedHost(View host) { if (mAccessibilityFocusedHost != null && mAccessibilityFocusedVirtualView == null) { mAccessibilityFocusedHost.clearAccessibilityFocusNoCallbacks(); @@ -2687,7 +2709,7 @@ public final class ViewRootImpl implements ViewParent, /** * Return true if child is an ancestor of parent, (or equal to the parent). */ - static boolean isViewDescendantOf(View child, View parent) { + public static boolean isViewDescendantOf(View child, View parent) { if (child == parent) { return true; } |
