public final class AccessibilityServiceInfoCompat extends Object
AccessibilityService
introduced after API level 4 in a backwards compatible fashion.Modifier and Type | Field and Description |
---|---|
static int |
CAPABILITY_CAN_FILTER_KEY_EVENTS
Capability: This accessibility service can filter the key event stream.
|
static int |
CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
Capability: This accessibility service can request enhanced web accessibility
enhancements.
|
static 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.
|
static int |
CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
Capability: This accessibility service can retrieve the active window content.
|
static int |
DEFAULT
If an
AccessibilityService is the default for a given type. |
static int |
FEEDBACK_ALL_MASK
Mask for all feedback types.
|
static int |
FEEDBACK_BRAILLE
Denotes braille feedback.
|
static 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.
|
static int |
FLAG_REPORT_VIEW_IDS
This flag requests that the AccessibilityNodeInfos obtained
by an
AccessibilityService contain the id of the source view. |
static int |
FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY
This flag requests from the system to enable web accessibility enhancing
extensions.
|
static int |
FLAG_REQUEST_FILTER_KEY_EVENTS
This flag requests from the system to filter key events.
|
static int |
FLAG_REQUEST_TOUCH_EXPLORATION_MODE
This flag requests that the system gets into touch exploration mode.
|
Modifier and Type | Method and Description |
---|---|
static String |
capabilityToString(int capability)
Returns the string representation of a capability.
|
static String |
feedbackTypeToString(int feedbackType)
Returns the string representation of a feedback type.
|
static String |
flagToString(int flag)
Returns the string representation of a flag.
|
static boolean |
getCanRetrieveWindowContent(AccessibilityServiceInfo info)
Whether this service can retrieve the current window's content.
|
static int |
getCapabilities(AccessibilityServiceInfo info)
Returns the bit mask of capabilities this accessibility service has such as
being able to retrieve the active window content, etc.
|
static String |
getDescription(AccessibilityServiceInfo info)
Deprecated.
|
static String |
getId(AccessibilityServiceInfo info)
The accessibility service id.
|
static ResolveInfo |
getResolveInfo(AccessibilityServiceInfo info)
The service
ResolveInfo . |
static String |
getSettingsActivityName(AccessibilityServiceInfo info)
The settings activity name.
|
static String |
loadDescription(AccessibilityServiceInfo info,
PackageManager packageManager)
The localized description of the accessibility service.
|
public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
public static final int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
public static final int CAPABILITY_CAN_FILTER_KEY_EVENTS
public static final int FEEDBACK_BRAILLE
public static final int FEEDBACK_ALL_MASK
public static final int DEFAULT
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.public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
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 both reported while querying the
window content and also the accessibility service will receive accessibility events
from them.
Note: For accessibility services targeting API version
Build.VERSION_CODES#JELLY_BEAN
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 API version lower than
Build.VERSION_CODES#JELLY_BEAN
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 mangers used to achieve the grid configuration are not important, rather it is important that there are nine evenly distributed elements.
public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE
For accessibility services targeting API version higher than
Build.VERSION_CODES#JELLY_BEAN_MR1
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
.
Services targeting API version equal to or lower than
Build.VERSION_CODES#JELLY_BEAN_MR1
will work normally, i.e.
the first time they are run, if this flag is specified, a dialog is
shown to the user to confirm enabling explore by touch.
public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY
WebView
. An example of such
an extension is injecting JavaScript from a secure source. The system will enable
enhanced web accessibility 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 have enhanced web accessibility enabled since there may be
another enabled service that requested it.
Services that want to set this flag have to declare this capability in their meta-data by setting the attribute canRequestEnhancedWebAccessibility to true, otherwise this flag will be ignored. For how to declare the meta-data of a service refer to .
public static final int FLAG_REPORT_VIEW_IDS
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.public static final int FLAG_REQUEST_FILTER_KEY_EVENTS
Services that want to set this flag have to declare this capability in their meta-data by setting the attribute canRequestFilterKeyEvents to true, otherwise this flag will be ignored. For how to declare the meta -data of a service refer to .
public static String getId(AccessibilityServiceInfo info)
Generated by the system.
info
- The service info of interestpublic static ResolveInfo getResolveInfo(AccessibilityServiceInfo info)
ResolveInfo
.
Generated by the system.
info
- The service info of interestpublic static String getSettingsActivityName(AccessibilityServiceInfo info)
Statically set from meta-data
.
info
- The service info of interestpublic static boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info)
Statically set from meta-data
.
info
- The service info of interestpublic static String getDescription(AccessibilityServiceInfo info)
loadDescription(AccessibilityServiceInfo, PackageManager)
.
Statically set from meta-data
.
info
- The service info of interestpublic static String loadDescription(AccessibilityServiceInfo info, PackageManager packageManager)
Statically set from
meta-data
.
info
- The service info of interestpackageManager
- The current package managerpublic static String feedbackTypeToString(int feedbackType)
AccessibilityServiceInfo.FEEDBACK_SPOKEN
is represented by the
string FEEDBACK_SPOKEN.feedbackType
- The feedback type.public static String flagToString(int flag)
AccessibilityServiceInfo.DEFAULT
is represented by the
string DEFAULT.flag
- The flag.public static int getCapabilities(AccessibilityServiceInfo info)
info
- The service info whose capabilities to get.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
,
CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
,
CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
,
CAPABILITY_CAN_FILTER_KEY_EVENTS
public static String capabilityToString(int capability)
CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
is represented
by the string CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT.capability
- The capability.