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

Commit f9a761ed authored by Sally's avatar Sally Committed by Sally Yuen
Browse files

Make minor documentation improvements

- Point to ExploreByTouchHelper in A11yNodeProvider
- Point to appropriate properties and methods from events
- Give example of click dispatch of non-screen-reader services, as a
  fallback to CLICK failing

Test: n/a
Bug: 289400219
Bug: 287276093
Change-Id: I8e86133745f8517ca41df801414c4cc04200ebe7
parent d9b8ce09
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1204,7 +1204,21 @@ public abstract class AccessibilityService extends Service {
     * property in its meta-data. For more information, see
     * {@link #SERVICE_META_DATA}.
     * </p>
     *
     * <p>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:
     *
     * <pre class="prettyprint"><code>
     *     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);
     *     }
     *</code>
     * </pre>
     * @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.
+3 −0
Original line number Diff line number Diff line
@@ -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) {
+7 −1
Original line number Diff line number Diff line
@@ -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;

+4 −0
Original line number Diff line number Diff line
@@ -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:
 * </p>
 * <aside class="note">
 * <b>Note:</b> Consider using a {@link androidx.customview.widget.ExploreByTouchHelper}, a utility
 * extension of AccessibilityNodeProvider, to simplify many aspects of providing information to
 * accessibility services and managing accessibility focus. </aside>
 * <div>
 * <div class="ds-selector-tabs"><section><h3 id="kotlin">Kotlin</h3>
 * <pre class="prettyprint lang-kotlin">