From b0fede0ec0fbc37660eac6d5c4d5afbf71daae11 Mon Sep 17 00:00:00 2001
From: Sally Yuen
Date: Mon, 5 Jun 2023 17:51:24 +0000
Subject: [PATCH] Add javadocs for selection and edit a11y actions
View with selection/edit actions should send appropriate events and set the selectable/editable node properties.
Point developers to the AccessibilityAction definitions
Bug: 283458590
Test: n/a
Change-Id: Iabf8100f4712401c06ded2819274f616d689fd83
---
.../accessibility/AccessibilityNodeInfo.java | 38 ++++++++-----------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index a20b2b2f79a46..0b081e5c75b78 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -240,6 +240,7 @@ public class AccessibilityNodeInfo implements Parcelable {
/**
* Action that selects the node.
+ * @see AccessibilityAction#ACTION_SELECT
*/
public static final int ACTION_SELECT = 0x00000004;
@@ -395,19 +396,8 @@ public class AccessibilityNodeInfo implements Parcelable {
/**
* Action to set the selection. Performing this action with no arguments
* clears the selection.
- *
- * Arguments:
- * {@link #ACTION_ARGUMENT_SELECTION_START_INT},
- * {@link #ACTION_ARGUMENT_SELECTION_END_INT}
- * Example:
- *
- * Bundle arguments = new Bundle();
- * arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1);
- * arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2);
- * info.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments);
- *
- *
*
+ * @see AccessibilityAction#ACTION_SET_SELECTION
* @see #ACTION_ARGUMENT_SELECTION_START_INT
* @see #ACTION_ARGUMENT_SELECTION_END_INT
*/
@@ -432,16 +422,7 @@ public class AccessibilityNodeInfo implements Parcelable {
* Action that sets the text of the node. Performing the action without argument, using
* null or empty {@link CharSequence} will clear the text. This action will also put the
* cursor at the end of text.
- *
- * Arguments:
- * {@link #ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE}
- * Example:
- *
- * Bundle arguments = new Bundle();
- * arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
- * "android");
- * info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
- *
+ * @see AccessibilityAction#ACTION_SET_TEXT
*/
public static final int ACTION_SET_TEXT = 0x00200000;
@@ -4717,12 +4698,16 @@ public class AccessibilityNodeInfo implements Parcelable {
/**
* Action that selects the node.
+ * The view the implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_SELECTED} event.
+ * @see AccessibilityAction#ACTION_CLEAR_SELECTION
*/
public static final AccessibilityAction ACTION_SELECT =
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SELECT);
/**
* Action that deselects the node.
+ * @see AccessibilityAction#ACTION_SELECT
*/
public static final AccessibilityAction ACTION_CLEAR_SELECTION =
new AccessibilityAction(AccessibilityNodeInfo.ACTION_CLEAR_SELECTION);
@@ -4927,7 +4912,10 @@ public class AccessibilityNodeInfo implements Parcelable {
* info.performAction(AccessibilityAction.ACTION_SET_SELECTION.getId(), arguments);
*
*
- *
+ * If this is a text selection, the UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_TEXT_SELECTION_CHANGED} event if its selection is
+ * updated. This element should also return {@code true} for
+ * {@link AccessibilityNodeInfo#isTextSelectable()}.
* @see AccessibilityNodeInfo#ACTION_ARGUMENT_SELECTION_START_INT
* AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT
* @see AccessibilityNodeInfo#ACTION_ARGUMENT_SELECTION_END_INT
@@ -4969,6 +4957,10 @@ public class AccessibilityNodeInfo implements Parcelable {
* "android");
* info.performAction(AccessibilityAction.ACTION_SET_TEXT.getId(), arguments);
*
+ * The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} event if its text is updated.
+ * This element should also return {@code true} for
+ * {@link AccessibilityNodeInfo#isEditable()}.
*/
public static final AccessibilityAction ACTION_SET_TEXT =
new AccessibilityAction(AccessibilityNodeInfo.ACTION_SET_TEXT);