public class AccessibilityEventInfo extends Object
The information includes the accessibility event type, the operation that triggers the accessibility event, the package name of the event source, the movement step used for reading texts, and the accessibility event list.
When any change is made on the UI, for example, when a view control gains the focus, your app can send an
AccessibilityEventInfo#TYPE_VIEW_FOCUSED_EVENT accessibility event to the accessibility service to trigger
the accessibility function.
AccessibilitySystemAbilityClient.sendEvent(AccessibilityEventInfo)SystemCapability.Accessibility#ABILITY| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED_EVENT |
Describes an event of clearing accessibility focus.
|
static int |
TYPE_VIEW_ACCESSIBILITY_FOCUSED_EVENT |
Describes an event of gaining accessibility focus.
|
static int |
TYPE_VIEW_CLICKED_EVENT |
Describes an event of clicking a control, for example, clicking a button.
|
static int |
TYPE_VIEW_FOCUSED_EVENT |
Describes an event that a control has gained focus.
|
static int |
TYPE_VIEW_HOVER_ENTER_EVENT |
Describes an event that the hover enters a control.
|
static int |
TYPE_VIEW_HOVER_EXIT_EVENT |
Describes an event that the hover leaves a control.
|
static int |
TYPE_VIEW_LONG_CLICKED_EVENT |
Describes an event of pressing and holding a control.
|
static int |
TYPE_VIEW_SCROLLED_EVENT |
Describes an event of scrolling a view.
|
static int |
TYPE_VIEW_SELECTED_EVENT |
Describes an event of selecting a control.
|
static int |
TYPE_VIEW_TEXT_CHANGED_EVENT |
Describes an event that the text of a control has changed.
|
static int |
TYPE_VIEW_TEXT_SELECTION_CHANGED_EVENT |
Describes an event that the selected text has changed.
|
static int |
WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED |
Describes a window change event that the selected accessibility window has changed.
|
static int |
WINDOWS_CHANGE_ACTIVE |
Describes a window change event that the window becomes active or not.
|
static int |
WINDOWS_CHANGE_ADDED |
Describes a window change event that a window is added.
|
static int |
WINDOWS_CHANGE_BOUNDS |
Describes a window change event that the window bounds have changed.
|
static int |
WINDOWS_CHANGE_CHILDREN |
Describes a window change event that a child window has changed.
|
static int |
WINDOWS_CHANGE_FOCUSED |
Describes a window change event that the selected window has changed.
|
static int |
WINDOWS_CHANGE_LAYER |
Describes a window change event that the window layer has changed.
|
static int |
WINDOWS_CHANGE_PARENT |
Describes a window change event that the parent window has changed.
|
static int |
WINDOWS_CHANGE_PIP |
Describes a window change event that the window enters or exits the picture-in-picture (PIP) mode.
|
static int |
WINDOWS_CHANGE_REMOVED |
Describes a window change event that a window is deleted.
|
static int |
WINDOWS_CHANGE_TITLE |
Describes a window change event that the window title has changed.
|
| 构造器 | 说明 |
|---|---|
AccessibilityEventInfo() |
A constructor used to create an
AccessibilityEventInfo instance. |
AccessibilityEventInfo(int eventType) |
A constructor used to create an
AccessibilityEventInfo instance with a specified event type like
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED_EVENT,TYPE_VIEW_CLICKED_EVENT and
TYPE_VIEW_ACCESSIBILITY_FOCUSED_EVENT. |
AccessibilityEventInfo(AccessibilityEventInfo eventInfo) |
A constructor used to create an
AccessibilityEventInfo instance by copying the specified accessibility
event information. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addContent(CharSequence in) |
Adds an element to the content list.
|
void |
addRecord(AccessibilityEventInfo eventInfo) |
Adds an accessibility event to the event list.
|
int |
getAccessibilityEventType() |
Obtains the type of an accessibility event.
|
CharSequence |
getBundleName() |
Obtains the bundle name of the event source, that is, the bundle name of the target application.
|
CharSequence |
getClassName() |
Obtains the class name.
|
ArrayList<CharSequence> |
getContentList() |
Obtains the content list in the event.
|
int |
getCount() |
Obtains the number of accessibility events.
|
CharSequence |
getDescription() |
Obtains the accessibility event description.
|
int |
getEndIndex() |
Obtains the end index of listed items on the screen.
|
CharSequence |
getLastContent() |
Obtains the last content of the component.
|
int |
getPresentIndex() |
Obtains the index of the current event.
|
ArrayList<AccessibilityEventInfo> |
getRecords() |
Obtains the accessibility event list.
|
int |
getStartIndex() |
Obtains the start index of listed items on the screen.
|
int |
getTextMoveStep() |
Obtains the movement step used for reading texts.
|
int |
getTriggerAction() |
Obtains the action that triggers the accessibility event, for example, clicking or focusing a view.
|
int |
getViewId() |
Obtains the view ID associated with the accessibility event.
|
int |
getWindowChangeTypes() |
Obtains the type of the window change event, which can be content change or status change.
|
void |
setAccessibilityEventType(int accessibilityEventType) |
Sets the type of an accessibility event.
|
void |
setBundleName(CharSequence bundleName) |
Sets the bundle name of the event source.
|
void |
setClassName(CharSequence className) |
Sets the class name.
|
void |
setCount(int count) |
Sets the number of accessibility events.
|
void |
setDescription(CharSequence description) |
Sets the accessibility event description.
|
void |
setEndIndex(int endIndex) |
Sets the end index of listed items on the screen.
|
void |
setLastContent(CharSequence lastContent) |
Sets the last content of the component.
|
void |
setPresentIndex(int presentIndex) |
Sets the index of the current event.
|
void |
setStartIndex(int startIndex) |
Sets the start index of listed items on the screen.
|
void |
setTextMoveStep(int moveStep) |
Sets the movement step used for reading texts.
|
void |
setTriggerAction(int action) |
Sets the action that triggers the accessibility event.
|
void |
setViewId(int viewId) |
Sets the view ID associated with the accessibility event.
|
void |
setWindowChangeTypes(int changeTypes) |
Sets the type of a window change event, which can be content change or status change.
|
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED_EVENT
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED_EVENT
public static final int TYPE_VIEW_CLICKED_EVENT
public static final int TYPE_VIEW_FOCUSED_EVENT
public static final int TYPE_VIEW_HOVER_ENTER_EVENT
public static final int TYPE_VIEW_HOVER_EXIT_EVENT
public static final int TYPE_VIEW_LONG_CLICKED_EVENT
public static final int TYPE_VIEW_SCROLLED_EVENT
public static final int TYPE_VIEW_SELECTED_EVENT
public static final int TYPE_VIEW_TEXT_CHANGED_EVENT
public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED_EVENT
public static final int WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED
public static final int WINDOWS_CHANGE_ACTIVE
public static final int WINDOWS_CHANGE_ADDED
public static final int WINDOWS_CHANGE_BOUNDS
public static final int WINDOWS_CHANGE_CHILDREN
public static final int WINDOWS_CHANGE_FOCUSED
public static final int WINDOWS_CHANGE_LAYER
public static final int WINDOWS_CHANGE_PARENT
public static final int WINDOWS_CHANGE_PIP
public static final int WINDOWS_CHANGE_REMOVED
public static final int WINDOWS_CHANGE_TITLE
public AccessibilityEventInfo()
AccessibilityEventInfo instance.public AccessibilityEventInfo(int eventType)
AccessibilityEventInfo instance with a specified event type like
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED_EVENT,TYPE_VIEW_CLICKED_EVENT and
TYPE_VIEW_ACCESSIBILITY_FOCUSED_EVENT.eventType - Indicates the type of the accessibility event.public AccessibilityEventInfo(AccessibilityEventInfo eventInfo)
AccessibilityEventInfo instance by copying the specified accessibility
event information.eventInfo - Indicates the accessibility event information.public int getTriggerAction()
public int getWindowChangeTypes()
public int getAccessibilityEventType()
public int getTextMoveStep()
public CharSequence getBundleName()
public int getViewId()
public void addRecord(AccessibilityEventInfo eventInfo)
eventInfo - Indicates the accessibility event to be added.public ArrayList<AccessibilityEventInfo> getRecords()
public void setTriggerAction(int action)
action - Indicates the action that triggers the accessibility event.public void setTextMoveStep(int moveStep)
moveStep - Indicates the movement step, for example, moving to the next character, word, or line.public void setBundleName(CharSequence bundleName)
bundleName - Indicates the bundle name of the event source.public void setAccessibilityEventType(int accessibilityEventType)
accessibilityEventType - Indicates the type of the accessibility event.TYPE_VIEW_ACCESSIBILITY_FOCUSED_EVENT,
TYPE_VIEW_CLICKED_EVENT,
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED_EVENT,
TYPE_VIEW_FOCUSED_EVENT,
TYPE_VIEW_HOVER_ENTER_EVENT,
TYPE_VIEW_HOVER_EXIT_EVENT,
TYPE_VIEW_LONG_CLICKED_EVENT,
TYPE_VIEW_SCROLLED_EVENT,
TYPE_VIEW_SELECTED_EVENT,
TYPE_VIEW_TEXT_CHANGED_EVENT,
TYPE_VIEW_TEXT_SELECTION_CHANGED_EVENTpublic void setWindowChangeTypes(int changeTypes)
changeTypes - Indicates the type of the window change event.WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED,
WINDOWS_CHANGE_ACTIVE,
WINDOWS_CHANGE_ADDED,
WINDOWS_CHANGE_BOUNDS,
WINDOWS_CHANGE_CHILDREN,
WINDOWS_CHANGE_FOCUSED,
WINDOWS_CHANGE_LAYER,
WINDOWS_CHANGE_PARENT,
WINDOWS_CHANGE_PIP,
WINDOWS_CHANGE_REMOVED,
WINDOWS_CHANGE_TITLEpublic void setViewId(int viewId)
viewId - Indicates the view ID.public CharSequence getClassName()
public void setClassName(CharSequence className)
className - Indicates the class name to set.public CharSequence getDescription()
public void setDescription(CharSequence description)
description - Indicates the description to set.public int getCount()
public void setCount(int count)
count - Indicates the number of accessibility events to set.public int getPresentIndex()
public void setPresentIndex(int presentIndex)
presentIndex - Indicates the event index to set.public int getStartIndex()
public void setStartIndex(int startIndex)
startIndex - Indicates the start index to set.public int getEndIndex()
public void setEndIndex(int endIndex)
endIndex - Indicates the end index to set.public CharSequence getLastContent()
public void setLastContent(CharSequence lastContent)
lastContent - Indicates the last content to set for the component.public ArrayList<CharSequence> getContentList()
public void addContent(CharSequence in)
in - Indicates the element to add.