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

Commit fa59d178 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Invisible views should not be visible to accessibility services (interrogation)"

parents 11900410 ea1da3d2
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -4407,7 +4407,7 @@ public final class ViewAncestor extends Handler implements ViewParent,
                predicate.init(accessibilityId);
                View root = ViewAncestor.this.mView;
                View target = root.findViewByPredicate(predicate);
                if (target != null) {
                if (target != null && target.isShown()) {
                    info = target.createAccessibilityNodeInfo();
                }
            } finally {
@@ -4439,7 +4439,7 @@ public final class ViewAncestor extends Handler implements ViewParent,
            try {
                View root = ViewAncestor.this.mView;
                View target = root.findViewById(viewId);
                if (target != null) {
                if (target != null && target.isShown()) {
                    info = target.createAccessibilityNodeInfo();
                }
            } finally {
@@ -4486,7 +4486,7 @@ public final class ViewAncestor extends Handler implements ViewParent,
                    root = ViewAncestor.this.mView;
                }

                if (root == null) {
                if (root == null || !root.isShown()) {
                    return;
                }

@@ -4501,8 +4501,10 @@ public final class ViewAncestor extends Handler implements ViewParent,
                final int viewCount = foundViews.size();
                for (int i = 0; i < viewCount; i++) {
                    View foundView = foundViews.get(i);
                    if (foundView.isShown()) {
                        infos.add(foundView.createAccessibilityNodeInfo());
                    }
                 }
            } finally {
                try {
                    callback.setFindAccessibilityNodeInfosResult(infos, interactionId);
@@ -4611,7 +4613,8 @@ public final class ViewAncestor extends Handler implements ViewParent,
                return null;
            }
            mFindByAccessibilityIdPredicate.init(accessibilityId);
            return root.findViewByPredicate(mFindByAccessibilityIdPredicate);
            View foundView = root.findViewByPredicate(mFindByAccessibilityIdPredicate);
            return (foundView != null && foundView.isShown()) ? foundView : null;
        }

        private final class FindByAccessibilitytIdPredicate implements Predicate<View> {
+3 −2
Original line number Diff line number Diff line
@@ -2023,12 +2023,13 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    @Override
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);

        for (int i = 0, count = mChildrenCount; i < count; i++) {
            View child = mChildren[i];
            if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
                info.addChild(child);
            }
        }
    }

    /**
     * {@inheritDoc}