AccessibilityEvent
class AccessibilityEvent : AccessibilityRecord, Parcelable
kotlin.Any | ||
↳ | android.view.accessibility.AccessibilityRecord | |
↳ | android.view.accessibility.AccessibilityEvent |
This class represents accessibility events that are sent by the system when something notable happens in the user interface. For example, when a android.widget.Button
is clicked, a android.view.View
is focused, etc.
An accessibility event is fired by an individual view which populates the event with data for its state and requests from its parent to send the event to interested parties. The parent can optionally modify or even block the event based on its broader understanding of the user interface's context.
The main purpose of an accessibility event is to communicate changes in the UI to an android.accessibilityservice.AccessibilityService
. If needed, the service may then inspect the user interface by examining the View hierarchy through the event's source
, as represented by a tree of AccessibilityNodeInfo
s (snapshot of a View state) which can be used for exploring the window content. Note that the privilege for accessing an event's source, thus the window content, has to be explicitly requested. For more details refer to android.accessibilityservice.AccessibilityService
. If an accessibility service has not requested to retrieve the window content the event will not contain reference to its source. Note: for events of type TYPE_NOTIFICATION_STATE_CHANGED
the source is never available, and Views that set android.view.View#isAccessibilityDataSensitive()
may not populate all event properties on events sent from higher up in the view hierarchy.
This class represents various semantically different accessibility event types. Each event type has an associated set of related properties. In other words, each event type is characterized via a subset of the properties exposed by this class. For each event type there is a corresponding constant defined in this class. Follows a specification of the event types and their associated properties:
VIEW TYPES
View clicked - represents the event of clicking on a android.view.View
like android.widget.Button
, android.widget.CompoundButton
, etc.
Type:TYPE_VIEW_CLICKED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
View long clicked - represents the event of long clicking on a android.view.View
like android.widget.Button
, android.widget.CompoundButton
, etc
Type:TYPE_VIEW_LONG_CLICKED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
View selected - represents the event of selecting an item usually in the context of an android.widget.AdapterView
.
Type: TYPE_VIEW_SELECTED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
View focused - represents the event of focusing a android.view.View
.
Type: TYPE_VIEW_FOCUSED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
View text changed - represents the event of changing the text of an android.widget.EditText
.
Type: TYPE_VIEW_TEXT_CHANGED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The new text of the source.getBeforeText()
- The text of the source before the change.getFromIndex()
- The text change start index.getAddedCount()
- The number of added characters.getRemovedCount()
- The number of removed characters.
View text selection changed - represents the event of changing the text selection of an android.widget.EditText
.
Type: TYPE_VIEW_TEXT_SELECTION_CHANGED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
Type:
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getMovementGranularity()
- Sets the granularity at which a view's text was traversed.getText()
- The text of the source's sub-tree.getFromIndex()
- The start the text that was skipped over in this movement. This is the starting point when moving forward through the text, but not when moving back.getToIndex()
- The end of the text that was skipped over in this movement. This is the ending point when moving forward through the text, but not when moving back.getAction()
- Gets traversal action which specifies the direction.
View scrolled - represents the event of scrolling a view.
Type: TYPE_VIEW_SCROLLED
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getScrollDeltaX()
- The difference in the horizontal position.getScrollDeltaY()
- The difference in the vertical position.getMaxScrollX()
()} - The max scroll offset of the source left edgegetMaxScrollY()
()} - The max scroll offset of the source top edge.
TRANSITION TYPES
Window state changed - represents the event of a change to a section of the user interface that is visually distinct. Should be sent from either the root view of a window or from a view that is marked as a pane android.view.View#setAccessibilityPaneTitle(CharSequence)
. Note that changes to true windows are represented by TYPE_WINDOWS_CHANGED
.
Type: TYPE_WINDOW_STATE_CHANGED
Properties:
getEventType()
- The type of the event.getContentChangeTypes()
- The type of state changes.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree, including the pane titles.
Window content changed - represents the event of change in the content of a window. This change can be adding/removing view, changing a view size, etc.
Type: TYPE_WINDOW_CONTENT_CHANGED
Properties:
getEventType()
- The type of the event.getContentChangeTypes()
- The type of content changes.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
Windows changed - represents a change in the windows shown on the screen such as a window appeared, a window disappeared, a window size changed, a window layer changed, etc. These events should only come from the system, which is responsible for managing windows. The list of windows is available from android.accessibilityservice.AccessibilityService#getWindows()
. For regions of the user interface that are presented as windows but are controlled by an app's process, use TYPE_WINDOW_STATE_CHANGED
.
Type: TYPE_WINDOWS_CHANGED
Properties:
getEventType()
- The type of the event.getEventTime()
- The event time.getWindowChanges()
- The specific change to the source window
AccessibilityWindowInfo
for the window source of the event by looking through the list returned by android.accessibilityservice.AccessibilityService#getWindows()
for the window whose ID matches getWindowId()
.
NOTIFICATION TYPES
Notification state changed - represents the event showing a transient piece of information to the user. This information may be a android.app.Notification
or android.widget.Toast
.
Type: TYPE_NOTIFICATION_STATE_CHANGED
Properties:
getEventType()
- The type of the event.getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getParcelableData()
- The postedandroid.app.Notification
, if applicable.getText()
- Displayed text of theandroid.widget.Toast
, if applicable, or may contain text from theandroid.app.Notification
, althoughgetParcelableData()
is a richer set of data forandroid.app.Notification
.
EXPLORATION TYPES
View hover enter - represents the event of beginning to hover over a android.view.View
. The hover may be generated via exploring the screen by touch or via a pointing device.
Type: TYPE_VIEW_HOVER_ENTER
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
android.view.View
. The hover may be generated via exploring the screen by touch or via a pointing device.Type:
TYPE_VIEW_HOVER_EXIT
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
View scrolled to - represents the event of a target node brought on screen by ACTION_SCROLL_IN_DIRECTION. Type: TYPE_VIEW_TARGETED_BY_SCROLL
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients). This represents the node that is brought on screen as a result of the scroll.getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.
Touch interaction start - represents the event of starting a touch interaction, which is the user starts touching the screen.
Type: TYPE_TOUCH_INTERACTION_START
Properties:
getEventType()
- The type of the event.
Touch interaction end - represents the event of ending a touch interaction, which is the user stops touching the screen.
Type: TYPE_TOUCH_INTERACTION_END
Properties:
getEventType()
- The type of the event.
Touch exploration gesture start - represents the event of starting a touch exploring gesture.
Type: TYPE_TOUCH_EXPLORATION_GESTURE_START
Properties:
getEventType()
- The type of the event.
Touch exploration gesture end - represents the event of ending a touch exploring gesture.
Type: TYPE_TOUCH_EXPLORATION_GESTURE_END
Properties:
getEventType()
- The type of the event.
Touch gesture detection start - represents the event of starting a user gesture detection.
Type: TYPE_GESTURE_DETECTION_START
Properties:
getEventType()
- The type of the event.
Touch gesture detection end - represents the event of ending a user gesture detection.
Type: TYPE_GESTURE_DETECTION_END
Properties:
getEventType()
- The type of the event.
MISCELLANEOUS TYPES
Announcement - represents the event of an application requesting a screen reader to make an announcement. Because the event carries no semantic meaning, this event is appropriate only in exceptional situations where additional screen reader output is needed but other types of accessibility services do not need to be aware of the change.
Type: TYPE_ANNOUNCEMENT
Properties:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the announcement.
speechStateChanged Type: TYPE_SPEECH_STATE_CHANGE
Represents a change in the speech state defined by the bit mask of the speech state change types. A change in the speech state occurs when an application wants to signal that it is either speaking or listening for human speech. This event helps avoid conflicts where two applications want to speak or one listens when another speaks. When sending this event, the sender should ensure that the accompanying state change types make sense. For example, the sender should not send SPEECH_STATE_SPEAKING_START
and SPEECH_STATE_SPEAKING_END
together. Properties:
getSpeechStateChangeTypes()
- The type of state changesgetPackageName()
- The package name of the source.getEventTime()
- The event time.
Summary
Constants | |
---|---|
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Invalid selection/focus position. |
static Int |
Maximum length of the text fields. |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Mask for |
static Int |
Represents the event of an application making an announcement. |
static Int |
Represents the event of the assistant currently reading the users screen context. |
static Int |
Represents the event of ending gesture detection. |
static Int |
Represents the event of beginning gesture detection. |
static Int |
Represents the event showing a |
static Int |
Represents a change in the speech state defined by the speech state change types. |
static Int |
Represents the event of ending a touch exploration gesture. |
static Int |
Represents the event of starting a touch exploration gesture. |
static Int |
Represents the event of the user ending to touch the screen. |
static Int |
Represents the event of the user starting to touch the screen. |
static Int |
Represents the event of gaining accessibility focus. |
static Int |
Represents the event of clearing accessibility focus. |
static Int |
Represents the event of clicking on a |
static Int |
Represents the event of a context click on a |
static Int |
Represents the event of setting input focus of a |
static Int |
Represents the event of a hover enter over a |
static Int |
Represents the event of a hover exit over a |
static Int |
Represents the event of long clicking on a |
static Int |
Represents the event of scrolling a view. |
static Int |
Represents the event of selecting an item usually in the context of an |
static Int |
Represents the event of a scroll having completed and brought the target node on screen. |
static Int |
Represents the event of changing the text of an |
static Int |
Represents the event of changing the selection in an |
static Int |
Represents the event of traversing the text of a view at a given movement granularity. |
static Int |
Represents the event change in the system windows shown on the screen. |
static Int |
Represents the event of changing the content of a window and more specifically the sub-tree rooted at the event's source. |
static Int |
Represents the event of a change to a visually distinct section of the user interface. |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
static Int |
Change type for |
Inherited constants | |
---|---|
Public constructors | |
---|---|
Creates a new |
|
AccessibilityEvent(eventType: Int) Creates a new |
|
AccessibilityEvent(event: AccessibilityEvent) Copy constructor. |
Public methods | |
---|---|
Unit |
appendRecord(record: AccessibilityRecord!) Appends an |
Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
static String! |
eventTypeToString(eventType: Int) Returns the string representation of an event type. |
Int |
Gets the performed action that triggered this event. |
Int |
Gets the bit mask of change types signaled by a |
Long |
Gets the time in which this event was sent. |
Int |
Gets the event type. |
Int |
Gets the movement granularity that was traversed. |
CharSequence! |
Gets the package name of the source. |
AccessibilityRecord! |
Gets the record at a given index. |
Int |
Gets the number of records contained in the event. |
Int |
Gets the bit mask of the speech state signaled by a |
Int |
Get the bit mask of change types signaled by a |
Unit |
initFromParcel(parcel: Parcel!) Creates a new instance from a |
Boolean |
Whether the event should only be delivered to an |
static AccessibilityEvent! |
Instantiates a new AccessibilityEvent instance with its type property set. |
static AccessibilityEvent! |
obtain(event: AccessibilityEvent!) Instantiates a new AccessibilityEvent instance. |
static AccessibilityEvent! |
obtain() Instantiates a new AccessibilityEvent instance. |
Unit |
recycle() Previously would recycle an instance back to be reused. |
Unit |
setAccessibilityDataSensitive(accessibilityDataSensitive: Boolean) Sets whether the event should only be delivered to an |
Unit |
Sets the performed action that triggered this event. |
Unit |
setContentChangeTypes(changeTypes: Int) Sets the bit mask of node tree changes signaled by an |
Unit |
setEventTime(eventTime: Long) Sets the time in which this event was sent. |
Unit |
setEventType(eventType: Int) Sets the event type. |
Unit |
setMovementGranularity(granularity: Int) Sets the movement granularity that was traversed. |
Unit |
setPackageName(packageName: CharSequence!) Sets the package name of the source. |
Unit |
setSpeechStateChangeTypes(state: Int) Sets the bit mask of the speech state change types signaled by a |
String |
toString() |
Unit |
writeToParcel(parcel: Parcel, flags: Int) Flatten this object in to a Parcel. |
Inherited functions | |
---|---|
Properties | |
---|---|
static Parcelable.Creator<AccessibilityEvent!> |
Constants
CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
static val CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: The node's content description changed.
Value: 4
CONTENT_CHANGE_TYPE_CONTENT_INVALID
static val CONTENT_CHANGE_TYPE_CONTENT_INVALID: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: The source node changed its content validity returned by AccessibilityNodeInfo#isContentInvalid
. The view changing content validity should call AccessibilityNodeInfo#setContentInvalid
and then send this event.
Value: 1024
CONTENT_CHANGE_TYPE_DRAG_CANCELLED
static val CONTENT_CHANGE_TYPE_DRAG_CANCELLED: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: A drag in with accessibility enabled has ended. This means the content has been unsuccessfully dropped, the user has canceled the action via an AccessibilityAction, or no drop has been detected within a timeout and the drag was automatically cancelled. This is sent from the source that initiated the drag.
Value: 512
CONTENT_CHANGE_TYPE_DRAG_DROPPED
static val CONTENT_CHANGE_TYPE_DRAG_DROPPED: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: A drag in with accessibility enabled has ended. This means the content has been successfully dropped. This is sent from the target that accepted the dragged content.
Value: 256
CONTENT_CHANGE_TYPE_DRAG_STARTED
static val CONTENT_CHANGE_TYPE_DRAG_STARTED: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: A drag has started while accessibility is enabled. This is either via an AccessibilityAction, or via touch events. This is sent from the source that initiated the drag.
Value: 128
CONTENT_CHANGE_TYPE_ENABLED
static val CONTENT_CHANGE_TYPE_ENABLED: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: The source node changed its ability to interact returned by AccessibilityNodeInfo#isEnabled
. The view changing content's ability to interact should call AccessibilityNodeInfo#setEnabled
and then send this event.
Value: 4096
CONTENT_CHANGE_TYPE_ERROR
static val CONTENT_CHANGE_TYPE_ERROR: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: The source node changed its erroneous content's error message returned by AccessibilityNodeInfo#getError
. The view changing erroneous content's error message should call AccessibilityNodeInfo#setError
and then send this event.
Value: 2048
CONTENT_CHANGE_TYPE_PANE_APPEARED
static val CONTENT_CHANGE_TYPE_PANE_APPEARED: Int
Change type for 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.
Value: 16
CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
static val CONTENT_CHANGE_TYPE_PANE_DISAPPEARED: Int
Change type for TYPE_WINDOW_STATE_CHANGED
event: Can mean one of two slightly different things. The primary meaning is that the node has a pane title, and was removed from the node hierarchy. It will also be sent if the pane title is set to null
after it contained a title. 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 getText()
will return the value that would have been returned by getSource().getPaneTitle()
.
Value: 32
CONTENT_CHANGE_TYPE_PANE_TITLE
static val CONTENT_CHANGE_TYPE_PANE_TITLE: Int
Change type for TYPE_WINDOW_STATE_CHANGED
event: The node's pane title changed.
If this makes the pane appear, CONTENT_CHANGE_TYPE_PANE_APPEARED
is sent instead. If this makes the pane disappear, CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
is sent.
Value: 8
CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
static val CONTENT_CHANGE_TYPE_STATE_DESCRIPTION: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: state description of the node as returned by AccessibilityNodeInfo#getStateDescription
changed. If part of the state description 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.
Value: 64
CONTENT_CHANGE_TYPE_SUBTREE
static val CONTENT_CHANGE_TYPE_SUBTREE: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: One or more content changes occurred in the the subtree rooted at the source node, or the subtree's structure changed when a node was added or removed.
Value: 1
CONTENT_CHANGE_TYPE_TEXT
static val CONTENT_CHANGE_TYPE_TEXT: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: The node's text changed.
Value: 2
CONTENT_CHANGE_TYPE_UNDEFINED
static val CONTENT_CHANGE_TYPE_UNDEFINED: Int
Change type for TYPE_WINDOW_CONTENT_CHANGED
event: The type of change is not defined.
Value: 0
INVALID_POSITION
static val INVALID_POSITION: Int
Invalid selection/focus position.
Value: -1
See Also
MAX_TEXT_LENGTH
static valMAX_TEXT_LENGTH: Int
Deprecated: Deprecated in Java.
Maximum length of the text fields.
Value: 500
See Also
SPEECH_STATE_LISTENING_END
static val SPEECH_STATE_LISTENING_END: Int
Change type for TYPE_SPEECH_STATE_CHANGE
event: another service is no longer listening to the microphone.
Value: 8
SPEECH_STATE_LISTENING_START
static val SPEECH_STATE_LISTENING_START: Int
Change type for TYPE_SPEECH_STATE_CHANGE
event: another service is listening to the microphone.
Value: 4
SPEECH_STATE_SPEAKING_END
static val SPEECH_STATE_SPEAKING_END: Int
Change type for TYPE_SPEECH_STATE_CHANGE
event: another service is no longer speaking.
Value: 2
SPEECH_STATE_SPEAKING_START
static val SPEECH_STATE_SPEAKING_START: Int
Change type for TYPE_SPEECH_STATE_CHANGE
event: another service is speaking.
Value: 1
TYPES_ALL_MASK
static val TYPES_ALL_MASK: Int
Mask for AccessibilityEvent
all types.
Value: -1
See Also
#TYPE_VIEW_CLICKED
#TYPE_VIEW_LONG_CLICKED
#TYPE_VIEW_SELECTED
#TYPE_VIEW_FOCUSED
#TYPE_VIEW_TEXT_CHANGED
#TYPE_WINDOW_STATE_CHANGED
#TYPE_NOTIFICATION_STATE_CHANGED
#TYPE_VIEW_HOVER_ENTER
#TYPE_VIEW_HOVER_EXIT
#TYPE_TOUCH_EXPLORATION_GESTURE_START
#TYPE_TOUCH_EXPLORATION_GESTURE_END
#TYPE_WINDOW_CONTENT_CHANGED
#TYPE_VIEW_SCROLLED
#TYPE_VIEW_TEXT_SELECTION_CHANGED
#TYPE_ANNOUNCEMENT
#TYPE_VIEW_ACCESSIBILITY_FOCUSED
#TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
#TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
#TYPE_GESTURE_DETECTION_START
#TYPE_GESTURE_DETECTION_END
#TYPE_TOUCH_INTERACTION_START
#TYPE_TOUCH_INTERACTION_END
#TYPE_WINDOWS_CHANGED
#TYPE_VIEW_CONTEXT_CLICKED
#TYPE_ASSIST_READING_CONTEXT
#TYPE_SPEECH_STATE_CHANGE
#TYPE_VIEW_TARGETED_BY_SCROLL
TYPE_ANNOUNCEMENT
static val TYPE_ANNOUNCEMENT: Int
Represents the event of an application making an announcement.
In general, follow the practices described in View#announceForAccessibility(CharSequence)
.
Value: 16384
TYPE_ASSIST_READING_CONTEXT
static val TYPE_ASSIST_READING_CONTEXT: Int
Represents the event of the assistant currently reading the users screen context.
Value: 16777216
TYPE_GESTURE_DETECTION_END
static val TYPE_GESTURE_DETECTION_END: Int
Represents the event of ending gesture detection.
Value: 524288
TYPE_GESTURE_DETECTION_START
static val TYPE_GESTURE_DETECTION_START: Int
Represents the event of beginning gesture detection.
Value: 262144
TYPE_NOTIFICATION_STATE_CHANGED
static val TYPE_NOTIFICATION_STATE_CHANGED: Int
Represents the event showing a android.app.Notification
.
Value: 64
TYPE_SPEECH_STATE_CHANGE
static val TYPE_SPEECH_STATE_CHANGE: Int
Represents a change in the speech state defined by the speech state change types. A change in the speech state occurs when an application wants to signal that it is either speaking or listening for human speech. This event helps avoid conflicts where two applications want to speak or one listens when another speaks. When sending this event, the sender should ensure that the accompanying state change types make sense. For example, the sender should not send SPEECH_STATE_SPEAKING_START
and SPEECH_STATE_SPEAKING_END
together.
Value: 33554432
TYPE_TOUCH_EXPLORATION_GESTURE_END
static val TYPE_TOUCH_EXPLORATION_GESTURE_END: Int
Represents the event of ending a touch exploration gesture.
Value: 1024
TYPE_TOUCH_EXPLORATION_GESTURE_START
static val TYPE_TOUCH_EXPLORATION_GESTURE_START: Int
Represents the event of starting a touch exploration gesture.
Value: 512
TYPE_TOUCH_INTERACTION_END
static val TYPE_TOUCH_INTERACTION_END: Int
Represents the event of the user ending to touch the screen.
Value: 2097152
TYPE_TOUCH_INTERACTION_START
static val TYPE_TOUCH_INTERACTION_START: Int
Represents the event of the user starting to touch the screen.
Value: 1048576
TYPE_VIEW_ACCESSIBILITY_FOCUSED
static val TYPE_VIEW_ACCESSIBILITY_FOCUSED: Int
Represents the event of gaining accessibility focus.
Value: 32768
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
static val TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: Int
Represents the event of clearing accessibility focus.
Value: 65536
TYPE_VIEW_CLICKED
static val TYPE_VIEW_CLICKED: Int
Represents the event of clicking on a android.view.View
like android.widget.Button
, android.widget.CompoundButton
, etc.
See AccessibilityNodeInfo.AccessibilityAction#ACTION_CLICK
for more details.
Value: 1
TYPE_VIEW_CONTEXT_CLICKED
static val TYPE_VIEW_CONTEXT_CLICKED: Int
Represents the event of a context click on a android.view.View
.
See AccessibilityNodeInfo.AccessibilityAction#ACTION_CONTEXT_CLICK
for more details.
Value: 8388608
TYPE_VIEW_FOCUSED
static val TYPE_VIEW_FOCUSED: Int
Represents the event of setting input focus of a android.view.View
.
Value: 8
TYPE_VIEW_HOVER_ENTER
static val TYPE_VIEW_HOVER_ENTER: Int
Represents the event of a hover enter over a android.view.View
.
Value: 128
TYPE_VIEW_HOVER_EXIT
static val TYPE_VIEW_HOVER_EXIT: Int
Represents the event of a hover exit over a android.view.View
.
Value: 256
TYPE_VIEW_LONG_CLICKED
static val TYPE_VIEW_LONG_CLICKED: Int
Represents the event of long clicking on a android.view.View
like android.widget.Button
, android.widget.CompoundButton
, etc.
See AccessibilityNodeInfo.AccessibilityAction#ACTION_LONG_CLICK
for more details.
Value: 2
TYPE_VIEW_SCROLLED
static val TYPE_VIEW_SCROLLED: Int
Represents the event of scrolling a view. This event type is generally not sent directly. In the View system, this is sent in android.view.View#onScrollChanged(int, int, int, int)
In addition to the source and package name, the event should populate scroll-specific properties like setScrollDeltaX(int)
, setScrollDeltaY(int)
, setMaxScrollX(int)
, and setMaxScrollY(int)
.
Services are encouraged to rely on the source to query UI state over AccessibilityEvents properties. For example, to check after a scroll if the bottom of the scrolling UI element has been reached, check if the source node is scrollable and has the AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_BACKWARD
action but not the AccessibilityNodeInfo.AccessibilityAction#ACTION_SCROLL_FORWARD
action. For scrolling to a target, use TYPE_VIEW_TARGETED_BY_SCROLL
.
Value: 4096
TYPE_VIEW_SELECTED
static val TYPE_VIEW_SELECTED: Int
Represents the event of selecting an item usually in the context of an android.widget.AdapterView
.
Value: 4
TYPE_VIEW_TARGETED_BY_SCROLL
static val TYPE_VIEW_TARGETED_BY_SCROLL: Int
Represents the event of a scroll having completed and brought the target node on screen.
Value: 67108864
TYPE_VIEW_TEXT_CHANGED
static val TYPE_VIEW_TEXT_CHANGED: Int
Represents the event of changing the text of an android.widget.EditText
.
Value: 16
TYPE_VIEW_TEXT_SELECTION_CHANGED
static val TYPE_VIEW_TEXT_SELECTION_CHANGED: Int
Represents the event of changing the selection in an android.widget.EditText
.
Value: 8192
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
static val TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: Int
Represents the event of traversing the text of a view at a given movement granularity.
Value: 131072
TYPE_WINDOWS_CHANGED
static val TYPE_WINDOWS_CHANGED: Int
Represents the event change in the system windows shown on the screen. This event type should only be dispatched by the system.
Value: 4194304
TYPE_WINDOW_CONTENT_CHANGED
static val TYPE_WINDOW_CONTENT_CHANGED: Int
Represents the event of changing the content of a window and more specifically the sub-tree rooted at the event's source.
Value: 2048
TYPE_WINDOW_STATE_CHANGED
static val TYPE_WINDOW_STATE_CHANGED: Int
Represents the event of a change to a visually distinct section of the user interface.
These events should only be dispatched from android.view.View
s that have accessibility pane titles, and replaces TYPE_WINDOW_CONTENT_CHANGED
for those sources. Details about the change are available from getContentChangeTypes()
.
Do not use this to get an accessibility service to make non-pane announcements. Instead, follow the practices described in View#announceForAccessibility(CharSequence)
. Note: this does not suggest calling announceForAccessibility(), but using the suggestions listed in its documentation.
Value: 32
WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED
static val WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's AccessibilityWindowInfo#isAccessibilityFocused()
changed.
Value: 128
WINDOWS_CHANGE_ACTIVE
static val WINDOWS_CHANGE_ACTIVE: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's AccessibilityWindowInfo#isActive()
changed.
Value: 32
WINDOWS_CHANGE_ADDED
static val WINDOWS_CHANGE_ADDED: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window was added.
Value: 1
WINDOWS_CHANGE_BOUNDS
static val WINDOWS_CHANGE_BOUNDS: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's bounds changed.
Starting in R
, this event implies the window's region changed. It's also possible that region changed but bounds doesn't.
Value: 8
WINDOWS_CHANGE_CHILDREN
static val WINDOWS_CHANGE_CHILDREN: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's children changed.
Value: 512
WINDOWS_CHANGE_FOCUSED
static val WINDOWS_CHANGE_FOCUSED: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's AccessibilityWindowInfo#isFocused()
changed.
Value: 64
WINDOWS_CHANGE_LAYER
static val WINDOWS_CHANGE_LAYER: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's layer changed.
Value: 16
WINDOWS_CHANGE_PARENT
static val WINDOWS_CHANGE_PARENT: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's parent changed.
Value: 256
WINDOWS_CHANGE_PIP
static val WINDOWS_CHANGE_PIP: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window either entered or exited picture-in-picture mode.
Value: 1024
WINDOWS_CHANGE_REMOVED
static val WINDOWS_CHANGE_REMOVED: Int
Change type for TYPE_WINDOWS_CHANGED
event: A window was removed.
Value: 2
WINDOWS_CHANGE_TITLE
static val WINDOWS_CHANGE_TITLE: Int
Change type for TYPE_WINDOWS_CHANGED
event: The window's title changed.
Value: 4
Public constructors
AccessibilityEvent
AccessibilityEvent(eventType: Int)
Creates a new AccessibilityEvent
with the given eventType
.
Parameters | |
---|---|
eventType |
Int: The event type. |
AccessibilityEvent
AccessibilityEvent(event: AccessibilityEvent)
Copy constructor. Creates a new AccessibilityEvent
, and this instance is initialized from the given event
.
Parameters | |
---|---|
event |
AccessibilityEvent: The other event. This value cannot be null . |
Public methods
appendRecord
fun appendRecord(record: AccessibilityRecord!): Unit
Appends an AccessibilityRecord
to the end of event records.
Parameters | |
---|---|
record |
AccessibilityRecord!: The record to append. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
describeContents
fun describeContents(): Int
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int)
, the return value of this method must include the CONTENTS_FILE_DESCRIPTOR
bit.
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
eventTypeToString
static fun eventTypeToString(eventType: Int): String!
Returns the string representation of an event type. For example, TYPE_VIEW_CLICKED
is represented by the string TYPE_VIEW_CLICKED.
Parameters | |
---|---|
eventType |
Int: The event type |
Return | |
---|---|
String! |
The string representation. |
getAction
fun getAction(): Int
Gets the performed action that triggered this event.
Return | |
---|---|
Int |
The action. |
getContentChangeTypes
fun getContentChangeTypes(): Int
Gets the bit mask of change types signaled by a TYPE_WINDOW_CONTENT_CHANGED
event or TYPE_WINDOW_STATE_CHANGED
. A single event may represent multiple change types.
getEventTime
fun getEventTime(): Long
Gets the time in which this event was sent.
Return | |
---|---|
Long |
The event time. |
getEventType
fun getEventType(): Int
Gets the event type.
getMovementGranularity
fun getMovementGranularity(): Int
Gets the movement granularity that was traversed.
Return | |
---|---|
Int |
The granularity. |
getPackageName
fun getPackageName(): CharSequence!
Gets the package name of the source.
Return | |
---|---|
CharSequence! |
The package name. |
getRecord
fun getRecord(index: Int): AccessibilityRecord!
Gets the record at a given index.
Parameters | |
---|---|
index |
Int: The index. |
Return | |
---|---|
AccessibilityRecord! |
The record at the specified index. |
getRecordCount
fun getRecordCount(): Int
Gets the number of records contained in the event.
Return | |
---|---|
Int |
The number of records. |
getSpeechStateChangeTypes
fun getSpeechStateChangeTypes(): Int
Gets the bit mask of the speech state signaled by a TYPE_SPEECH_STATE_CHANGE
event.
Return | |
---|---|
Int |
The bit mask of speech change types. |
getWindowChanges
fun getWindowChanges(): Int
Get the bit mask of change types signaled by a TYPE_WINDOWS_CHANGED
event. A single event may represent multiple change types.
initFromParcel
fun initFromParcel(parcel: Parcel!): Unit
Creates a new instance from a Parcel
.
Parameters | |
---|---|
parcel |
Parcel!: A parcel containing the state of a AccessibilityEvent . |
isAccessibilityDataSensitive
fun isAccessibilityDataSensitive(): Boolean
Whether the event should only be delivered to an android.accessibilityservice.AccessibilityService
with the android.accessibilityservice.AccessibilityServiceInfo#isAccessibilityTool
property set to true.
Initial value matches the android.view.View#isAccessibilityDataSensitive
property from the event's source node, if present, or false by default.
Return | |
---|---|
Boolean |
True if the event should be delivered only to isAccessibilityTool services, false otherwise. |
See Also
obtain
static funobtain(eventType: Int): AccessibilityEvent!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityEvent()
instead.
Instantiates a new AccessibilityEvent instance with its type property set.
Parameters | |
---|---|
eventType |
Int: The event type. |
Return | |
---|---|
AccessibilityEvent! |
An instance. |
obtain
static funobtain(event: AccessibilityEvent!): AccessibilityEvent!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityEvent()
instead.
Instantiates a new AccessibilityEvent instance. The returned instance is initialized from the given event
.
Parameters | |
---|---|
event |
AccessibilityEvent!: The other event. |
Return | |
---|---|
AccessibilityEvent! |
An instance. |
obtain
static funobtain(): AccessibilityEvent!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityEvent()
instead.
Instantiates a new AccessibilityEvent instance.
Return | |
---|---|
AccessibilityEvent! |
An instance. |
recycle
funrecycle(): Unit
Deprecated: Object pooling has been discontinued. Calling this function now will have no effect.
Previously would recycle an instance back to be reused.
setAccessibilityDataSensitive
fun setAccessibilityDataSensitive(accessibilityDataSensitive: Boolean): Unit
Sets whether the event should only be delivered to an android.accessibilityservice.AccessibilityService
with the android.accessibilityservice.AccessibilityServiceInfo#isAccessibilityTool
property set to true.
This will be set automatically based on the event's source (if present). If creating and sending an event directly through AccessibilityManager
(where an event may have no source) then this method must be called explicitly if you want non-default behavior.
Parameters | |
---|---|
accessibilityDataSensitive |
Boolean: True if the event should be delivered only to isAccessibilityTool services, false otherwise. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setAction
fun setAction(action: Int): Unit
Sets the performed action that triggered this event.
Valid actions are defined in AccessibilityNodeInfo
:
AccessibilityNodeInfo#ACTION_ACCESSIBILITY_FOCUS
AccessibilityNodeInfo#ACTION_CLEAR_ACCESSIBILITY_FOCUS
AccessibilityNodeInfo#ACTION_CLEAR_FOCUS
AccessibilityNodeInfo#ACTION_CLEAR_SELECTION
AccessibilityNodeInfo#ACTION_CLICK
AccessibilityNodeInfo#ACTION_LONG_CLICK
AccessibilityNodeInfo#ACTION_NEXT_AT_MOVEMENT_GRANULARITY
AccessibilityNodeInfo#ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
AccessibilityNodeInfo#ACTION_NEXT_HTML_ELEMENT
AccessibilityNodeInfo#ACTION_PREVIOUS_HTML_ELEMENT
AccessibilityNodeInfo#ACTION_SCROLL_FORWARD
AccessibilityNodeInfo#ACTION_SCROLL_BACKWARD
AccessibilityNodeInfo#ACTION_COPY
AccessibilityNodeInfo#ACTION_PASTE
AccessibilityNodeInfo#ACTION_CUT
AccessibilityNodeInfo#ACTION_SET_SELECTION
AccessibilityNodeInfo#ACTION_EXPAND
AccessibilityNodeInfo#ACTION_COLLAPSE
AccessibilityNodeInfo#ACTION_DISMISS
AccessibilityNodeInfo#ACTION_SET_TEXT
- etc.
Parameters | |
---|---|
action |
Int: The action. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setContentChangeTypes
fun setContentChangeTypes(changeTypes: Int): Unit
Sets the bit mask of node tree changes signaled by an TYPE_WINDOW_CONTENT_CHANGED
event.
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
See Also
setEventTime
fun setEventTime(eventTime: Long): Unit
Sets the time in which this event was sent.
Parameters | |
---|---|
eventTime |
Long: The event time. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setEventType
fun setEventType(eventType: Int): Unit
Sets the event type. Note: An event must represent a single event type.
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setMovementGranularity
fun setMovementGranularity(granularity: Int): Unit
Sets the movement granularity that was traversed.
Parameters | |
---|---|
granularity |
Int: The granularity. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setPackageName
fun setPackageName(packageName: CharSequence!): Unit
Sets the package name of the source.
Parameters | |
---|---|
packageName |
CharSequence!: The package name. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setSpeechStateChangeTypes
fun setSpeechStateChangeTypes(state: Int): Unit
Sets the bit mask of the speech state change types signaled by a TYPE_SPEECH_STATE_CHANGE
event. The sender is responsible for ensuring that the state change types make sense. For example, the sender should not send SPEECH_STATE_SPEAKING_START
and SPEECH_STATE_SPEAKING_END
together.
toString
fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
parcel: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |