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

Commit 48b29458 authored by Sally's avatar Sally
Browse files

Add documentation about errors for announceForAccessibility.

This copies the live region documentation and puts it in the
announceForAccessibility javadocs, so developers see immediately that
they should use error APIs for error UIs.

Test: n/a
Bug: n/a
Change-Id: I9a7819d82b8ffdf779c7a6851e09fa8a9a55d361
parent 576099b9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -8537,6 +8537,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * announcements every time a View is updated.
     *
     * <p>
     * For notifying users about errors, such as in a login screen with text that displays an
     * "incorrect password" notification, that view should send an AccessibilityEvent of type
     * {@link AccessibilityEvent#CONTENT_CHANGE_TYPE_ERROR} and set
     * {@link AccessibilityNodeInfo#setError(CharSequence)} instead. Custom widgets should expose
     * error-setting methods that support accessibility automatically. For example, instead of
     * explicitly sending this event when using a TextView, use
     * {@link android.widget.TextView#setError(CharSequence)}.
     *
     * <p>
     * Use {@link #setStateDescription(CharSequence)} to convey state changes to views within the
     * user interface. While a live region may send different types of events generated by the view,
     * state description will send {@link AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED} events of