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

Commit 405f6f5f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update Remote Compose Platform A11y handler" into main

parents a2b40216 57da8570
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -88,13 +88,14 @@ public class AndroidPlatformSemanticNodeApplier

    @Override
    protected void setBoundsInScreen(AccessibilityNodeInfo nodeInfo, Rect bounds) {
        nodeInfo.setBoundsInParent(bounds);
        nodeInfo.setBoundsInParent(new Rect(0, 0, 1, 1));
        nodeInfo.setBoundsInScreen(bounds);
    }

    @Override
    protected void setUniqueId(AccessibilityNodeInfo nodeInfo, String id) {
        nodeInfo.setUniqueId(id);
        nodeInfo.setSource(mPlayer, Integer.parseInt(id));
    }

    @Override
@@ -143,6 +144,7 @@ public class AndroidPlatformSemanticNodeApplier
        if (scrollDirection == RootContentBehavior.SCROLL_HORIZONTAL) {
            nodeInfo.setClassName("android.widget.HorizontalScrollView");
        } else {
            nodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(-1, 1, false));
            nodeInfo.setClassName("android.widget.ScrollView");
        }
    }
+11 −7
Original line number Diff line number Diff line
@@ -94,19 +94,23 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper {
     * @param virtualViewIds The list to be populated with the visible virtual view IDs.
     */
    @Override
    protected void getVisibleVirtualViews(IntArray virtualViewIds) {
    public void getVisibleVirtualViews(IntArray virtualViewIds) {
        List<Integer> children = getVisibleChildVirtualViews();
        for (int child : children) {
            virtualViewIds.add(child);
        }
    }

    @SuppressWarnings("JdkImmutableCollections")
    public List<Integer> getVisibleChildVirtualViews() {
        Component rootComponent = mRemoteDocA11y.findComponentById(RootId);

        if (rootComponent == null
                || !mRemoteDocA11y.semanticModifiersForComponent(rootComponent).isEmpty()) {
            virtualViewIds.add(RootId);
            return List.of(RootId);
        }

        List<Integer> children =
                mRemoteDocA11y.semanticallyRelevantChildComponents(rootComponent, false);
        for (int child : children) {
            virtualViewIds.add(child);
        }
        return mRemoteDocA11y.semanticallyRelevantChildComponents(rootComponent, false);
    }

    @Override