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

Commit cbf9ec98 authored by Yinglei Wang's avatar Yinglei Wang Committed by Android (Google) Code Review
Browse files

Merge "Revert "Update a11y focused virtual node properly""

parents 2413512f 013065b9
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -9180,26 +9180,15 @@ public final class ViewRootImpl implements ViewParent,
            return;
        }

        final long eventSourceNodeId = event.getSourceNodeId();
        final long focusedSourceNodeId = mAccessibilityFocusedVirtualView.getSourceNodeId();

        // Only change types that may affect the bounds of the focused virtual view should run
        // the update bounds logic after this if block.
        // We only care about change types that may affect the bounds of the
        // focused virtual view.
        final int changes = event.getContentChangeTypes();
        if ((changes & AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE) == 0
                && changes != AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED) {
            // Now the changes(text, content description, state description) are local to this node.
            // If the focused virtual view changed, we need to update the
            // mAccessibilityFocusedVirtualView, otherwise A11y services will get stale value.
            if (eventSourceNodeId == focusedSourceNodeId) {
                int focusedChildId =
                        AccessibilityNodeInfo.getVirtualDescendantId(focusedSourceNodeId);
                mAccessibilityFocusedVirtualView =
                        provider.createAccessibilityNodeInfo(focusedChildId);
            }
            return;
        }

        final long eventSourceNodeId = event.getSourceNodeId();
        final int changedViewId = AccessibilityNodeInfo.getAccessibilityViewId(eventSourceNodeId);

        // Search up the tree for subtree containment.
@@ -9223,6 +9212,7 @@ public final class ViewRootImpl implements ViewParent,
            return;
        }

        final long focusedSourceNodeId = mAccessibilityFocusedVirtualView.getSourceNodeId();
        int focusedChildId = AccessibilityNodeInfo.getVirtualDescendantId(focusedSourceNodeId);

        // Refresh the node for the focused virtual view.