AccessibilityEvent
  public
  
  final
  
  class
  AccessibilityEvent
  
  
  
  
    extends AccessibilityRecord
  
  
  
  
  
      implements
      
        Parcelable
      
  
  
| java.lang.Object | ||
| ↳ | 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
 Button is clicked, a 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
 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 AccessibilityNodeInfos (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 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
 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:
Developer Guides
For more information about creating and processing AccessibilityEvents, read the Accessibility developer guide.
VIEW TYPES
 View clicked - represents the event of clicking on a View
 like Button, CompoundButton, etc.
 Type:TYPE_VIEW_CLICKED
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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 View
 like Button, CompoundButton, etc 
 Type:TYPE_VIEW_LONG_CLICKED
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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 AdapterView.
 Type: TYPE_VIEW_SELECTED
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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
 View.
 Type: TYPE_VIEW_FOCUSED
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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
 EditText.
 Type: TYPE_VIEW_TEXT_CHANGED
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
- AccessibilityRecord.getText()- The new text of the source.
- AccessibilityRecord.getBeforeText()- The text of the source before the change.
- AccessibilityRecord.getFromIndex()- The text change start index.
- AccessibilityRecord.getAddedCount()- The number of added characters.
- AccessibilityRecord.getRemovedCount()- The number of removed characters.
 View text selection changed - represents the event of changing the text
 selection of an EditText.
 Type: TYPE_VIEW_TEXT_SELECTION_CHANGED 
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY 
 Properties:
 - getEventType()- The type of the event.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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.
- AccessibilityRecord.getText()- The text of the source's sub-tree.
- AccessibilityRecord.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.
- AccessibilityRecord.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.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
- AccessibilityRecord.getScrollDeltaX()- The difference in the horizontal position.
- AccessibilityRecord.getScrollDeltaY()- The difference in the vertical position.
- AccessibilityRecord.getMaxScrollX()()} - The max scroll offset of the source left edge
- AccessibilityRecord.getMaxScrollY()()} - 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
 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.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
- AccessibilityRecord.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.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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
 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
 AccessibilityService.getWindows() for the window whose ID
 matches AccessibilityRecord.getWindowId().
 
 NOTIFICATION TYPES
 Notification state changed - represents the event showing a transient piece of information
 to the user. This information may be a Notification or
 Toast.
 Type: TYPE_NOTIFICATION_STATE_CHANGED
 Properties:
 
- getEventType()- The type of the event.
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
- AccessibilityRecord.getParcelableData()- The posted- Notification, if applicable.
- AccessibilityRecord.getText()- Displayed text of the- Toast, if applicable, or may contain text from the- Notification, although- AccessibilityRecord.getParcelableData()is a richer set of data for- Notification.
EXPLORATION TYPES
 View hover enter - represents the event of beginning to hover
 over a 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.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
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.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.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.
- AccessibilityRecord.getSource()- The source info (for registered clients). This represents the node that is brought on screen as a result of the scroll.
- AccessibilityRecord.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.
- AccessibilityRecord.getSource()- The source info (for registered clients).
- AccessibilityRecord.getClassName()- The class name of the source.
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
- AccessibilityRecord.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 changes
- getPackageName()- The package name of the source.
- getEventTime()- The event time.
Summary
| Constants | |
|---|---|
| int | CONTENT_CHANGE_TYPE_CHECKEDChange type for  | 
| int | CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTIONChange type for  | 
| int | CONTENT_CHANGE_TYPE_CONTENT_INVALIDChange type for  | 
| int | CONTENT_CHANGE_TYPE_DRAG_CANCELLEDChange type for  | 
| int | CONTENT_CHANGE_TYPE_DRAG_DROPPEDChange type for  | 
| int | CONTENT_CHANGE_TYPE_DRAG_STARTEDChange type for  | 
| int | CONTENT_CHANGE_TYPE_ENABLEDChange type for  | 
| int | CONTENT_CHANGE_TYPE_ERRORChange type for  | 
| int | CONTENT_CHANGE_TYPE_EXPANDEDChange type for  | 
| int | CONTENT_CHANGE_TYPE_PANE_APPEAREDChange type for  | 
| int | CONTENT_CHANGE_TYPE_PANE_DISAPPEAREDChange type for  | 
| int | CONTENT_CHANGE_TYPE_PANE_TITLEChange type for  | 
| int | CONTENT_CHANGE_TYPE_SORT_DIRECTIONChange type for  | 
| int | CONTENT_CHANGE_TYPE_STATE_DESCRIPTIONChange type for  | 
| int | CONTENT_CHANGE_TYPE_SUBTREEChange type for  | 
| int | CONTENT_CHANGE_TYPE_SUPPLEMENTAL_DESCRIPTIONChange type for  | 
| int | CONTENT_CHANGE_TYPE_TEXTChange type for  | 
| int | CONTENT_CHANGE_TYPE_UNDEFINEDChange type for  | 
| int | INVALID_POSITIONInvalid selection/focus position. | 
| int | MAX_TEXT_LENGTHMaximum length of the text fields. | 
| int | SPEECH_STATE_LISTENING_ENDChange type for  | 
| int | SPEECH_STATE_LISTENING_STARTChange type for  | 
| int | SPEECH_STATE_SPEAKING_ENDChange type for  | 
| int | SPEECH_STATE_SPEAKING_STARTChange type for  | 
| int | TYPES_ALL_MASKMask for  | 
| int | TYPE_ANNOUNCEMENT
      This constant was deprecated
      in API level 36.
    Use one of the semantic alternative methods described in the documentation of
      | 
| int | TYPE_ASSIST_READING_CONTEXTRepresents the event of the assistant currently reading the users screen context. | 
| int | TYPE_GESTURE_DETECTION_ENDRepresents the event of ending gesture detection. | 
| int | TYPE_GESTURE_DETECTION_STARTRepresents the event of beginning gesture detection. | 
| int | TYPE_NOTIFICATION_STATE_CHANGEDRepresents the event showing a  | 
| int | TYPE_SPEECH_STATE_CHANGERepresents a change in the speech state defined by the speech state change types. | 
| int | TYPE_TOUCH_EXPLORATION_GESTURE_ENDRepresents the event of ending a touch exploration gesture. | 
| int | TYPE_TOUCH_EXPLORATION_GESTURE_STARTRepresents the event of starting a touch exploration gesture. | 
| int | TYPE_TOUCH_INTERACTION_ENDRepresents the event of the user ending to touch the screen. | 
| int | TYPE_TOUCH_INTERACTION_STARTRepresents the event of the user starting to touch the screen. | 
| int | TYPE_VIEW_ACCESSIBILITY_FOCUSEDRepresents the event of gaining accessibility focus. | 
| int | TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEAREDRepresents the event of clearing accessibility focus. | 
| int | TYPE_VIEW_CLICKEDRepresents the event of clicking on a  | 
| int | TYPE_VIEW_CONTEXT_CLICKEDRepresents the event of a context click on a  | 
| int | TYPE_VIEW_FOCUSEDRepresents the event of setting input focus of a  | 
| int | TYPE_VIEW_HOVER_ENTERRepresents the event of a hover enter over a  | 
| int | TYPE_VIEW_HOVER_EXITRepresents the event of a hover exit over a  | 
| int | TYPE_VIEW_LONG_CLICKEDRepresents the event of long clicking on a  | 
| int | TYPE_VIEW_SCROLLEDRepresents the event of scrolling a view. | 
| int | TYPE_VIEW_SELECTEDRepresents the event of selecting an item usually in the context of an
  | 
| int | TYPE_VIEW_TARGETED_BY_SCROLLRepresents the event of a scroll having completed and brought the target node on screen. | 
| int | TYPE_VIEW_TEXT_CHANGEDRepresents the event of changing the text of an  | 
| int | TYPE_VIEW_TEXT_SELECTION_CHANGEDRepresents the event of changing the selection in an  | 
| int | TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITYRepresents the event of traversing the text of a view at a given movement granularity. | 
| int | TYPE_WINDOWS_CHANGEDRepresents the event change in the system windows shown on the screen. | 
| int | TYPE_WINDOW_CONTENT_CHANGEDRepresents the event of changing the content of a window and more specifically the sub-tree rooted at the event's source. | 
| int | TYPE_WINDOW_STATE_CHANGEDRepresents the event of a change to a visually distinct section of the user interface. | 
| int | WINDOWS_CHANGE_ACCESSIBILITY_FOCUSEDChange type for  | 
| int | WINDOWS_CHANGE_ACTIVEChange type for  | 
| int | WINDOWS_CHANGE_ADDEDChange type for  | 
| int | WINDOWS_CHANGE_BOUNDSChange type for  | 
| int | WINDOWS_CHANGE_CHILDRENChange type for  | 
| int | WINDOWS_CHANGE_FOCUSEDChange type for  | 
| int | WINDOWS_CHANGE_LAYERChange type for  | 
| int | WINDOWS_CHANGE_PARENTChange type for  | 
| int | WINDOWS_CHANGE_PIPChange type for  | 
| int | WINDOWS_CHANGE_REMOVEDChange type for  | 
| int | WINDOWS_CHANGE_TITLEChange type for  | 
| Inherited constants | 
|---|
| Fields | |
|---|---|
| 
    public
    static
    final
    Creator<AccessibilityEvent> | CREATOR
 | 
| Public constructors | |
|---|---|
| 
      AccessibilityEvent()
      Creates a new  | |
| 
      AccessibilityEvent(AccessibilityEvent event)
      Copy constructor. | |
| 
      AccessibilityEvent(int eventType)
      Creates a new  | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      appendRecord(AccessibilityRecord record)
      Appends an  | 
| 
        
        
        
        
        
        int | 
      describeContents()
      Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | 
| 
        
        
        static
        
        
        String | 
      eventTypeToString(int eventType)
      Returns the string representation of an event type. | 
| 
        
        
        
        
        
        int | 
      getAction()
      Gets the performed action that triggered this event. | 
| 
        
        
        
        
        
        int | 
      getContentChangeTypes()
      Gets the bit mask of change types signaled by a
  | 
| 
        
        
        
        
        
        long | 
      getEventTime()
      Gets the time in which this event was sent. | 
| 
        
        
        
        
        
        int | 
      getEventType()
      Gets the event type. | 
| 
        
        
        
        
        
        int | 
      getMovementGranularity()
      Gets the movement granularity that was traversed. | 
| 
        
        
        
        
        
        CharSequence | 
      getPackageName()
      Gets the package name of the source. | 
| 
        
        
        
        
        
        AccessibilityRecord | 
      getRecord(int index)
      Gets the record at a given index. | 
| 
        
        
        
        
        
        int | 
      getRecordCount()
      Gets the number of records contained in the event. | 
| 
        
        
        
        
        
        int | 
      getSpeechStateChangeTypes()
      Gets the bit mask of the speech state signaled by a  | 
| 
        
        
        
        
        
        int | 
      getWindowChanges()
      Get the bit mask of change types signaled by a  | 
| 
        
        
        
        
        
        void | 
      initFromParcel(Parcel parcel)
      Creates a new instance from a  | 
| 
        
        
        
        
        
        boolean | 
      isAccessibilityDataSensitive()
      Whether the event should only be delivered to an
  | 
| 
        
        
        static
        
        
        AccessibilityEvent | 
      obtain(AccessibilityEvent event)
      
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor  | 
| 
        
        
        static
        
        
        AccessibilityEvent | 
      obtain()
      
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor  | 
| 
        
        
        static
        
        
        AccessibilityEvent | 
      obtain(int eventType)
      
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor  | 
| 
        
        
        
        
        
        void | 
      recycle()
      This method was deprecated in API level 33. Object pooling has been discontinued. Calling this function now will have no effect. | 
| 
        
        
        
        
        
        void | 
      setAccessibilityDataSensitive(boolean accessibilityDataSensitive)
      Sets whether the event should only be delivered to an
  | 
| 
        
        
        
        
        
        void | 
      setAction(int action)
      Sets the performed action that triggered this event. | 
| 
        
        
        
        
        
        void | 
      setContentChangeTypes(int changeTypes)
      Sets the bit mask of node tree changes signaled by an
  | 
| 
        
        
        
        
        
        void | 
      setEventTime(long eventTime)
      Sets the time in which this event was sent. | 
| 
        
        
        
        
        
        void | 
      setEventType(int eventType)
      Sets the event type. | 
| 
        
        
        
        
        
        void | 
      setMovementGranularity(int granularity)
      Sets the movement granularity that was traversed. | 
| 
        
        
        
        
        
        void | 
      setPackageName(CharSequence packageName)
      Sets the package name of the source. | 
| 
        
        
        
        
        
        void | 
      setSpeechStateChangeTypes(int state)
      Sets the bit mask of the speech state change types
 signaled by a  | 
| 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object. | 
| 
        
        
        
        
        
        void | 
      writeToParcel(Parcel parcel, int flags)
      Flatten this object in to a Parcel. | 
| Inherited methods | |
|---|---|
Constants
CONTENT_CHANGE_TYPE_CHECKED
public static final int CONTENT_CHANGE_TYPE_CHECKED
Change type for TYPE_WINDOW_CONTENT_CHANGED event:
 The source node changed its checked state, which is returned by
 AccessibilityNodeInfo.getChecked().
 The view changing its checked state should call
 AccessibilityNodeInfo.setChecked(int) and then send this event.
Constant Value: 8192 (0x00002000)
CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
public static final int CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
Change type for TYPE_WINDOW_CONTENT_CHANGED event:
 The node's content description changed.
Constant Value: 4 (0x00000004)
CONTENT_CHANGE_TYPE_CONTENT_INVALID
public static final int CONTENT_CHANGE_TYPE_CONTENT_INVALID
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.
Constant Value: 1024 (0x00000400)
CONTENT_CHANGE_TYPE_DRAG_CANCELLED
public static final int CONTENT_CHANGE_TYPE_DRAG_CANCELLED
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.
Constant Value: 512 (0x00000200)
CONTENT_CHANGE_TYPE_DRAG_DROPPED
public static final int CONTENT_CHANGE_TYPE_DRAG_DROPPED
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.
Constant Value: 256 (0x00000100)
CONTENT_CHANGE_TYPE_DRAG_STARTED
public static final int CONTENT_CHANGE_TYPE_DRAG_STARTED
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.
Constant Value: 128 (0x00000080)
CONTENT_CHANGE_TYPE_ENABLED
public static final int CONTENT_CHANGE_TYPE_ENABLED
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.
Constant Value: 4096 (0x00001000)
CONTENT_CHANGE_TYPE_ERROR
public static final int CONTENT_CHANGE_TYPE_ERROR
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.
Constant Value: 2048 (0x00000800)
CONTENT_CHANGE_TYPE_EXPANDED
public static final int CONTENT_CHANGE_TYPE_EXPANDED
Change type for TYPE_WINDOW_CONTENT_CHANGED event: The source node changed its
 expanded state which is returned by AccessibilityNodeInfo.getExpandedState(). The
 view changing the node's expanded state should call AccessibilityNodeInfo.setExpandedState(int) and then send this event.
Constant Value: 16384 (0x00004000)
CONTENT_CHANGE_TYPE_PANE_APPEARED
public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED
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.
Constant Value: 16 (0x00000010)
CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
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 AccessibilityRecord.getText() will return the value that would
 have been returned by getSource().getPaneTitle().
Constant Value: 32 (0x00000020)
CONTENT_CHANGE_TYPE_PANE_TITLE
public static final int CONTENT_CHANGE_TYPE_PANE_TITLE
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.
Constant Value: 8 (0x00000008)
CONTENT_CHANGE_TYPE_SORT_DIRECTION
public static final int CONTENT_CHANGE_TYPE_SORT_DIRECTION
Change type for TYPE_WINDOW_CONTENT_CHANGED event: The source node's collection
 item info changed its sort direction state for the data corresponding to this collection
 item, which is returned by
 AccessibilityNodeInfo.CollectionItemInfo.getSortDirection(). The view changing its
 collection item info's sort direction should set a
 AccessibilityNodeInfo.CollectionItemInfo created with
 AccessibilityNodeInfo.CollectionItemInfo.Builder.setSortDirection(int) and then send
 this event.
See also:
Constant Value: 65536 (0x00010000)
CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
public static final int CONTENT_CHANGE_TYPE_STATE_DESCRIPTION
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.
See also:
Constant Value: 64 (0x00000040)
CONTENT_CHANGE_TYPE_SUBTREE
public static final int CONTENT_CHANGE_TYPE_SUBTREE
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.
Constant Value: 1 (0x00000001)
CONTENT_CHANGE_TYPE_SUPPLEMENTAL_DESCRIPTION
public static final int CONTENT_CHANGE_TYPE_SUPPLEMENTAL_DESCRIPTION
Change type for TYPE_WINDOW_CONTENT_CHANGED event:
 The source node changed its supplemental description, which is returned by
 AccessibilityNodeInfo.getSupplementalDescription().
 The view changing its supplemental description should call
 AccessibilityNodeInfo.setSupplementalDescription(CharSequence) and
 then send this event.
See also:
Constant Value: 32768 (0x00008000)
CONTENT_CHANGE_TYPE_TEXT
public static final int CONTENT_CHANGE_TYPE_TEXT
Change type for TYPE_WINDOW_CONTENT_CHANGED event:
 The node's text changed.
Constant Value: 2 (0x00000002)
CONTENT_CHANGE_TYPE_UNDEFINED
public static final int CONTENT_CHANGE_TYPE_UNDEFINED
Change type for TYPE_WINDOW_CONTENT_CHANGED event: The type of change is not
 defined.
Constant Value: 0 (0x00000000)
INVALID_POSITION
public static final int INVALID_POSITION
Invalid selection/focus position.
Constant Value: -1 (0xffffffff)
MAX_TEXT_LENGTH
public static final int MAX_TEXT_LENGTH
Maximum length of the text fields.
See also:
Constant Value: 500 (0x000001f4)
SPEECH_STATE_LISTENING_END
public static final int SPEECH_STATE_LISTENING_END
Change type for TYPE_SPEECH_STATE_CHANGE event: another service is no longer
 listening to the microphone.
Constant Value: 8 (0x00000008)
SPEECH_STATE_LISTENING_START
public static final int SPEECH_STATE_LISTENING_START
Change type for TYPE_SPEECH_STATE_CHANGE event: another service is listening to the
 microphone.
Constant Value: 4 (0x00000004)
SPEECH_STATE_SPEAKING_END
public static final int SPEECH_STATE_SPEAKING_END
Change type for TYPE_SPEECH_STATE_CHANGE event: another service is no longer
 speaking.
Constant Value: 2 (0x00000002)
SPEECH_STATE_SPEAKING_START
public static final int SPEECH_STATE_SPEAKING_START
Change type for TYPE_SPEECH_STATE_CHANGE event: another service is speaking.
Constant Value: 1 (0x00000001)
TYPES_ALL_MASK
public static final int TYPES_ALL_MASK
Mask for AccessibilityEvent all types.
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
Constant Value: -1 (0xffffffff)
TYPE_ANNOUNCEMENT
public static final int TYPE_ANNOUNCEMENT
      This constant was deprecated
      in API level 36.
    Use one of the semantic alternative methods described in the documentation of
     View.announceForAccessibility(CharSequence) instead of using this event, as
     accessibility services may choose to ignore dispatch of this event type.
  
Represents the event of an application making an announcement.
Constant Value: 16384 (0x00004000)
TYPE_ASSIST_READING_CONTEXT
public static final int TYPE_ASSIST_READING_CONTEXT
Represents the event of the assistant currently reading the users screen context.
Constant Value: 16777216 (0x01000000)
TYPE_GESTURE_DETECTION_END
public static final int TYPE_GESTURE_DETECTION_END
Represents the event of ending gesture detection.
Constant Value: 524288 (0x00080000)
TYPE_GESTURE_DETECTION_START
public static final int TYPE_GESTURE_DETECTION_START
Represents the event of beginning gesture detection.
Constant Value: 262144 (0x00040000)
TYPE_NOTIFICATION_STATE_CHANGED
public static final int TYPE_NOTIFICATION_STATE_CHANGED
Represents the event showing a Notification.
Constant Value: 64 (0x00000040)
TYPE_SPEECH_STATE_CHANGE
public static final int TYPE_SPEECH_STATE_CHANGE
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.
See also:
Constant Value: 33554432 (0x02000000)
TYPE_TOUCH_EXPLORATION_GESTURE_END
public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END
Represents the event of ending a touch exploration gesture.
Constant Value: 1024 (0x00000400)
TYPE_TOUCH_EXPLORATION_GESTURE_START
public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START
Represents the event of starting a touch exploration gesture.
Constant Value: 512 (0x00000200)
TYPE_TOUCH_INTERACTION_END
public static final int TYPE_TOUCH_INTERACTION_END
Represents the event of the user ending to touch the screen.
Constant Value: 2097152 (0x00200000)
TYPE_TOUCH_INTERACTION_START
public static final int TYPE_TOUCH_INTERACTION_START
Represents the event of the user starting to touch the screen.
Constant Value: 1048576 (0x00100000)
TYPE_VIEW_ACCESSIBILITY_FOCUSED
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED
Represents the event of gaining accessibility focus.
Constant Value: 32768 (0x00008000)
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
Represents the event of clearing accessibility focus.
Constant Value: 65536 (0x00010000)
TYPE_VIEW_CLICKED
public static final int TYPE_VIEW_CLICKED
Represents the event of clicking on a View like
 Button, CompoundButton, etc.
 
See AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK for more
 details.
Constant Value: 1 (0x00000001)
TYPE_VIEW_CONTEXT_CLICKED
public static final int TYPE_VIEW_CONTEXT_CLICKED
Represents the event of a context click on a View.
 
See AccessibilityNodeInfo.AccessibilityAction.ACTION_CONTEXT_CLICK for more
 details.
Constant Value: 8388608 (0x00800000)
TYPE_VIEW_FOCUSED
public static final int TYPE_VIEW_FOCUSED
Represents the event of setting input focus of a View.
Constant Value: 8 (0x00000008)
TYPE_VIEW_HOVER_ENTER
public static final int TYPE_VIEW_HOVER_ENTER
Represents the event of a hover enter over a View.
Constant Value: 128 (0x00000080)
TYPE_VIEW_HOVER_EXIT
public static final int TYPE_VIEW_HOVER_EXIT
Represents the event of a hover exit over a View.
Constant Value: 256 (0x00000100)
TYPE_VIEW_LONG_CLICKED
public static final int TYPE_VIEW_LONG_CLICKED
Represents the event of long clicking on a View like
 Button, CompoundButton, etc.
 
See AccessibilityNodeInfo.AccessibilityAction.ACTION_LONG_CLICK for more
 details.
Constant Value: 2 (0x00000002)
TYPE_VIEW_SCROLLED
public static final int TYPE_VIEW_SCROLLED
Represents the event of scrolling a view. This event type is generally not sent directly. In
 the View system, this is sent in
 View.onScrollChanged(int, int, int, int)
 
In addition to the source and package name, the event should populate scroll-specific
 properties like AccessibilityRecord.setScrollDeltaX(int), AccessibilityRecord.setScrollDeltaY(int),
 AccessibilityRecord.setMaxScrollX(int), and AccessibilityRecord.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.
Constant Value: 4096 (0x00001000)
TYPE_VIEW_SELECTED
public static final int TYPE_VIEW_SELECTED
Represents the event of selecting an item usually in the context of an
 AdapterView.
Constant Value: 4 (0x00000004)
TYPE_VIEW_TARGETED_BY_SCROLL
public static final int TYPE_VIEW_TARGETED_BY_SCROLL
Represents the event of a scroll having completed and brought the target node on screen.
Constant Value: 67108864 (0x04000000)
TYPE_VIEW_TEXT_CHANGED
public static final int TYPE_VIEW_TEXT_CHANGED
Represents the event of changing the text of an EditText.
Constant Value: 16 (0x00000010)
TYPE_VIEW_TEXT_SELECTION_CHANGED
public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED
Represents the event of changing the selection in an EditText.
Constant Value: 8192 (0x00002000)
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
Represents the event of traversing the text of a view at a given movement granularity.
Constant Value: 131072 (0x00020000)
TYPE_WINDOWS_CHANGED
public static final int TYPE_WINDOWS_CHANGED
Represents the event change in the system windows shown on the screen. This event type should only be dispatched by the system.
Constant Value: 4194304 (0x00400000)
TYPE_WINDOW_CONTENT_CHANGED
public static final int TYPE_WINDOW_CONTENT_CHANGED
Represents the event of changing the content of a window and more specifically the sub-tree rooted at the event's source.
Constant Value: 2048 (0x00000800)
TYPE_WINDOW_STATE_CHANGED
public static final int TYPE_WINDOW_STATE_CHANGED
Represents the event of a change to a visually distinct section of the user interface.
 These events should only be dispatched from Views 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.
Constant Value: 32 (0x00000020)
WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED
public static final int WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED
Change type for TYPE_WINDOWS_CHANGED event:
 The window's AccessibilityWindowInfo.isAccessibilityFocused() changed.
Constant Value: 128 (0x00000080)
WINDOWS_CHANGE_ACTIVE
public static final int WINDOWS_CHANGE_ACTIVE
Change type for TYPE_WINDOWS_CHANGED event:
 The window's AccessibilityWindowInfo.isActive() changed.
Constant Value: 32 (0x00000020)
WINDOWS_CHANGE_ADDED
public static final int WINDOWS_CHANGE_ADDED
Change type for TYPE_WINDOWS_CHANGED event:
 The window was added.
Constant Value: 1 (0x00000001)
WINDOWS_CHANGE_BOUNDS
public static final int WINDOWS_CHANGE_BOUNDS
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.
 
Constant Value: 8 (0x00000008)
WINDOWS_CHANGE_CHILDREN
public static final int WINDOWS_CHANGE_CHILDREN
Change type for TYPE_WINDOWS_CHANGED event:
 The window's children changed.
Constant Value: 512 (0x00000200)
WINDOWS_CHANGE_FOCUSED
public static final int WINDOWS_CHANGE_FOCUSED
Change type for TYPE_WINDOWS_CHANGED event:
 The window's AccessibilityWindowInfo.isFocused() changed.
Constant Value: 64 (0x00000040)
WINDOWS_CHANGE_LAYER
public static final int WINDOWS_CHANGE_LAYER
Change type for TYPE_WINDOWS_CHANGED event:
 The window's layer changed.
Constant Value: 16 (0x00000010)
WINDOWS_CHANGE_PARENT
public static final int WINDOWS_CHANGE_PARENT
Change type for TYPE_WINDOWS_CHANGED event:
 The window's parent changed.
Constant Value: 256 (0x00000100)
WINDOWS_CHANGE_PIP
public static final int WINDOWS_CHANGE_PIP
Change type for TYPE_WINDOWS_CHANGED event:
 The window either entered or exited picture-in-picture mode.
Constant Value: 1024 (0x00000400)
WINDOWS_CHANGE_REMOVED
public static final int WINDOWS_CHANGE_REMOVED
Change type for TYPE_WINDOWS_CHANGED event:
 A window was removed.
Constant Value: 2 (0x00000002)
WINDOWS_CHANGE_TITLE
public static final int WINDOWS_CHANGE_TITLE
Change type for TYPE_WINDOWS_CHANGED event:
 The window's title changed.
Constant Value: 4 (0x00000004)
Fields
Public constructors
AccessibilityEvent
public AccessibilityEvent ()
Creates a new AccessibilityEvent.
AccessibilityEvent
public AccessibilityEvent (AccessibilityEvent event)
Copy constructor. Creates a new AccessibilityEvent, and this instance is initialized
 from the given event.
| Parameters | |
|---|---|
| event | AccessibilityEvent: The other event.
 This value cannot benull. | 
AccessibilityEvent
public AccessibilityEvent (int eventType)
Creates a new AccessibilityEvent with the given eventType.
| Parameters | |
|---|---|
| eventType | int: The event type. | 
Public methods
appendRecord
public void appendRecord (AccessibilityRecord record)
Appends an AccessibilityRecord to the end of event records.
| Parameters | |
|---|---|
| record | AccessibilityRecord: The record to append. | 
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
describeContents
public int describeContents ()
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.
| Returns | |
|---|---|
| int | a bitmask indicating the set of special object types marshaled
 by this Parcelable object instance.
 Value is either 0orCONTENTS_FILE_DESCRIPTOR | 
eventTypeToString
public static String eventTypeToString (int eventType)
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 | 
| Returns | |
|---|---|
| String | The string representation. | 
getAction
public int getAction ()
Gets the performed action that triggered this event.
| Returns | |
|---|---|
| int | The action. | 
getContentChangeTypes
public int getContentChangeTypes ()
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
public long getEventTime ()
Gets the time in which this event was sent.
| Returns | |
|---|---|
| long | The event time. | 
getEventType
public int getEventType ()
Gets the event type.
getMovementGranularity
public int getMovementGranularity ()
Gets the movement granularity that was traversed.
| Returns | |
|---|---|
| int | The granularity. | 
getPackageName
public CharSequence getPackageName ()
Gets the package name of the source.
| Returns | |
|---|---|
| CharSequence | The package name. | 
getRecord
public AccessibilityRecord getRecord (int index)
Gets the record at a given index.
| Parameters | |
|---|---|
| index | int: The index. | 
| Returns | |
|---|---|
| AccessibilityRecord | The record at the specified index. | 
getRecordCount
public int getRecordCount ()
Gets the number of records contained in the event.
| Returns | |
|---|---|
| int | The number of records. | 
getSpeechStateChangeTypes
public int getSpeechStateChangeTypes ()
Gets the bit mask of the speech state signaled by a TYPE_SPEECH_STATE_CHANGE event.
| Returns | |
|---|---|
| int | The bit mask of speech change types. | 
getWindowChanges
public int getWindowChanges ()
Get the bit mask of change types signaled by a TYPE_WINDOWS_CHANGED event. A
 single event may represent multiple change types.
| Returns | |
|---|---|
| int | The bit mask of change types.
 Value is either 0or a combination ofWINDOWS_CHANGE_ADDED,WINDOWS_CHANGE_REMOVED,WINDOWS_CHANGE_TITLE,WINDOWS_CHANGE_BOUNDS,WINDOWS_CHANGE_LAYER,WINDOWS_CHANGE_ACTIVE,WINDOWS_CHANGE_FOCUSED,WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED,WINDOWS_CHANGE_PARENT,WINDOWS_CHANGE_CHILDREN, andWINDOWS_CHANGE_PIP | 
initFromParcel
public void initFromParcel (Parcel parcel)
Creates a new instance from a Parcel.
| Parameters | |
|---|---|
| parcel | Parcel: A parcel containing the state of aAccessibilityEvent. | 
isAccessibilityDataSensitive
public boolean isAccessibilityDataSensitive ()
Whether the event should only be delivered to an
 AccessibilityService with the
 AccessibilityServiceInfo.isAccessibilityTool() property
 set to true.
 
 Initial value matches the View.isAccessibilityDataSensitive() property
 from the event's source node, if present, or false by default.
 
| Returns | |
|---|---|
| boolean | True if the event should be delivered only to isAccessibilityTool services, false otherwise. | 
See also:
obtain
public static AccessibilityEvent obtain (AccessibilityEvent event)
      This method was deprecated
      in API level 33.
    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. | 
| Returns | |
|---|---|
| AccessibilityEvent | An instance. | 
obtain
public static AccessibilityEvent obtain ()
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Create a new instance using the
 constructor AccessibilityEvent() instead.
  
Instantiates a new AccessibilityEvent instance.
| Returns | |
|---|---|
| AccessibilityEvent | An instance. | 
obtain
public static AccessibilityEvent obtain (int eventType)
      This method was deprecated
      in API level 33.
    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. | 
| Returns | |
|---|---|
| AccessibilityEvent | An instance. | 
recycle
public void recycle ()
      This method was deprecated
      in API level 33.
    Object pooling has been discontinued. Calling this function now will have
 no effect.
  
Previously would recycle an instance back to be reused.
setAccessibilityDataSensitive
public void setAccessibilityDataSensitive (boolean accessibilityDataSensitive)
Sets whether the event should only be delivered to an
 AccessibilityService with the
 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. | 
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
setAction
public void setAction (int action)
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. | 
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
See also:
setContentChangeTypes
public void setContentChangeTypes (int changeTypes)
Sets the bit mask of node tree changes signaled by an
 TYPE_WINDOW_CONTENT_CHANGED event.
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
See also:
setEventTime
public void setEventTime (long eventTime)
Sets the time in which this event was sent.
| Parameters | |
|---|---|
| eventTime | long: The event time. | 
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
setEventType
public void setEventType (int eventType)
Sets the event type. Note: An event must represent a single event type.
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
setMovementGranularity
public void setMovementGranularity (int granularity)
Sets the movement granularity that was traversed.
| Parameters | |
|---|---|
| granularity | int: The granularity. | 
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
setPackageName
public void setPackageName (CharSequence packageName)
Sets the package name of the source.
| Parameters | |
|---|---|
| packageName | CharSequence: The package name. | 
| Throws | |
|---|---|
| IllegalStateException | If called from an AccessibilityService. | 
setSpeechStateChangeTypes
public void setSpeechStateChangeTypes (int state)
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.
| Parameters | |
|---|---|
| state | int: Value is either0or a combination ofSPEECH_STATE_SPEAKING_START,SPEECH_STATE_SPEAKING_END,SPEECH_STATE_LISTENING_START, andSPEECH_STATE_LISTENING_END | 
toString
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
| String | a string representation of the object. | 
writeToParcel
public void writeToParcel (Parcel parcel, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
| parcel | Parcel: The Parcel in which the object should be written.
 This value cannot benull. | 
| flags | int: Additional flags about how the object should be written.
 May be 0 orParcelable.PARCELABLE_WRITE_RETURN_VALUE.
 Value is either0or a combination ofParcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES | 
