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

Commit c8f21b0c authored by Daniel Norman's avatar Daniel Norman
Browse files

Stop dispatching TYPE_VIEW_SELECTED a11y event on child views.

Bug: 263572235
Test: atest AccessibilityEventTest
Test: inspect A11yEvent log while expanding quick settings,
      see fewer events
Change-Id: Ib286d336f00e131387de342a259bf761bfe2b76f
parent fb0ae75c
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -25780,6 +25780,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param selected true if the view must be selected, false otherwise
     */
    public void setSelected(boolean selected) {
        setSelected(selected, true);
    }
    void setSelected(boolean selected, boolean sendAccessibilityEvent) {
        //noinspection DoubleNegation
        if (((mPrivateFlags & PFLAG_SELECTED) != 0) != selected) {
            mPrivateFlags = (mPrivateFlags & ~PFLAG_SELECTED) | (selected ? PFLAG_SELECTED : 0);
@@ -25787,6 +25791,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            invalidate(true);
            refreshDrawableState();
            dispatchSetSelected(selected);
            if (sendAccessibilityEvent) {
                if (selected) {
                    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
                } else {
@@ -25795,6 +25800,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                }
            }
        }
    }
    /**
     * Dispatch setSelected to all of this View's children.
+1 −1
Original line number Diff line number Diff line
@@ -4629,7 +4629,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        final View[] children = mChildren;
        final int count = mChildrenCount;
        for (int i = 0; i < count; i++) {
            children[i].setSelected(selected);
            children[i].setSelected(selected, false);
        }
    }