AccessibilityServiceInfo api文档

https://developer.android.com/reference/android/accessibilityservice/AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS

AccessibilityServiceInfo

Kotlin |Java

public class AccessibilityServiceInfo
extends Object implements Parcelable

java.lang.Object
   ↳android.accessibilityservice.AccessibilityServiceInfo


This class describes an AccessibilityService. The system notifies an AccessibilityService for AccessibilityEvents according to the information encapsulated in this class.

Developer Guides

For more information about creating AccessibilityServices, read the Accessibility developer guide.

See also:

Summary

XML attributes

android:accessibilityEventTypesThe event types this service would like to receive as specified in AccessibilityEvent
android:accessibilityFeedbackTypeThe feedback types this service provides as specified in AccessibilityServiceInfo
android:accessibilityFlagsAdditional flags as specified in AccessibilityServiceInfo
android:canRequestEnhancedWebAccessibilityAttribute whether the accessibility service wants to be able to request enhanced web accessibility enhancements. 
android:canRequestFilterKeyEventsAttribute whether the accessibility service wants to be able to request to filter key events. 
android:canRequestTouchExplorationModeAttribute whether the accessibility service wants to be able to request touch exploration mode in which touched items are spoken aloud and the UI can be explored via gestures. 
android:canRetrieveWindowContentAttribute whether the accessibility service wants to be able to retrieve the active window content. 
android:canTakeScreenshotAttribute whether the accessibility service wants to be able to take screenshot. 
android:descriptionDescription of the accessibility service usage, availability, or limitations (e.g. 
android:interactiveUiTimeoutA recommended timeout in milliseconds used in android.view.accessibility.AccessibilityManager.getRecommendedTimeoutMillis(int, int) to return a suitable value for interactive controls. 
android:introDetailed intro of the accessibility service purpose or behavior. 
android:nonInteractiveUiTimeoutA recommended timeout in milliseconds used in android.view.accessibility.AccessibilityManager.getRecommendedTimeoutMillis(int, int) to return a suitable value for UIs that do not include interactive controls. 
android:notificationTimeoutThe minimal period in milliseconds between two accessibility events of the same type are sent to this service. 
android:packageNamesComma separated package names from which this service would like to receive events (leave out for all packages). 
android:settingsActivityFully qualified class name of an activity that allows the user to modify the settings for this service. 
android:summaryBrief summary of the accessibility service purpose or behavior. 
android:tileServiceFully qualified class name of TileService is associated with this accessibility service for one to one mapping. 

Constants

intCAPABILITY_CAN_CONTROL_MAGNIFICATION

Capability: This accessibility service can control display magnification.

intCAPABILITY_CAN_PERFORM_GESTURES

Capability: This accessibility service can perform gestures.

intCAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY

This constant was deprecated in API level 26. No longer used

intCAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS

Capability: This accessibility service can request to filter the key event stream.

intCAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES

Capability: This accessibility service can capture gestures from the fingerprint sensor

intCAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION

Capability: This accessibility service can request touch exploration mode in which touched items are spoken aloud and the UI can be explored via gestures.

intCAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT

Capability: This accessibility service can retrieve the active window content.

intCAPABILITY_CAN_TAKE_SCREENSHOT

Capability: This accessibility service can take screenshot.

intDEFAULT

If an AccessibilityService is the default for a given type.

intFEEDBACK_ALL_MASK

Mask for all feedback types.

intFEEDBACK_AUDIBLE

Denotes audible (not spoken) feedback.

intFEEDBACK_BRAILLE

Denotes braille feedback.

intFEEDBACK_GENERIC

Denotes generic feedback.

intFEEDBACK_HAPTIC

Denotes haptic feedback.

intFEEDBACK_SPOKEN

Denotes spoken feedback.

intFEEDBACK_VISUAL

Denotes visual feedback.

intFLAG_ENABLE_ACCESSIBILITY_VOLUME

This flag requests that all audio tracks system-wide with AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY be controlled by the AudioManager.STREAM_ACCESSIBILITY volume.

intFLAG_INCLUDE_NOT_IMPORTANT_VIEWS

If this flag is set the system will regard views that are not important for accessibility in addition to the ones that are important for accessibility.

intFLAG_INPUT_METHOD_EDITOR

This flag makes the AccessibilityService an input method editor with a subset of input method editor capabilities: get the InputConnection and get text selection change notifications.

intFLAG_REPORT_VIEW_IDS

This flag requests that the AccessibilityNodeInfos obtained by an AccessibilityService contain the id of the source view.

intFLAG_REQUEST_2_FINGER_PASSTHROUGH

This flag requests that when when FLAG_REQUEST_MULTI_FINGER_GESTURES is enabled, two-finger passthrough gestures are re-enabled.

intFLAG_REQUEST_ACCESSIBILITY_BUTTON

This flag indicates to the system that the accessibility service requests that an accessibility button be shown within the system's navigation area, if available.

intFLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY

This constant was deprecated in API level 26. No longer used

intFLAG_REQUEST_FILTER_KEY_EVENTS

This flag requests from the system to filter key events.

intFLAG_REQUEST_FINGERPRINT_GESTURES

This flag requests that all fingerprint gestures be sent to the accessibility service.

intFLAG_REQUEST_MULTI_FINGER_GESTURES

This flag requests that when when FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, multi-finger gestures are also enabled.

intFLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK

This flag requests that accessibility shortcut warning dialog has spoken feedback when dialog is shown.

intFLAG_REQUEST_TOUCH_EXPLORATION_MODE

This flag requests that the system gets into touch exploration mode.

intFLAG_RETRIEVE_INTERACTIVE_WINDOWS

This flag indicates to the system that the accessibility service wants to access content of all interactive windows.

intFLAG_SEND_MOTION_EVENTS

This flag requests that when when FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, a service will receive the motion events for each successfully-detected gesture.

intFLAG_SERVICE_HANDLES_DOUBLE_TAP

This flag requests that when FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, double tap and double tap and hold gestures are dispatched to the service rather than being handled by the framework.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<AccessibilityServiceInfo>CREATOR

public inteventTypes

The event types an AccessibilityService is interested in.

public intfeedbackType

The feedback type an AccessibilityService provides.

public intflags

This field represents a set of flags used for configuring an AccessibilityService.

public longnotificationTimeout

The timeout, in milliseconds, after the most recent event of a given type before an AccessibilityService is notified.

public String[]packageNames

The package names an AccessibilityService is interested in.

Public constructors

AccessibilityServiceInfo()

Creates a new instance.

Public methods

static StringcapabilityToString(int capability)

Returns the string representation of a capability.

intdescribeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

booleanequals(Object obj)

Indicates whether some other object is "equal to" this one.

static StringfeedbackTypeToString(int feedbackType)

Returns the string representation of a feedback type.

static StringflagToString(int flag)

Returns the string representation of a flag.

booleangetCanRetrieveWindowContent()

This method was deprecated in API level 18. Use getCapabilities().

intgetCapabilities()

Returns the bit mask of capabilities this accessibility service has such as being able to retrieve the active window content, etc.

StringgetDescription()

This method was deprecated in API level 16. Use loadDescription(android.content.pm.PackageManager).

StringgetId()

The accessibility service id.

intgetInteractiveUiTimeoutMillis()

Get the recommended timeout for interactive controls.

intgetNonInteractiveUiTimeoutMillis()

Get the recommended timeout for non-interactive controls.

ResolveInfogetResolveInfo()

The service ResolveInfo.

StringgetSettingsActivityName()

The settings activity name.

StringgetTileServiceName()

Gets the name of TileService is associated with this accessibility service.

inthashCode()

Returns a hash code value for the object.

booleanisAccessibilityTool()

Indicates if the service is used to assist users with disabilities.

StringloadDescription(PackageManager packageManager)

The localized description of the accessibility service.

CharSequenceloadIntro(PackageManager packageManager)

The localized intro of the accessibility service.

CharSequenceloadSummary(PackageManager packageManager)

The localized summary of the accessibility service.

voidsetInteractiveUiTimeoutMillis(int timeout)

Set the recommended time that interactive controls need to remain on the screen to support the user.

voidsetNonInteractiveUiTimeoutMillis(int timeout)

Set the recommended time that non-interactive controls need to remain on the screen to support the user.

StringtoString()

Returns a string representation of the object.

voidwriteToParcel(Parcel parcel, int flagz)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

XML attributes

android:accessibilityEventTypes

The event types this service would like to receive as specified in AccessibilityEvent. This setting can be changed at runtime by calling android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

Must be one or more (separated by '|') of the following constant values.

ConstantValueDescription
typeAllMaskffffffffReceives AccessibilityEvent.TYPES_ALL_MASK i.e. all events.
typeAnnouncement4000Receives AccessibilityEvent.TYPE_ANNOUNCEMENT events.
typeAssistReadingContext1000000Receives AccessibilityEvent.TYPE_ASSIST_READING_CONTEXT events.
typeContextClicked800000Receives AccessibilityEvent.TYPE_VIEW_CONTEXT_CLICKED events.
typeGestureDetectionEnd80000Receives AccessibilityEvent.TYPE_GESTURE_DETECTION_END events.
typeGestureDetectionStart40000Receives AccessibilityEvent.TYPE_GESTURE_DETECTION_START events.
typeNotificationStateChanged40Receives AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED events.
typeTouchExplorationGestureEnd400Receives AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END events.
typeTouchExplorationGestureStart200Receives AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START events.
typeTouchInteractionEnd200000Receives AccessibilityEvent.TYPE_TOUCH_INTERACTION_END events.
typeTouchInteractionStart100000Receives AccessibilityEvent.TYPE_TOUCH_INTERACTION_START events.
typeViewAccessibilityFocusCleared10000Receives AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED events.
typeViewAccessibilityFocused8000Receives AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED events.
typeViewClicked1Receives AccessibilityEvent.TYPE_VIEW_CLICKED events.
typeViewFocused8Receives AccessibilityEvent.TYPE_VIEW_FOCUSED events.
typeViewHoverEnter80Receives AccessibilityEvent.TYPE_VIEW_HOVER_ENTER events.
typeViewHoverExit100Receives AccessibilityEvent.TYPE_VIEW_HOVER_EXIT events.
typeViewLongClicked2Receives AccessibilityEvent.TYPE_VIEW_LONG_CLICKED events.
typeViewScrolled1000Receives AccessibilityEvent.TYPE_VIEW_SCROLLED events.
typeViewSelected4Receives AccessibilityEvent.TYPE_VIEW_SELECTED events.
typeViewTextChanged10Receives AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED events.
typeViewTextSelectionChanged2000Receives AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED events.
typeViewTextTraversedAtMovementGranularity20000Receives AccessibilityEvent.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY events.
typeWindowContentChanged800Receives AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED events.
typeWindowStateChanged20Receives AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED events.
typeWindowsChanged400000Receives AccessibilityEvent.TYPE_WINDOWS_CHANGED events.

android:accessibilityFeedbackType

The feedback types this service provides as specified in AccessibilityServiceInfo. This setting can be changed at runtime by calling android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

Must be one or more (separated by '|') of the following constant values.

ConstantValueDescription
feedbackAllMaskffffffffProvides AccessibilityServiceInfo.FEEDBACK_ALL_MASK feedback.
feedbackAudible4Provides AccessibilityServiceInfo.FEEDBACK_AUDIBLE feedback.
feedbackGeneric10Provides AccessibilityServiceInfo.FEEDBACK_GENERIC feedback.
feedbackHaptic2Provides AccessibilityServiceInfo.FEEDBACK_HAPTIC feedback.
feedbackSpoken1Provides AccessibilityServiceInfo.FEEDBACK_SPOKEN feedback.
feedbackVisual8Provides AccessibilityServiceInfo.FEEDBACK_VISUAL feedback.

android:accessibilityFlags

Additional flags as specified in AccessibilityServiceInfo. This setting can be changed at runtime by calling android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

Must be one or more (separated by '|') of the following constant values.

ConstantValueDescription
flagDefault1Has flag AccessibilityServiceInfo.DEFAULT.
flagEnableAccessibilityVolume80Has flag AccessibilityServiceInfo.FLAG_ENABLE_ACCESSIBILITY_VOLUME.
flagIncludeNotImportantViews2Has flag AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS.
flagInputMethodEditor8000Has flag AccessibilityServiceInfo.FLAG_INPUT_METHOD_EDITOR.
flagReportViewIds10Has flag AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS.
flagRequestAccessibilityButton100Has flag AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON.
flagRequestEnhancedWebAccessibility8Has flag AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY. Not used by the framework.
flagRequestFilterKeyEvents20Has flag AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS.
flagRequestFingerprintGestures200Has flag AccessibilityServiceInfo.FLAG_REQUEST_FINGERPRINT_GESTURES.
flagRequestMultiFingerGestures1000Has flag AccessibilityServiceInfo.FLAG_REQUEST_MULTI_FINGER_GESTURES.
flagRequestShortcutWarningDialogSpokenFeedback400Has flag AccessibilityServiceInfo.FLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK.
flagRequestTouchExplorationMode4Has flag AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE.
flagRetrieveInteractiveWindows40Has flag AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS.
flagSendMotionEvents4000
flagServiceHandlesDoubleTap800Has flag AccessibilityServiceInfo.FLAG_SERVICE_HANDLES_DOUBLE_TAP.

android:canRequestEnhancedWebAccessibility

Attribute whether the accessibility service wants to be able to request enhanced web accessibility enhancements.

May be a boolean value, such as "true" or "false".

android:canRequestFilterKeyEvents

Attribute whether the accessibility service wants to be able to request to filter key events.

Required to allow setting the #AccessibilityServiceInfo#FLAG_REQUEST_FILTER_KEY_EVENTS flag.

May be a boolean value, such as "true" or "false".

android:canRequestTouchExplorationMode

Attribute whether the accessibility service wants to be able to request touch exploration mode in which touched items are spoken aloud and the UI can be explored via gestures.

Required to allow setting the #AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE flag.

May be a boolean value, such as "true" or "false".

android:canRetrieveWindowContent

Attribute whether the accessibility service wants to be able to retrieve the active window content. This setting cannot be changed at runtime.

Required to allow setting the #AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS flag.

May be a boolean value, such as "true" or "false".

android:canTakeScreenshot

Attribute whether the accessibility service wants to be able to take screenshot.

May be a boolean value, such as "true" or "false".

android:description

Description of the accessibility service usage, availability, or limitations (e.g. isn't supported by all apps).

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

android:interactiveUiTimeout

A recommended timeout in milliseconds used in android.view.accessibility.AccessibilityManager.getRecommendedTimeoutMillis(int, int) to return a suitable value for interactive controls. This setting can be changed at runtime by calling android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

May be an integer value, such as "100".

android:intro

Detailed intro of the accessibility service purpose or behavior.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

android:nonInteractiveUiTimeout

A recommended timeout in milliseconds used in android.view.accessibility.AccessibilityManager.getRecommendedTimeoutMillis(int, int) to return a suitable value for UIs that do not include interactive controls. This setting can be changed at runtime by calling android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

May be an integer value, such as "100".

android:notificationTimeout

The minimal period in milliseconds between two accessibility events of the same type are sent to this service. This setting can be changed at runtime by calling android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

May be an integer value, such as "100".

android:packageNames

Comma separated package names from which this service would like to receive events (leave out for all packages). android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo).

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

android:settingsActivity

Fully qualified class name of an activity that allows the user to modify the settings for this service. This setting cannot be changed at runtime.

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

android:summary

Brief summary of the accessibility service purpose or behavior.

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

android:tileService

Fully qualified class name of TileService is associated with this accessibility service for one to one mapping. It is used by system settings to remind users this accessibility service has a TileService.

May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character;

Constants

CAPABILITY_CAN_CONTROL_MAGNIFICATION

Added in API level 24

public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION

Capability: This accessibility service can control display magnification.

See also:

Constant Value: 16 (0x00000010)

CAPABILITY_CAN_PERFORM_GESTURES

Added in API level 24

public static final int CAPABILITY_CAN_PERFORM_GESTURES

Capability: This accessibility service can perform gestures.

See also:

Constant Value: 32 (0x00000020)

CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY

Added in API level 18
Deprecated in API level 26

public static final int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY

This constant was deprecated in API level 26.
No longer used

Constant Value: 4 (0x00000004)

CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS

Added in API level 18

public static final int CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS

Capability: This accessibility service can request to filter the key event stream.

See also:

Constant Value: 8 (0x00000008)

CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES

Added in API level 26

public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES

Capability: This accessibility service can capture gestures from the fingerprint sensor

See also:

Constant Value: 64 (0x00000040)

CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION

Added in API level 18

public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION

Capability: This accessibility service can request touch exploration mode in which touched items are spoken aloud and the UI can be explored via gestures.

See also:

Constant Value: 2 (0x00000002)

CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT

Added in API level 18

public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT

Capability: This accessibility service can retrieve the active window content.

See also:

Constant Value: 1 (0x00000001)

CAPABILITY_CAN_TAKE_SCREENSHOT

Added in API level 30

public static final int CAPABILITY_CAN_TAKE_SCREENSHOT

Capability: This accessibility service can take screenshot.

See also:

Constant Value: 128 (0x00000080)

DEFAULT

Added in API level 4

public static final int DEFAULT

If an AccessibilityService is the default for a given type. Default service is invoked only if no package specific one exists. In case of more than one package specific service only the earlier registered is notified.

Constant Value: 1 (0x00000001)

FEEDBACK_ALL_MASK

Added in API level 14

public static final int FEEDBACK_ALL_MASK

Mask for all feedback types.

See also:

Constant Value: -1 (0xffffffff)

FEEDBACK_AUDIBLE

Added in API level 4

public static final int FEEDBACK_AUDIBLE

Denotes audible (not spoken) feedback.

Constant Value: 4 (0x00000004)

FEEDBACK_BRAILLE

Added in API level 17

public static final int FEEDBACK_BRAILLE

Denotes braille feedback.

Constant Value: 32 (0x00000020)

FEEDBACK_GENERIC

Added in API level 4

public static final int FEEDBACK_GENERIC

Denotes generic feedback.

Constant Value: 16 (0x00000010)

FEEDBACK_HAPTIC

Added in API level 4

public static final int FEEDBACK_HAPTIC

Denotes haptic feedback.

Constant Value: 2 (0x00000002)

FEEDBACK_SPOKEN

Added in API level 4

public static final int FEEDBACK_SPOKEN

Denotes spoken feedback.

Constant Value: 1 (0x00000001)

FEEDBACK_VISUAL

Added in API level 4

public static final int FEEDBACK_VISUAL

Denotes visual feedback.

Constant Value: 8 (0x00000008)

FLAG_ENABLE_ACCESSIBILITY_VOLUME

Added in API level 26

public static final int FLAG_ENABLE_ACCESSIBILITY_VOLUME

This flag requests that all audio tracks system-wide with AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY be controlled by the AudioManager.STREAM_ACCESSIBILITY volume.

Constant Value: 128 (0x00000080)

FLAG_INCLUDE_NOT_IMPORTANT_VIEWS

Added in API level 16

public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS

If this flag is set the system will regard views that are not important for accessibility in addition to the ones that are important for accessibility. That is, views that are marked as not important for accessibility via View#IMPORTANT_FOR_ACCESSIBILITY_NO or View#IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS and views that are marked as potentially important for accessibility via View#IMPORTANT_FOR_ACCESSIBILITY_AUTO for which the system has determined that are not important for accessibility, are reported while querying the window content and also the accessibility service will receive accessibility events from them.

Note: For accessibility services targeting Android 4.1 (API level 16) or higher, this flag has to be explicitly set for the system to regard views that are not important for accessibility. For accessibility services targeting Android 4.0.4 (API level 15) or lower, this flag is ignored and all views are regarded for accessibility purposes.

Usually views not important for accessibility are layout managers that do not react to user actions, do not draw any content, and do not have any special semantics in the context of the screen content. For example, a three by three grid can be implemented as three horizontal linear layouts and one vertical, or three vertical linear layouts and one horizontal, or one grid layout, etc. In this context, the actual layout managers used to achieve the grid configuration are not important; rather it is important that there are nine evenly distributed elements.

Constant Value: 2 (0x00000002)

FLAG_INPUT_METHOD_EDITOR

Added in Android Tiramisu

public static final int FLAG_INPUT_METHOD_EDITOR

This flag makes the AccessibilityService an input method editor with a subset of input method editor capabilities: get the InputConnection and get text selection change notifications.

See also:

Constant Value: 32768 (0x00008000)

FLAG_REPORT_VIEW_IDS

Added in API level 18

public static final int FLAG_REPORT_VIEW_IDS

This flag requests that the AccessibilityNodeInfos obtained by an AccessibilityService contain the id of the source view. The source view id will be a fully qualified resource name of the form "package:id/name", for example "foo.bar:id/my_list", and it is useful for UI test automation. This flag is not set by default.

Constant Value: 16 (0x00000010)

FLAG_REQUEST_2_FINGER_PASSTHROUGH

Added in API level 31

public static final int FLAG_REQUEST_2_FINGER_PASSTHROUGH

This flag requests that when when FLAG_REQUEST_MULTI_FINGER_GESTURES is enabled, two-finger passthrough gestures are re-enabled. Two-finger swipe gestures are not detected, but instead passed through as one-finger gestures. In addition, three-finger swipes from the bottom of the screen are not detected, and instead are passed through unchanged. If FLAG_REQUEST_MULTI_FINGER_GESTURES is disabled this flag has no effect.

See also:

Constant Value: 8192 (0x00002000)

FLAG_REQUEST_ACCESSIBILITY_BUTTON

Added in API level 26

public static final int FLAG_REQUEST_ACCESSIBILITY_BUTTON

This flag indicates to the system that the accessibility service requests that an accessibility button be shown within the system's navigation area, if available.

Note: For accessibility services targeting APIs greater than API 29, this flag must be specified in the accessibility service metadata file. Otherwise, it will be ignored.

Constant Value: 256 (0x00000100)

FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY

Added in API level 18
Deprecated in API level 26

public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY

This constant was deprecated in API level 26.
No longer used

Constant Value: 8 (0x00000008)

FLAG_REQUEST_FILTER_KEY_EVENTS

Added in API level 18

public static final int FLAG_REQUEST_FILTER_KEY_EVENTS

This flag requests from the system to filter key events. If this flag is set the accessibility service will receive the key events before applications allowing it implement global shortcuts.

Services that want to set this flag have to declare this capability in their meta-data by setting the attribute #canRequestFilterKeyEvents canRequestFilterKeyEvents to true, otherwise this flag will be ignored. For how to declare the meta-data of a service refer to android.accessibilityservice.AccessibilityService.SERVICE_META_DATA AccessibilityService.SERVICE_META_DATA.

See also:

Constant Value: 32 (0x00000020)

FLAG_REQUEST_FINGERPRINT_GESTURES

Added in API level 26

public static final int FLAG_REQUEST_FINGERPRINT_GESTURES

This flag requests that all fingerprint gestures be sent to the accessibility service.

Services that want to set this flag have to declare the capability to retrieve window content in their meta-data by setting the attribute R.attr.canRequestFingerprintGestures to true, otherwise this flag will be ignored. For how to declare the meta-data of a service refer to android.accessibilityservice.AccessibilityService.SERVICE_META_DATA AccessibilityService.SERVICE_META_DATA.

See also:

Constant Value: 512 (0x00000200)

FLAG_REQUEST_MULTI_FINGER_GESTURES

Added in API level 30

public static final int FLAG_REQUEST_MULTI_FINGER_GESTURES

This flag requests that when when FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, multi-finger gestures are also enabled. As a consequence, two-finger bypass gestures will be disabled. If FLAG_REQUEST_TOUCH_EXPLORATION_MODE is disabled this flag has no effect.

See also:

Constant Value: 4096 (0x00001000)

FLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK

Added in API level 29

public static final int FLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK

This flag requests that accessibility shortcut warning dialog has spoken feedback when dialog is shown.

Constant Value: 1024 (0x00000400)

FLAG_REQUEST_TOUCH_EXPLORATION_MODE

Added in API level 16

public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE

This flag requests that the system gets into touch exploration mode. In this mode a single finger moving on the screen behaves as a mouse pointer hovering over the user interface. The system will also detect certain gestures performed on the touch screen and notify this service. The system will enable touch exploration mode if there is at least one accessibility service that has this flag set. Hence, clearing this flag does not guarantee that the device will not be in touch exploration mode since there may be another enabled service that requested it.

For accessibility services targeting Android 4.3 (API level 18) or higher that want to set this flag have to declare this capability in their meta-data by setting the attribute canRequestTouchExplorationMode to true. Otherwise, this flag will be ignored. For how to declare the meta-data of a service refer to android.accessibilityservice.AccessibilityService.SERVICE_META_DATA AccessibilityService.SERVICE_META_DATA.

Services targeting Android 4.2.2 (API level 17) or lower will work normally. In other words, the first time they are run, if this flag is specified, a dialog is shown to the user to confirm enabling explore by touch.

See also:

Constant Value: 4 (0x00000004)

FLAG_RETRIEVE_INTERACTIVE_WINDOWS

Added in API level 21

public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS

This flag indicates to the system that the accessibility service wants to access content of all interactive windows. An interactive window is a window that has input focus or can be touched by a sighted user when explore by touch is not enabled. If this flag is not set your service will not receive AccessibilityEvent.TYPE_WINDOWS_CHANGED events, calling AccessibilityServiceAccessibilityService.getWindows() will return an empty list, and AccessibilityNodeInfo.getWindow() will return null.

Services that want to set this flag have to declare the capability to retrieve window content in their meta-data by setting the attribute canRetrieveWindowContent to true, otherwise this flag will be ignored. For how to declare the meta-data of a service refer to android.accessibilityservice.AccessibilityService.SERVICE_META_DATA AccessibilityService.SERVICE_META_DATA.

See also:

Constant Value: 64 (0x00000040)

FLAG_SEND_MOTION_EVENTS

Added in API level 31

public static final int FLAG_SEND_MOTION_EVENTS

This flag requests that when when FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, a service will receive the motion events for each successfully-detected gesture. The service will also receive an AccessibilityGestureEvent of type GESTURE_INVALID for each cancelled gesture along with its motion events. A service will receive a gesture of type GESTURE_PASSTHROUGH and accompanying motion events for every passthrough gesture that does not start gesture detection. This information can be used to collect instances of improper gesture detection behavior and relay that information to framework developers. If FLAG_REQUEST_TOUCH_EXPLORATION_MODE is disabled this flag has no effect.

See also:

Constant Value: 16384 (0x00004000)

FLAG_SERVICE_HANDLES_DOUBLE_TAP

Added in API level 30

public static final int FLAG_SERVICE_HANDLES_DOUBLE_TAP

This flag requests that when FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, double tap and double tap and hold gestures are dispatched to the service rather than being handled by the framework. If FLAG_REQUEST_TOUCH_EXPLORATION_MODE is disabled this flag has no effect.

See also:

Constant Value: 2048 (0x00000800)

Fields

CREATOR

Added in API level 4

public static final Creator<AccessibilityServiceInfo> CREATOR

See also:

eventTypes

Added in API level 4

public int eventTypes

The event types an AccessibilityService is interested in.

Can be dynamically set at runtime.

See also:

feedbackType

Added in API level 4

public int feedbackType

The feedback type an AccessibilityService provides.

Can be dynamically set at runtime.


Value is either 0 or a combination of FEEDBACK_AUDIBLEFEEDBACK_GENERICFEEDBACK_HAPTICFEEDBACK_SPOKENFEEDBACK_VISUAL, and FEEDBACK_BRAILLE

See also:

flags

Added in API level 4

public int flags

This field represents a set of flags used for configuring an AccessibilityService.

Can be dynamically set at runtime.

Note: Accessibility services with targetSdkVersion greater than API 29 cannot dynamically set the FLAG_REQUEST_ACCESSIBILITY_BUTTON at runtime. It must be specified in the accessibility service metadata file.

See also:

notificationTimeout

Added in API level 4

public long notificationTimeout

The timeout, in milliseconds, after the most recent event of a given type before an AccessibilityService is notified.

Can be dynamically set at runtime.

Note: The event notification timeout is useful to avoid propagating events to the client too frequently since this is accomplished via an expensive interprocess call. One can think of the timeout as a criteria to determine when event generation has settled down.

packageNames

Added in API level 4

public String[] packageNames

The package names an AccessibilityService is interested in. Setting to null is equivalent to all packages.

Can be dynamically set at runtime.

Public constructors

AccessibilityServiceInfo

Added in API level 4

public AccessibilityServiceInfo ()

Creates a new instance.

Public methods

capabilityToString

Added in API level 18

public static String capabilityToString (int capability)

Returns the string representation of a capability. For example, CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT is represented by the string CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT.

Parameters
capabilityint: The capability.

Returns
StringThe string representation.

describeContents

Added in API level 4

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
inta bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 4

public boolean equals (Object obj)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value xx.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and yx.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values xy, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value xx.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
objObject: This value may be null.

Returns
booleantrue if this object is the same as the obj argument; false otherwise.

feedbackTypeToString

Added in API level 14

public static String feedbackTypeToString (int feedbackType)

Returns the string representation of a feedback type. For example, FEEDBACK_SPOKEN is represented by the string FEEDBACK_SPOKEN.

Parameters
feedbackTypeint: The feedback type.

Returns
StringThe string representation.

flagToString

Added in API level 14

public static String flagToString (int flag)

Returns the string representation of a flag. For example, DEFAULT is represented by the string DEFAULT.

Parameters
flagint: The flag.

Returns
StringThe string representation.

getCanRetrieveWindowContent

Added in API level 14
Deprecated in API level 18

public boolean getCanRetrieveWindowContent ()

This method was deprecated in API level 18.
Use getCapabilities().

Whether this service can retrieve the current window's content.

Statically set from meta-data.

Returns
booleanTrue if window content can be retrieved.

getCapabilities

Added in API level 18

public int getCapabilities ()

Returns the bit mask of capabilities this accessibility service has such as being able to retrieve the active window content, etc.

Returns
intThe capability bit mask.

See also:

getDescription

Added in API level 14
Deprecated in API level 16

public String getDescription ()

This method was deprecated in API level 16.
Use loadDescription(android.content.pm.PackageManager).

Gets the non-localized description of the accessibility service.

Statically set from meta-data.

Returns
StringThe description.

getId

Added in API level 14

public String getId ()

The accessibility service id.

Generated by the system.

Returns
StringThe id.

getInteractiveUiTimeoutMillis

Added in API level 29

public int getInteractiveUiTimeoutMillis ()

Get the recommended timeout for interactive controls.

Returns
intThe timeout in milliseconds.

See also:

getNonInteractiveUiTimeoutMillis

Added in API level 29

public int getNonInteractiveUiTimeoutMillis ()

Get the recommended timeout for non-interactive controls.

Returns
intThe timeout in milliseconds.

See also:

getResolveInfo

Added in API level 14

public ResolveInfo getResolveInfo ()

The service ResolveInfo.

Generated by the system.

Returns
ResolveInfoThe info.

getSettingsActivityName

Added in API level 14

public String getSettingsActivityName ()

The settings activity name.

Statically set from meta-data.

Returns
StringThe settings activity name.

getTileServiceName

Added in Android Tiramisu

public String getTileServiceName ()

Gets the name of TileService is associated with this accessibility service.

Returns
StringThe name of TileService. This value may be null.

hashCode

Added in API level 4

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
inta hash code value for this object.

isAccessibilityTool

Added in API level 31

public boolean isAccessibilityTool ()

Indicates if the service is used to assist users with disabilities.

Returns
booleantrue if the property is set to true.

loadDescription

Added in API level 16

public String loadDescription (PackageManager packageManager)

The localized description of the accessibility service.

Statically set from meta-data.

Parameters
packageManagerPackageManager

Returns
StringThe localized description.

loadIntro

Added in Android Tiramisu

public CharSequence loadIntro (PackageManager packageManager)

The localized intro of the accessibility service.

Statically set from meta-data.

Parameters
packageManagerPackageManager: This value cannot be null.

Returns
CharSequenceThe localized intro if available, and null if a intro has not been provided.

loadSummary

Added in API level 26

public CharSequence loadSummary (PackageManager packageManager)

The localized summary of the accessibility service.

Statically set from meta-data.

Parameters
packageManagerPackageManager

Returns
CharSequenceThe localized summary if available, and null if a summary has not been provided.

setInteractiveUiTimeoutMillis

Added in API level 29

public void setInteractiveUiTimeoutMillis (int timeout)

Set the recommended time that interactive controls need to remain on the screen to support the user.

This value can be dynamically set at runtime by AccessibilityService#setServiceInfo(AccessibilityServiceInfo).

Parameters
timeoutint: The timeout in milliseconds. Value is 0 or greater

See also:

setNonInteractiveUiTimeoutMillis

Added in API level 29

public void setNonInteractiveUiTimeoutMillis (int timeout)

Set the recommended time that non-interactive controls need to remain on the screen to support the user.

This value can be dynamically set at runtime by AccessibilityService#setServiceInfo(AccessibilityServiceInfo).

Parameters
timeoutint: The timeout in milliseconds. Value is 0 or greater

See also:

toString

Added in API level 4

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
Stringa string representation of the object.

writeToParcel

Added in API level 4

public void writeToParcel (Parcel parcel, 
                int flagz)

Flatten this object in to a Parcel.

Parameters
parcelParcel: The Parcel in which the object should be written. This value cannot be null.

flagzint: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES
相关推荐

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值