Merge "Add CONTENT_CHANGE_TYPE_ENABLED flag"

This commit is contained in:
Zeyin Wu
2022-10-12 03:04:45 +00:00
committed by Android (Google) Code Review
3 changed files with 17 additions and 0 deletions

View File

@@ -52022,6 +52022,7 @@ package android.view.accessibility {
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_ENABLED = 4096; // 0x1000
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

View File

@@ -12538,6 +12538,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (!enabled) {
cancelPendingInputEvents();
}
notifyViewAccessibilityStateChangedIfNeeded(
AccessibilityEvent.CONTENT_CHANGE_TYPE_ENABLED);
}
/**

View File

@@ -709,6 +709,18 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
*/
public static final int CONTENT_CHANGE_TYPE_ERROR = 0x0000800;
/**
* Change type for {@link #TYPE_WINDOW_CONTENT_CHANGED} event:
* The source node changed its ability to interact returned by
* {@link AccessibilityNodeInfo#isEnabled}.
* The view changing content's ability to interact should call
* {@link AccessibilityNodeInfo#setEnabled} and then send this event.
*
* @see AccessibilityNodeInfo#isEnabled
* @see AccessibilityNodeInfo#setEnabled
*/
public static final int CONTENT_CHANGE_TYPE_ENABLED = 1 << 12;
/** Change type for {@link #TYPE_SPEECH_STATE_CHANGE} event: another service is speaking. */
public static final int SPEECH_STATE_SPEAKING_START = 0x00000001;
@@ -836,6 +848,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
CONTENT_CHANGE_TYPE_DRAG_CANCELLED,
CONTENT_CHANGE_TYPE_CONTENT_INVALID,
CONTENT_CHANGE_TYPE_ERROR,
CONTENT_CHANGE_TYPE_ENABLED,
})
public @interface ContentChangeTypes {}
@@ -1105,6 +1118,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
case CONTENT_CHANGE_TYPE_CONTENT_INVALID:
return "CONTENT_CHANGE_TYPE_CONTENT_INVALID";
case CONTENT_CHANGE_TYPE_ERROR: return "CONTENT_CHANGE_TYPE_ERROR";
case CONTENT_CHANGE_TYPE_ENABLED: return "CONTENT_CHANGE_TYPE_ENABLED";
default: return Integer.toHexString(type);
}
}