diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index c395e15d23e93..1a2342ed5dfcd 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -1204,7 +1204,21 @@ public abstract class AccessibilityService extends Service { * property in its meta-data. For more information, see * {@link #SERVICE_META_DATA}. *

+ *

Since many apps do not appropriately support {@link AccessibilityAction#ACTION_CLICK}, + * if this action fails on an element that should be clickable, a service that is not a screen + * reader may send a tap directly to the element as a fallback. The example below + * demonstrates this fallback using the gesture dispatch APIs: * + *


+     *     private void tap(PointF point) {
+     *         StrokeDescription tap =  new StrokeDescription(path(point), 0,
+     *         ViewConfiguration.getTapTimeout());
+     *         GestureDescription.Builder builder = new GestureDescription.Builder();
+     *         builder.addStroke(tap);
+     *         dispatchGesture(builder.build(), null, null);
+     *     }
+     *
+     * 
* @param gesture The gesture to dispatch * @param callback The object to call back when the status of the gesture is known. If * {@code null}, no status is reported. diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 71e9052627b93..46b85705b5023 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8075,6 +8075,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @param rectangle The rectangle in the View's content coordinate space * @return Whether any parent scrolled. + * @see AccessibilityAction#ACTION_SHOW_ON_SCREEN */ public boolean requestRectangleOnScreen(Rect rectangle) { return requestRectangleOnScreen(rectangle, false); @@ -11185,6 +11186,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @param stateDescription The state description. * @see #getStateDescription() + * @see #setContentDescription(CharSequence) for the difference between content and + * state descriptions. */ @RemotableViewMethod public void setStateDescription(@Nullable CharSequence stateDescription) { diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java index 73477ecd4f83c..084044b60cf7e 100644 --- a/core/java/android/view/accessibility/AccessibilityEvent.java +++ b/core/java/android/view/accessibility/AccessibilityEvent.java @@ -475,6 +475,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par /** * Represents the event of selecting an item usually in the context of an * {@link android.widget.AdapterView}. + * @see AccessibilityNodeInfo.AccessibilityAction#ACTION_SELECT */ public static final int TYPE_VIEW_SELECTED = 1 << 2; @@ -485,6 +486,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par /** * Represents the event of changing the text of an {@link android.widget.EditText}. + * @see AccessibilityNodeInfo#setText(CharSequence) */ public static final int TYPE_VIEW_TEXT_CHANGED = 1 << 4; @@ -646,6 +648,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par /** * Change type for {@link #TYPE_WINDOW_CONTENT_CHANGED} event: * The node's text changed. + * @see AccessibilityNodeInfo#setText(CharSequence) */ public static final int CONTENT_CHANGE_TYPE_TEXT = 1 << 1; @@ -662,7 +665,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * If this makes the pane appear, {@link #CONTENT_CHANGE_TYPE_PANE_APPEARED} is sent * instead. If this makes the pane disappear, {@link #CONTENT_CHANGE_TYPE_PANE_DISAPPEARED} * is sent. - * + * @see View#setAccessibilityPaneTitle(CharSequence) */ public static final int CONTENT_CHANGE_TYPE_PANE_TITLE = 1 << 3; @@ -670,6 +673,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * Change type for {@link #TYPE_WINDOW_STATE_CHANGED} event: * The node has a pane title, and either just appeared or just was assigned a title when it * had none before. + * @see View#setAccessibilityPaneTitle(CharSequence) */ public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED = 1 << 4; @@ -681,6 +685,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * No source will be returned if the node is no longer on the screen. To make the change more * clear for the user, the first entry in {@link #getText()} will return the value that would * have been returned by {@code getSource().getPaneTitle()}. + * @see View#setAccessibilityPaneTitle(CharSequence) */ public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED = 1 << 5; @@ -691,6 +696,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * changes, the changed part can be put into event text. For example, if state description * changed from "on, wifi signal full" to "on, wifi three bars", "wifi three bars" can be put * into the event text. + * @see View#setStateDescription(CharSequence) */ public static final int CONTENT_CHANGE_TYPE_STATE_DESCRIPTION = 1 << 6; diff --git a/core/java/android/view/accessibility/AccessibilityNodeProvider.java b/core/java/android/view/accessibility/AccessibilityNodeProvider.java index 91d4a3598e65b..1868a43d1d223 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeProvider.java +++ b/core/java/android/view/accessibility/AccessibilityNodeProvider.java @@ -45,6 +45,10 @@ import java.util.List; * View itself. Similarly the returned instance is responsible for performing accessibility * actions on any virtual view or the root view itself. For example: *

+ * *
*

Kotlin

*