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

Commit c0d14292 authored by Daniel Norman's avatar Daniel Norman Committed by Android (Google) Code Review
Browse files

Merge "Stop dispatching TYPE_VIEW_SELECTED a11y event on child views."

parents ece2a158 c8f21b0c
Loading
Loading
Loading
Loading
+11 −5
Original line number Original line Diff line number Diff line
@@ -25824,6 +25824,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param selected true if the view must be selected, false otherwise
     * @param selected true if the view must be selected, false otherwise
     */
     */
    public void setSelected(boolean selected) {
    public void setSelected(boolean selected) {
        setSelected(selected, true);
    }
    void setSelected(boolean selected, boolean sendAccessibilityEvent) {
        //noinspection DoubleNegation
        //noinspection DoubleNegation
        if (((mPrivateFlags & PFLAG_SELECTED) != 0) != selected) {
        if (((mPrivateFlags & PFLAG_SELECTED) != 0) != selected) {
            mPrivateFlags = (mPrivateFlags & ~PFLAG_SELECTED) | (selected ? PFLAG_SELECTED : 0);
            mPrivateFlags = (mPrivateFlags & ~PFLAG_SELECTED) | (selected ? PFLAG_SELECTED : 0);
@@ -25831,6 +25835,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            invalidate(true);
            invalidate(true);
            refreshDrawableState();
            refreshDrawableState();
            dispatchSetSelected(selected);
            dispatchSetSelected(selected);
            if (sendAccessibilityEvent) {
                if (selected) {
                if (selected) {
                    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
                    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
                } else {
                } else {
@@ -25839,6 +25844,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                }
                }
            }
            }
        }
        }
    }
    /**
    /**
     * Dispatch setSelected to all of this View's children.
     * Dispatch setSelected to all of this View's children.
+1 −1
Original line number Original line Diff line number Diff line
@@ -4631,7 +4631,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        final View[] children = mChildren;
        final View[] children = mChildren;
        final int count = mChildrenCount;
        final int count = mChildrenCount;
        for (int i = 0; i < count; i++) {
        for (int i = 0; i < count; i++) {
            children[i].setSelected(selected);
            children[i].setSelected(selected, false);
        }
        }
    }
    }