java.lang.Object | |
↳ | android.accessibilityservice.AccessibilityServiceInfo |
This class describes an
AccessibilityService
. The system notifies an
AccessibilityService
for
AccessibilityEvent
s
according to the information encapsulated in this class.
For more information about creating AccessibilityServices, read the Accessibility developer guide.
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|||||||||
android:accessibilityEventTypes |
The event types this serivce would like to receive as specified in
AccessibilityEvent
.
|
||||||||||
android:accessibilityFeedbackType |
The feedback types this serivce provides as specified in
AccessibilityServiceInfo
.
|
||||||||||
android:accessibilityFlags |
Additional flags as specified in
AccessibilityServiceInfo
.
|
||||||||||
android:canRequestEnhancedWebAccessibility | Attribute whether the accessibility service wants to be able to request enhanced web accessibility enhancements. | ||||||||||
android:canRequestFilterKeyEvents | Attribute whether the accessibility service wants to be able to request to filter key events. | ||||||||||
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. | ||||||||||
android:canRetrieveWindowContent | Attribute whether the accessibility service wants to be able to retrieve the active window content. | ||||||||||
android:description | Short description of the accessibility serivce purpose or behavior. | ||||||||||
android:notificationTimeout | The minimal period in milliseconds between two accessibility events of the same type are sent to this serivce. | ||||||||||
android:packageNames | Comma separated package names from which this serivce would like to receive events (leave out for all packages). | ||||||||||
android:settingsActivity | Component name of an activity that allows the user to modify the settings for this service. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY | Capability: This accessibility service can request enhanced web accessibility enhancements. | |||||||||
int | CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS | Capability: This accessibility service can request to filter the key event stream. | |||||||||
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. | |||||||||
int | CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT | Capability: This accessibility service can retrieve the active window content. | |||||||||
int | DEFAULT |
If an
AccessibilityService
is the default for a given type.
|
|||||||||
int | FEEDBACK_ALL_MASK | Mask for all feedback types. | |||||||||
int | FEEDBACK_AUDIBLE | Denotes audible (not spoken) feedback. | |||||||||
int | FEEDBACK_BRAILLE | Denotes braille feedback. | |||||||||
int | FEEDBACK_GENERIC | Denotes generic feedback. | |||||||||
int | FEEDBACK_HAPTIC | Denotes haptic feedback. | |||||||||
int | FEEDBACK_SPOKEN | Denotes spoken feedback. | |||||||||
int | FEEDBACK_VISUAL | Denotes visual feedback. | |||||||||
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. | |||||||||
int | FLAG_REPORT_VIEW_IDS |
This flag requests that the
AccessibilityNodeInfo
s obtained
by an
AccessibilityService
contain the id of the source view.
|
|||||||||
int | FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY | This flag requests from the system to enable web accessibility enhancing extensions. | |||||||||
int | FLAG_REQUEST_FILTER_KEY_EVENTS | This flag requests from the system to filter key events. | |||||||||
int | FLAG_REQUEST_TOUCH_EXPLORATION_MODE | This flag requests that the system gets into touch exploration mode. |
[Expand]
Inherited Constants
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
CREATOR | ||||||||||
|
eventTypes |
The event types an
AccessibilityService
is interested in.
|
|||||||||
|
feedbackType |
The feedback type an
AccessibilityService
provides.
|
|||||||||
|
flags |
This field represents a set of flags used for configuring an
AccessibilityService
.
|
|||||||||
|
notificationTimeout |
The timeout after the most recent event of a given type before an
AccessibilityService
is notified.
|
|||||||||
|
packageNames |
The package names an
AccessibilityService
is interested in.
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Creates a new instance.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Returns the string representation of a capability.
|
||||||||||
|
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
|
||||||||||
|
Compares this instance with the specified object and indicates if they
are equal.
|
||||||||||
|
Returns the string representation of a feedback type.
|
||||||||||
|
Returns the string representation of a flag.
|
||||||||||
|
This method was deprecated
in API level 18.
Use
getCapabilities()
.
|
||||||||||
|
Returns the bit mask of capabilities this accessibility service has such as
being able to retrieve the active window content, etc.
|
||||||||||
|
This method was deprecated
in API level 16.
Use
loadDescription(PackageManager)
.
|
||||||||||
|
The accessibility service id.
|
||||||||||
|
The service
ResolveInfo
.
|
||||||||||
|
The settings activity name.
|
||||||||||
|
Returns an integer hash code for this object.
|
||||||||||
|
The localized description of the accessibility service.
|
||||||||||
|
Returns a string containing a concise, human-readable description of this
object.
|
||||||||||
|
Flatten this object in to a Parcel.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
|||||||||||
From interface
android.os.Parcelable
|
The event types this serivce 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.
Constant | Value | Description |
---|---|---|
typeViewClicked
|
0x00000001 |
Receives
TYPE_VIEW_CLICKED
events.
|
typeViewLongClicked
|
0x00000002 |
Receives
TYPE_VIEW_LONG_CLICKED
events.
|
typeViewSelected
|
0x00000004 |
Receives
TYPE_VIEW_SELECTED
events.
|
typeViewFocused
|
0x00000008 |
Receives
TYPE_VIEW_FOCUSED
events.
|
typeViewTextChanged
|
0x00000010 |
Receives
TYPE_VIEW_TEXT_CHANGED
events.
|
typeWindowStateChanged
|
0x00000020 |
Receives
TYPE_WINDOW_STATE_CHANGED
events.
|
typeNotificationStateChanged
|
0x00000040 |
Receives
TYPE_NOTIFICATION_STATE_CHANGED
events.
|
typeViewHoverEnter
|
0x00000080 |
Receives
TYPE_VIEW_HOVER_ENTER
events.
|
typeViewHoverExit
|
0x00000100 |
Receives
TYPE_VIEW_HOVER_EXIT
events.
|
typeTouchExplorationGestureStart
|
0x00000200 |
Receives
TYPE_TOUCH_EXPLORATION_GESTURE_START
events.
|
typeTouchExplorationGestureEnd
|
0x00000400 |
Receives
TYPE_TOUCH_EXPLORATION_GESTURE_END
events.
|
typeWindowContentChanged
|
0x00000800 |
Receives
TYPE_WINDOW_CONTENT_CHANGED
events.
|
typeViewScrolled
|
0x000001000 |
Receives
TYPE_VIEW_SCROLLED
events.
|
typeViewTextSelectionChanged
|
0x000002000 |
Receives
TYPE_VIEW_TEXT_SELECTION_CHANGED
events.
|
typeAllMask
|
0xffffffff |
Receives
TYPES_ALL_MASK
i.e. all events.
|
This corresponds to the global attribute
resource symbol
accessibilityEventTypes
.
The feedback types this serivce 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.
Constant | Value | Description |
---|---|---|
feedbackSpoken
|
0x00000001 |
Provides
FEEDBACK_SPOKEN
feedback.
|
feedbackHaptic
|
0x00000002 |
Provides
FEEDBACK_HAPTIC
feedback.
|
feedbackAudible
|
0x00000004 |
Provides
FEEDBACK_AUDIBLE
feedback.
|
feedbackVisual
|
0x00000008 |
Provides
FEEDBACK_VISUAL
feedback.
|
feedbackGeneric
|
0x00000010 |
Provides
FEEDBACK_GENERIC
feedback.
|
feedbackAllMask
|
0xffffffff |
Provides
FEEDBACK_ALL_MASK
feedback.
|
This corresponds to the global attribute
resource symbol
accessibilityFeedbackType
.
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.
Constant | Value | Description |
---|---|---|
flagDefault
|
0x00000001 |
Has flag
DEFAULT
|
flagIncludeNotImportantViews
|
0x00000002 |
Has flag
FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
|
flagRequestTouchExplorationMode
|
0x00000004 |
Has flag
FLAG_REQUEST_TOUCH_EXPLORATION_MODE
|
flagRequestEnhancedWebAccessibility
|
0x00000008 |
Has flag
FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY
|
flagReportViewIds
|
0x00000010 |
Has flag
FLAG_REPORT_VIEW_IDS
|
flagRequestFilterKeyEvents
|
0x00000020 |
Has flag
FLAG_REQUEST_FILTER_KEY_EVENTS
|
This corresponds to the global attribute
resource symbol
accessibilityFlags
.
Attribute whether the accessibility service wants to be able to request enhanced web accessibility enhancements. For example, installing scripts to make app content more accessible.
Required to allow setting the
#AccessibilityServiceInfo#FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY
flag.
Must be a boolean value, either "
true
" or "
false
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
canRequestEnhancedWebAccessibility
.
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.
Must be a boolean value, either "
true
" or "
false
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
canRequestFilterKeyEvents
.
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.
Must be a boolean value, either "
true
" or "
false
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
canRequestTouchExplorationMode
.
Attribute whether the accessibility service wants to be able to retrieve the active window content. This setting cannot be changed at runtime.
Must be a boolean value, either "
true
" or "
false
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
canRetrieveWindowContent
.
Short description of the accessibility serivce purpose or behavior.
Must be a reference to another resource, in the form "
@[+][
package
:]
type
:
name
"
or to a theme attribute in the form "
?[
package
:][
type
:]
name
".
This corresponds to the global attribute
resource symbol
description
.
The minimal period in milliseconds between two accessibility events of the same type
are sent to this serivce. This setting can be changed at runtime by calling
android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)
.
Must be an integer value, such as "
100
".
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
notificationTimeout
.
Comma separated package names from which this serivce would like to receive events (leave out for all packages).
android.accessibilityservice.AccessibilityService.setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)
.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
packageNames
.
Component name of an activity that allows the user to modify the settings for this service. This setting cannot be changed at runtime.
Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
This may also be a reference to a resource (in the form
"
@[
package
:]
type
:
name
") or
theme attribute (in the form
"
?[
package
:][
type
:]
name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol
settingsActivity
.
Capability: This accessibility service can request enhanced web accessibility enhancements. For example, installing scripts to make app content more accessible.
Capability: This accessibility service can request to filter the key event stream.
Capability: This accessibility service can request touch exploration mode in which touched items are spoken aloud and the UI can be explored via gestures.
Capability: This accessibility service can retrieve the active window content.
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.
Mask for all feedback types.
Denotes audible (not spoken) feedback.
Denotes braille feedback.
Denotes generic feedback.
Denotes haptic feedback.
Denotes spoken feedback.
Denotes visual feedback.
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
IMPORTANT_FOR_ACCESSIBILITY_NO
or
IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
and views that are
marked as potentially important for accessibility via
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 API version
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
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.
This flag requests that the
AccessibilityNodeInfo
s 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.
This flag requests from the system to enable web accessibility enhancing
extensions. Such extensions aim to provide improved accessibility support
for content presented in a
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 canRequestEnhancedWebAccessibility
to
true, otherwise this flag will be ignored. For how to declare the meta-data
of a service refer to
AccessibilityService.SERVICE_META_DATA
.
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. Setting this flag does not guarantee that this service will filter key events since only one service can do so at any given time. This avoids user confusion due to behavior change in case different key filtering services are enabled. If there is already another key filtering service enabled, this one will not receive key events.
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
AccessibilityService.SERVICE_META_DATA
.
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 API version higher than
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
AccessibilityService.SERVICE_META_DATA
.
Services targeting API version equal to or lower than
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.
The event types an
AccessibilityService
is interested in.
Can be dynamically set at runtime.
TYPE_VIEW_CLICKED
TYPE_VIEW_LONG_CLICKED
TYPE_VIEW_FOCUSED
TYPE_VIEW_SELECTED
TYPE_VIEW_TEXT_CHANGED
TYPE_WINDOW_STATE_CHANGED
TYPE_NOTIFICATION_STATE_CHANGED
TYPE_TOUCH_EXPLORATION_GESTURE_START
TYPE_TOUCH_EXPLORATION_GESTURE_END
TYPE_VIEW_HOVER_ENTER
TYPE_VIEW_HOVER_EXIT
TYPE_VIEW_SCROLLED
TYPE_VIEW_TEXT_SELECTION_CHANGED
TYPE_WINDOW_CONTENT_CHANGED
The feedback type an
AccessibilityService
provides.
Can be dynamically set at runtime.
This field represents a set of flags used for configuring an
AccessibilityService
.
Can be dynamically set at runtime.
The timeout 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.
The package names an
AccessibilityService
is interested in. Setting
to
null
is equivalent to all packages.
Can be dynamically set at runtime.
Returns the string representation of a capability. For example,
CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
is represented
by the string CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT.
capability | The capability. |
---|
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Compares this instance with the specified object and indicates if they
are equal. In order to be equal,
o
must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns
true
only if
this ==
o
. See
Writing a correct
equals
method
if you intend implementing your own
equals
method.
The general contract for the
equals
and
hashCode()
methods is that if
equals
returns
true
for
any two objects, then
hashCode()
must return the same value for
these objects. This means that subclasses of
Object
usually
override either both methods or neither of them.
obj | the object to compare this instance with. |
---|
true
if the specified object is equal to this
Object
;
false
otherwise.
Returns the string representation of a feedback type. For example,
FEEDBACK_SPOKEN
is represented by the string FEEDBACK_SPOKEN.
feedbackType | The feedback type. |
---|
Returns the string representation of a flag. For example,
DEFAULT
is represented by the string DEFAULT.
flag | The flag. |
---|
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 the bit mask of capabilities this accessibility service has such as being able to retrieve the active window content, etc.
This method was deprecated
in API level 16.
Use
loadDescription(PackageManager)
.
Gets the non-localized description of the accessibility service.
Statically set from
meta-data
.
The accessibility service id.
Generated by the system.
The service
ResolveInfo
.
Generated by the system.
The settings activity name.
Statically set from
meta-data
.
Returns an integer hash code for this object. By contract, any two
objects for which
equals(Object)
returns
true
must return
the same hash code value. This means that subclasses of
Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See
Writing a correct
hashCode
method
if you intend implementing your own
hashCode
method.
The localized description of the accessibility service.
Statically set from
meta-data
.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See
Writing a useful
toString
method
if you intend implementing your own
toString
method.
Flatten this object in to a Parcel.
parcel | The Parcel in which the object should be written. |
---|---|
flagz |
Additional flags about how the object should be written.
May be 0 or
PARCELABLE_WRITE_RETURN_VALUE
.
|