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

Commit 7c1e6a84 authored by Mark Schillaci's avatar Mark Schillaci
Browse files

Clarify naming on some accessibility constants and add docs

This CL continues the internal cleanup work on the
accessibility Android code. With this CL we rename
some of the static constants, and add clarifying
comments.

There are no functional changes with this CL.

Bug: 253134477
Test: No functional changes, existing tests.

Change-Id: I744b3a94fe3c3cc3b559758a95ab0b5b181155bb
parent 1d46f8bb
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -1034,10 +1034,8 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
        mEventTime = event.mEventTime;
        mPackageName = event.mPackageName;
        if (event.mRecords != null) {
            final int recordCount = event.mRecords.size();
            mRecords = new ArrayList<>(recordCount);
            for (int i = 0; i < recordCount; i++) {
                final AccessibilityRecord record = event.mRecords.get(i);
            mRecords = new ArrayList<>(event.mRecords.size());
            for (AccessibilityRecord record : event.mRecords) {
                final AccessibilityRecord recordClone = new AccessibilityRecord(record);
                mRecords.add(recordClone);
            }
@@ -1057,9 +1055,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
        super.setSealed(sealed);
        final List<AccessibilityRecord> records = mRecords;
        if (records != null) {
            final int recordCount = records.size();
            for (int i = 0; i < recordCount; i++) {
                AccessibilityRecord record = records.get(i);
            for (AccessibilityRecord record : records) {
                record.setSealed(sealed);
            }
        }
+46 −10
Original line number Diff line number Diff line
@@ -199,10 +199,29 @@ public class AccessibilityNodeInfo implements Parcelable {
     */
    public static final int FLAG_PREFETCH_UNINTERRUPTIBLE = 1 << 5;

    /** @hide */
    public static final int FLAG_PREFETCH_MASK = 0x0000003f;
    /**
     * Mask for {@link PrefetchingStrategy} all types.
     *
     * @see #FLAG_PREFETCH_ANCESTORS
     * @see #FLAG_PREFETCH_SIBLINGS
     * @see #FLAG_PREFETCH_DESCENDANTS_HYBRID
     * @see #FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
     * @see #FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
     * @see #FLAG_PREFETCH_UNINTERRUPTIBLE
     *
     * @hide
     */
    public static final int FLAG_PREFETCH_MASK = 0x0000003F;

    /** @hide */
    /**
     * Mask for {@link PrefetchingStrategy} that includes only descendants-related strategies.
     *
     * @see #FLAG_PREFETCH_DESCENDANTS_HYBRID
     * @see #FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
     * @see #FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
     *
     * @hide
     */
    public static final int FLAG_PREFETCH_DESCENDANTS_MASK = 0x0000001C;

    /**
@@ -243,7 +262,11 @@ public class AccessibilityNodeInfo implements Parcelable {
     */
    public static final int FLAG_SERVICE_IS_ACCESSIBILITY_TOOL = 1 << 9;

    /** @hide */
    /**
     * Mask for all types of additional view data exposed to services.
     *
     * @hide
     */
    public static final int FLAG_REPORT_MASK =
            FLAG_SERVICE_REQUESTS_INCLUDE_NOT_IMPORTANT_VIEWS
                    | FLAG_SERVICE_REQUESTS_REPORT_VIEW_IDS
@@ -472,9 +495,22 @@ public class AccessibilityNodeInfo implements Parcelable {
    public static final int LAST_LEGACY_STANDARD_ACTION = ACTION_SET_TEXT;

    /**
     * Mask to see if the value is larger than the largest ACTION_ constant
     * Mask to verify if a given value is a combination of the existing ACTION_ constants.
     *
     * The smallest possible action is 1, and the largest is 1 << 21, or {@link ACTION_SET_TEXT}. A
     * node can have any combination of actions present, so a node's max action int is:
     *
     *   0000 0000 0011 1111 1111 1111 1111 1111
     *
     * Therefore, if an action has any of the following bits flipped, it will be invalid:
     *
     *   1111 1111 11-- ---- ---- ---- ---- ----
     *
     * This can be represented in hexadecimal as 0xFFC00000.
     *
     * @see AccessibilityNodeInfo#addAction(int)
     */
    private static final int ACTION_TYPE_MASK = 0xFF000000;
    private static final int INVALID_ACTIONS_MASK = 0xFFC00000;

    // Action arguments.

@@ -752,7 +788,7 @@ public class AccessibilityNodeInfo implements Parcelable {

    /**
     * Integer argument specifying the end index of the requested text location data. Must be
     * positive and no larger than {@link #EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH}.
     * positive and no larger than {@link #EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH}.
     *
     * @see #EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
     */
@@ -1536,7 +1572,7 @@ public class AccessibilityNodeInfo implements Parcelable {
    public void addAction(int action) {
        enforceNotSealed();

        if ((action & ACTION_TYPE_MASK) != 0) {
        if ((action & INVALID_ACTIONS_MASK) != 0) {
            throw new IllegalArgumentException("Action is not a combination of the standard " +
                    "actions: " + action);
        }
@@ -6521,7 +6557,7 @@ public class AccessibilityNodeInfo implements Parcelable {
        /**
         * @see android.os.Parcelable.Creator
         */
        public static final @android.annotation.NonNull Parcelable.Creator<TouchDelegateInfo> CREATOR =
        public static final @NonNull Parcelable.Creator<TouchDelegateInfo> CREATOR =
                new Parcelable.Creator<TouchDelegateInfo>() {
            @Override
            public TouchDelegateInfo createFromParcel(Parcel parcel) {
@@ -6693,7 +6729,7 @@ public class AccessibilityNodeInfo implements Parcelable {
    /**
     * @see android.os.Parcelable.Creator
     */
    public static final @android.annotation.NonNull Parcelable.Creator<AccessibilityNodeInfo> CREATOR =
    public static final @NonNull Parcelable.Creator<AccessibilityNodeInfo> CREATOR =
            new Parcelable.Creator<AccessibilityNodeInfo>() {
        @Override
        public AccessibilityNodeInfo createFromParcel(Parcel parcel) {
+1 −2
Original line number Diff line number Diff line
@@ -198,8 +198,7 @@ public class AccessibilityRecord {
     *
     * @see AccessibilityNodeInfo#getParent(int) for a description of prefetching.
     */
    @Nullable
    public AccessibilityNodeInfo getSource(
    public @Nullable AccessibilityNodeInfo getSource(
            @AccessibilityNodeInfo.PrefetchingStrategy int prefetchingStrategy) {
        enforceSealed();
        if ((mConnectionId == UNDEFINED)