Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e84b5db authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Restricting navigation into and from clusters."

parents 0b3c2555 418b1fc5
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -869,10 +869,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     */
    @Override
    public View focusSearch(View focused, int direction) {
        if (isRootNamespace()) {
        if (isRootNamespace()
                || isKeyboardNavigationCluster()
                && (direction == FOCUS_FORWARD || direction == FOCUS_BACKWARD)) {
            // 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
            // into other tabs.  see LocalActivityManager and TabHost for more info.
            // Cluster's root works same way for the forward and backward navigation.
            return FocusFinder.getInstance().findNextFocus(this, focused, direction);
        } else if (mParent != null) {
            return mParent.focusSearch(focused, direction);
@@ -1104,6 +1107,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager

    @Override
    public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
        if (isKeyboardNavigationCluster()
                && (direction == FOCUS_FORWARD || direction == FOCUS_BACKWARD) && !hasFocus()) {
            // A cluster cannot be focus-entered from outside using forward/backward navigation.
            return;
        }

        final int focusableCount = views.size();

        final int descendantFocusability = getDescendantFocusability();
@@ -3026,7 +3035,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        final View[] children = mChildren;
        for (int i = index; i != end; i += increment) {
            View child = children[i];
            if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
            if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
                    && !child.isKeyboardNavigationCluster()) {
                if (child.requestFocus(direction, previouslyFocusedRect)) {
                    return true;
                }