Loading core/java/com/android/internal/widget/remotecompose/accessibility/AndroidPlatformSemanticNodeApplier.java +7 −2 Original line number Diff line number Diff line Loading @@ -132,8 +132,13 @@ public class AndroidPlatformSemanticNodeApplier } } // TODO correct values if (scrollDirection == RootContentBehavior.SCROLL_HORIZONTAL) { nodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(1, -1, false)); nodeInfo.setClassName("android.widget.HorizontalScrollView"); } else { nodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(-1, 1, false)); nodeInfo.setClassName("android.widget.ScrollView"); } if (scrollDirection == RootContentBehavior.SCROLL_HORIZONTAL) { nodeInfo.setClassName("android.widget.HorizontalScrollView"); Loading core/java/com/android/internal/widget/remotecompose/accessibility/CoreDocumentAccessibility.java +40 −7 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.internal.widget.remotecompose.core.semantics.AccessibilitySem import com.android.internal.widget.remotecompose.core.semantics.AccessibleComponent; import com.android.internal.widget.remotecompose.core.semantics.CoreSemantics; import com.android.internal.widget.remotecompose.core.semantics.ScrollableComponent; import com.android.internal.widget.remotecompose.core.semantics.ScrollableComponent.ScrollDirection; import java.util.ArrayList; import java.util.Collections; Loading Loading @@ -104,9 +105,9 @@ public class CoreDocumentAccessibility implements RemoteComposeDocumentAccessibi if (isClickAction(action)) { return performClick(component); } else if (isScrollForwardAction(action)) { return scrollByOffset(mRemoteContext, component, -500) != 0; return scrollDirection(mRemoteContext, component, ScrollDirection.FORWARD); } else if (isScrollBackwardAction(action)) { return scrollByOffset(mRemoteContext, component, 500) != 0; return scrollDirection(mRemoteContext, component, ScrollDirection.BACKWARD); } else if (isShowOnScreenAction(action)) { return showOnScreen(mRemoteContext, component); } else { Loading Loading @@ -141,17 +142,30 @@ public class CoreDocumentAccessibility implements RemoteComposeDocumentAccessibi } private boolean showOnScreen(RemoteContext context, Component component) { if (component.getParent() instanceof LayoutComponent) { LayoutComponent parent = (LayoutComponent) component.getParent(); ScrollableComponent scrollable = findScrollable(component); if (scrollable != null) { return scrollable.showOnScreen(context, component); } return false; } @Nullable private static ScrollableComponent findScrollable(Component component) { Component parent = component.getParent(); while (parent != null) { ScrollableComponent scrollable = parent.selfOrModifier(ScrollableComponent.class); if (scrollable != null) { scrollable.showOnScreen(context, component.getComponentId()); return true; return scrollable; } else { parent = parent.getParent(); } } return false; return null; } /** Loading @@ -172,6 +186,25 @@ public class CoreDocumentAccessibility implements RemoteComposeDocumentAccessibi return 0; } /** * scroll content in a given direction * * @param context * @param component * @param direction * @return */ public boolean scrollDirection( RemoteContext context, Component component, ScrollDirection direction) { ScrollableComponent scrollable = component.selfOrModifier(ScrollableComponent.class); if (scrollable != null) { return scrollable.scrollDirection(context, direction); } return false; } /** * Perform a click on the given component * Loading core/java/com/android/internal/widget/remotecompose/accessibility/PlatformRemoteComposeTouchHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper { private final RemoteComposeDocumentAccessibility mRemoteDocA11y; private final SemanticNodeApplier<AccessibilityNodeInfo> mApplier; private final View mHost; public PlatformRemoteComposeTouchHelper( View host, Loading @@ -47,6 +48,7 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper { super(host); this.mRemoteDocA11y = remoteDocA11y; this.mApplier = applier; this.mHost = host; } public static PlatformRemoteComposeTouchHelper forRemoteComposePlayer( Loading Loading @@ -150,6 +152,7 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper { boolean performed = mRemoteDocA11y.performAction(component, action, arguments); if (performed) { mHost.invalidate(); invalidateRoot(); } Loading core/java/com/android/internal/widget/remotecompose/core/CoreDocument.java +14 −7 Original line number Diff line number Diff line Loading @@ -73,7 +73,9 @@ public class CoreDocument implements Serializable { // We also keep a more fine-grained BUILD number, exposed as // ID_API_LEVEL = DOCUMENT_API_LEVEL + BUILD static final float BUILD = 0.5f; static final float BUILD = 0.6f; private static final boolean UPDATE_VARIABLES_BEFORE_LAYOUT = false; @NonNull ArrayList<Operation> mOperations = new ArrayList<>(); Loading Loading @@ -892,8 +894,11 @@ public class CoreDocument implements Serializable { registerVariables(context, mOperations); context.mMode = RemoteContext.ContextMode.UNSET; if (UPDATE_VARIABLES_BEFORE_LAYOUT) { mFirstPaint = true; } } /////////////////////////////////////////////////////////////////////////////////////////////// // Document infos Loading Loading @@ -1241,12 +1246,14 @@ public class CoreDocument implements Serializable { context.mRemoteComposeState = mRemoteComposeState; context.mRemoteComposeState.setContext(context); if (UPDATE_VARIABLES_BEFORE_LAYOUT) { // Update any dirty variables if (mFirstPaint) { mFirstPaint = false; } else { updateVariables(context, theme, mOperations); } } // If we have a content sizing set, we are going to take the original document // dimension into account and apply scale+translate according to the RootContentBehavior Loading core/java/com/android/internal/widget/remotecompose/core/Operations.java +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.internal.widget.remotecompose.core.operations.layout.managers import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.BackgroundModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.BorderModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.ClipRectModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.CollapsiblePriorityModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.ComponentVisibilityOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.DrawContentOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.GraphicsLayerModifierOperation; Loading Loading @@ -257,6 +258,7 @@ public class Operations { public static final int MODIFIER_HEIGHT = 67; public static final int MODIFIER_WIDTH_IN = 231; public static final int MODIFIER_HEIGHT_IN = 232; public static final int MODIFIER_COLLAPSIBLE_PRIORITY = 235; public static final int MODIFIER_BACKGROUND = 55; public static final int MODIFIER_BORDER = 107; public static final int MODIFIER_PADDING = 58; Loading Loading @@ -368,6 +370,7 @@ public class Operations { map.put(MODIFIER_HEIGHT, HeightModifierOperation::read); map.put(MODIFIER_WIDTH_IN, WidthInModifierOperation::read); map.put(MODIFIER_HEIGHT_IN, HeightInModifierOperation::read); map.put(MODIFIER_COLLAPSIBLE_PRIORITY, CollapsiblePriorityModifierOperation::read); map.put(MODIFIER_PADDING, PaddingModifierOperation::read); map.put(MODIFIER_BACKGROUND, BackgroundModifierOperation::read); map.put(MODIFIER_BORDER, BorderModifierOperation::read); Loading Loading
core/java/com/android/internal/widget/remotecompose/accessibility/AndroidPlatformSemanticNodeApplier.java +7 −2 Original line number Diff line number Diff line Loading @@ -132,8 +132,13 @@ public class AndroidPlatformSemanticNodeApplier } } // TODO correct values if (scrollDirection == RootContentBehavior.SCROLL_HORIZONTAL) { nodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(1, -1, false)); nodeInfo.setClassName("android.widget.HorizontalScrollView"); } else { nodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(-1, 1, false)); nodeInfo.setClassName("android.widget.ScrollView"); } if (scrollDirection == RootContentBehavior.SCROLL_HORIZONTAL) { nodeInfo.setClassName("android.widget.HorizontalScrollView"); Loading
core/java/com/android/internal/widget/remotecompose/accessibility/CoreDocumentAccessibility.java +40 −7 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.internal.widget.remotecompose.core.semantics.AccessibilitySem import com.android.internal.widget.remotecompose.core.semantics.AccessibleComponent; import com.android.internal.widget.remotecompose.core.semantics.CoreSemantics; import com.android.internal.widget.remotecompose.core.semantics.ScrollableComponent; import com.android.internal.widget.remotecompose.core.semantics.ScrollableComponent.ScrollDirection; import java.util.ArrayList; import java.util.Collections; Loading Loading @@ -104,9 +105,9 @@ public class CoreDocumentAccessibility implements RemoteComposeDocumentAccessibi if (isClickAction(action)) { return performClick(component); } else if (isScrollForwardAction(action)) { return scrollByOffset(mRemoteContext, component, -500) != 0; return scrollDirection(mRemoteContext, component, ScrollDirection.FORWARD); } else if (isScrollBackwardAction(action)) { return scrollByOffset(mRemoteContext, component, 500) != 0; return scrollDirection(mRemoteContext, component, ScrollDirection.BACKWARD); } else if (isShowOnScreenAction(action)) { return showOnScreen(mRemoteContext, component); } else { Loading Loading @@ -141,17 +142,30 @@ public class CoreDocumentAccessibility implements RemoteComposeDocumentAccessibi } private boolean showOnScreen(RemoteContext context, Component component) { if (component.getParent() instanceof LayoutComponent) { LayoutComponent parent = (LayoutComponent) component.getParent(); ScrollableComponent scrollable = findScrollable(component); if (scrollable != null) { return scrollable.showOnScreen(context, component); } return false; } @Nullable private static ScrollableComponent findScrollable(Component component) { Component parent = component.getParent(); while (parent != null) { ScrollableComponent scrollable = parent.selfOrModifier(ScrollableComponent.class); if (scrollable != null) { scrollable.showOnScreen(context, component.getComponentId()); return true; return scrollable; } else { parent = parent.getParent(); } } return false; return null; } /** Loading @@ -172,6 +186,25 @@ public class CoreDocumentAccessibility implements RemoteComposeDocumentAccessibi return 0; } /** * scroll content in a given direction * * @param context * @param component * @param direction * @return */ public boolean scrollDirection( RemoteContext context, Component component, ScrollDirection direction) { ScrollableComponent scrollable = component.selfOrModifier(ScrollableComponent.class); if (scrollable != null) { return scrollable.scrollDirection(context, direction); } return false; } /** * Perform a click on the given component * Loading
core/java/com/android/internal/widget/remotecompose/accessibility/PlatformRemoteComposeTouchHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper { private final RemoteComposeDocumentAccessibility mRemoteDocA11y; private final SemanticNodeApplier<AccessibilityNodeInfo> mApplier; private final View mHost; public PlatformRemoteComposeTouchHelper( View host, Loading @@ -47,6 +48,7 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper { super(host); this.mRemoteDocA11y = remoteDocA11y; this.mApplier = applier; this.mHost = host; } public static PlatformRemoteComposeTouchHelper forRemoteComposePlayer( Loading Loading @@ -150,6 +152,7 @@ public class PlatformRemoteComposeTouchHelper extends ExploreByTouchHelper { boolean performed = mRemoteDocA11y.performAction(component, action, arguments); if (performed) { mHost.invalidate(); invalidateRoot(); } Loading
core/java/com/android/internal/widget/remotecompose/core/CoreDocument.java +14 −7 Original line number Diff line number Diff line Loading @@ -73,7 +73,9 @@ public class CoreDocument implements Serializable { // We also keep a more fine-grained BUILD number, exposed as // ID_API_LEVEL = DOCUMENT_API_LEVEL + BUILD static final float BUILD = 0.5f; static final float BUILD = 0.6f; private static final boolean UPDATE_VARIABLES_BEFORE_LAYOUT = false; @NonNull ArrayList<Operation> mOperations = new ArrayList<>(); Loading Loading @@ -892,8 +894,11 @@ public class CoreDocument implements Serializable { registerVariables(context, mOperations); context.mMode = RemoteContext.ContextMode.UNSET; if (UPDATE_VARIABLES_BEFORE_LAYOUT) { mFirstPaint = true; } } /////////////////////////////////////////////////////////////////////////////////////////////// // Document infos Loading Loading @@ -1241,12 +1246,14 @@ public class CoreDocument implements Serializable { context.mRemoteComposeState = mRemoteComposeState; context.mRemoteComposeState.setContext(context); if (UPDATE_VARIABLES_BEFORE_LAYOUT) { // Update any dirty variables if (mFirstPaint) { mFirstPaint = false; } else { updateVariables(context, theme, mOperations); } } // If we have a content sizing set, we are going to take the original document // dimension into account and apply scale+translate according to the RootContentBehavior Loading
core/java/com/android/internal/widget/remotecompose/core/Operations.java +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.internal.widget.remotecompose.core.operations.layout.managers import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.BackgroundModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.BorderModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.ClipRectModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.CollapsiblePriorityModifierOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.ComponentVisibilityOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.DrawContentOperation; import com.android.internal.widget.remotecompose.core.operations.layout.modifiers.GraphicsLayerModifierOperation; Loading Loading @@ -257,6 +258,7 @@ public class Operations { public static final int MODIFIER_HEIGHT = 67; public static final int MODIFIER_WIDTH_IN = 231; public static final int MODIFIER_HEIGHT_IN = 232; public static final int MODIFIER_COLLAPSIBLE_PRIORITY = 235; public static final int MODIFIER_BACKGROUND = 55; public static final int MODIFIER_BORDER = 107; public static final int MODIFIER_PADDING = 58; Loading Loading @@ -368,6 +370,7 @@ public class Operations { map.put(MODIFIER_HEIGHT, HeightModifierOperation::read); map.put(MODIFIER_WIDTH_IN, WidthInModifierOperation::read); map.put(MODIFIER_HEIGHT_IN, HeightInModifierOperation::read); map.put(MODIFIER_COLLAPSIBLE_PRIORITY, CollapsiblePriorityModifierOperation::read); map.put(MODIFIER_PADDING, PaddingModifierOperation::read); map.put(MODIFIER_BACKGROUND, BackgroundModifierOperation::read); map.put(MODIFIER_BORDER, BorderModifierOperation::read); Loading