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

Commit 9eef24a5 authored by Zeyin Wu's avatar Zeyin Wu
Browse files

Add CONTENT_CHANGE_TYPE_CONTENT_INVALID CONTENT_CHANGE_TYPE_ERROR

Bug: 230141621
Test: cts tests & manually verified on talkback_tests
Change-Id: Ifebb197340b9e22b7451eb2292b22bce41a2cc9e
parent 7f8a4a2f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -51750,10 +51750,11 @@ package android.view.accessibility {
    method public void setSpeechStateChangeTypes(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION = 4; // 0x4
    field public static final int CONTENT_CHANGE_TYPE_CONTENT_INVALID = 1024; // 0x400
    field public static final int CONTENT_CHANGE_TYPE_DRAG_CANCELLED = 512; // 0x200
    field public static final int CONTENT_CHANGE_TYPE_DRAG_DROPPED = 256; // 0x100
    field public static final int CONTENT_CHANGE_TYPE_DRAG_STARTED = 128; // 0x80
    field public static final int CONTENT_CHANGE_TYPE_INVALID = 1024; // 0x400
    field public static final int CONTENT_CHANGE_TYPE_ERROR = 2048; // 0x800
    field public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED = 16; // 0x10
    field public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED = 32; // 0x20
    field public static final int CONTENT_CHANGE_TYPE_PANE_TITLE = 8; // 0x8
+23 −9
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.widget.TextView;

import com.android.internal.util.BitUtils;

@@ -686,15 +685,27 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par

    /**
     * Change type for {@link #TYPE_WINDOW_CONTENT_CHANGED} event:
     * It means the content is invalid or associated with an error.
     * For example, text that sets an error message, such as when input isn't in a valid format,
     * should send this event and use {@link AccessibilityNodeInfo#setError} to
     * provide more context.
     * The source node changed its content validity returned by
     * {@link AccessibilityNodeInfo#isContentInvalid}.
     * The view changing content validity should call
     * {@link AccessibilityNodeInfo#setContentInvalid} and then send this event.
     *
     * @see AccessibilityNodeInfo#isContentInvalid
     * @see AccessibilityNodeInfo#setContentInvalid
     */
    public static final int CONTENT_CHANGE_TYPE_CONTENT_INVALID = 0x0000400;

    /**
     * Change type for {@link #TYPE_WINDOW_CONTENT_CHANGED} event:
     * The source node changed its erroneous content's error message returned by
     * {@link AccessibilityNodeInfo#getError}.
     * The view changing erroneous content's error message should call
     * {@link AccessibilityNodeInfo#setError} and then send this event.
     *
     * @see AccessibilityNodeInfo#getError
     * @see AccessibilityNodeInfo#setError
     * @see TextView#setError
     */
    public static final int CONTENT_CHANGE_TYPE_INVALID = 0x0000400;
    public static final int CONTENT_CHANGE_TYPE_ERROR = 0x0000800;

    /** Change type for {@link #TYPE_SPEECH_STATE_CHANGE} event: another service is speaking. */
    public static final int SPEECH_STATE_SPEAKING_START = 0x00000001;
@@ -821,7 +832,8 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
                CONTENT_CHANGE_TYPE_DRAG_STARTED,
                CONTENT_CHANGE_TYPE_DRAG_DROPPED,
                CONTENT_CHANGE_TYPE_DRAG_CANCELLED,
                CONTENT_CHANGE_TYPE_INVALID,
                CONTENT_CHANGE_TYPE_CONTENT_INVALID,
                CONTENT_CHANGE_TYPE_ERROR,
            })
    public @interface ContentChangeTypes {}

@@ -1088,7 +1100,9 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
            case CONTENT_CHANGE_TYPE_DRAG_STARTED: return "CONTENT_CHANGE_TYPE_DRAG_STARTED";
            case CONTENT_CHANGE_TYPE_DRAG_DROPPED: return "CONTENT_CHANGE_TYPE_DRAG_DROPPED";
            case CONTENT_CHANGE_TYPE_DRAG_CANCELLED: return "CONTENT_CHANGE_TYPE_DRAG_CANCELLED";
            case CONTENT_CHANGE_TYPE_INVALID: return "CONTENT_CHANGE_TYPE_INVALID";
            case CONTENT_CHANGE_TYPE_CONTENT_INVALID:
                return "CONTENT_CHANGE_TYPE_CONTENT_INVALID";
            case CONTENT_CHANGE_TYPE_ERROR: return "CONTENT_CHANGE_TYPE_ERROR";
            default: return Integer.toHexString(type);
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -7618,7 +7618,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        createEditorIfNeeded();
        mEditor.setError(error, icon);
        notifyViewAccessibilityStateChangedIfNeeded(
                AccessibilityEvent.CONTENT_CHANGE_TYPE_INVALID);
                AccessibilityEvent.CONTENT_CHANGE_TYPE_ERROR
                        | AccessibilityEvent.CONTENT_CHANGE_TYPE_CONTENT_INVALID);
    }
    @Override