public class AccessibilityServiceInfo extends Object implements Parcelable
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.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<AccessibilityServiceInfo> |
CREATOR |
static int |
DEFAULT
If an
AccessibilityService is the default for a given type. |
int |
eventTypes
The event types an
AccessibilityService is interested in. |
static int |
FEEDBACK_ALL_MASK
Mask for all feedback types.
|
static int |
FEEDBACK_AUDIBLE
Denotes audible (not spoken) feedback.
|
static int |
FEEDBACK_BRAILLE
Denotes braille feedback.
|
static int |
FEEDBACK_GENERIC
Denotes generic feedback.
|
static int |
FEEDBACK_HAPTIC
Denotes haptic feedback.
|
static int |
FEEDBACK_SPOKEN
Denotes spoken feedback.
|
static int |
FEEDBACK_VISUAL
Denotes visual feedback.
|
int |
feedbackType
The feedback type an
AccessibilityService provides. |
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_REQUEST_TOUCH_EXPLORATION_MODE
This flag requests that the system gets into touch exploration mode.
|
int |
flags
This field represents a set of flags used for configuring an
AccessibilityService . |
long |
notificationTimeout
The timeout after the most recent event of a given type before an
AccessibilityService is notified. |
String[] |
packageNames
The package names an
AccessibilityService is interested in. |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
AccessibilityServiceInfo()
Creates a new instance.
|
AccessibilityServiceInfo(ResolveInfo resolveInfo,
Context context)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
|
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.
|
boolean |
getCanRetrieveWindowContent()
Whether this service can retrieve the current window's content.
|
String |
getDescription()
Deprecated.
|
String |
getId()
The accessibility service id.
|
ResolveInfo |
getResolveInfo()
The service
ResolveInfo . |
String |
getSettingsActivityName()
The settings activity name.
|
String |
loadDescription(PackageManager packageManager)
The localized description of the accessibility service.
|
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
void |
updateDynamicallyConfigurableProperties(AccessibilityServiceInfo other)
Updates the properties that an AccessibilitySerivice can change dynamically.
|
void |
writeToParcel(Parcel parcel,
int flagz)
Flatten this object in to a Parcel.
|
public static final int FEEDBACK_SPOKEN
public static final int FEEDBACK_HAPTIC
public static final int FEEDBACK_AUDIBLE
public static final int FEEDBACK_VISUAL
public static final int FEEDBACK_GENERIC
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
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
public int eventTypes
AccessibilityService
is interested in.
Can be dynamically set at runtime.
AccessibilityEvent.TYPE_VIEW_CLICKED
,
AccessibilityEvent.TYPE_VIEW_LONG_CLICKED
,
AccessibilityEvent.TYPE_VIEW_FOCUSED
,
AccessibilityEvent.TYPE_VIEW_SELECTED
,
AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED
,
AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
,
AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED
,
AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START
,
AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END
,
AccessibilityEvent.TYPE_VIEW_HOVER_ENTER
,
AccessibilityEvent.TYPE_VIEW_HOVER_EXIT
,
AccessibilityEvent.TYPE_VIEW_SCROLLED
,
AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED
,
AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
public String[] packageNames
AccessibilityService
is interested in. Setting
to null
is equivalent to all packages.
Can be dynamically set at runtime.
public int feedbackType
AccessibilityService
provides.
Can be dynamically set at runtime.
public long notificationTimeout
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.
public int flags
AccessibilityService
.
Can be dynamically set at runtime.
public static final Parcelable.Creator<AccessibilityServiceInfo> CREATOR
Parcelable.Creator
public AccessibilityServiceInfo()
public AccessibilityServiceInfo(ResolveInfo resolveInfo, Context context) throws XmlPullParserException, IOException
resolveInfo
- The service resolve info.context
- Context for accessing resources.XmlPullParserException
- If a XML parsing error occurs.IOException
- If a XML parsing error occurs.public void updateDynamicallyConfigurableProperties(AccessibilityServiceInfo other)
other
- The info from which to update the properties.public String getId()
Generated by the system.
public ResolveInfo getResolveInfo()
ResolveInfo
.
Generated by the system.
public String getSettingsActivityName()
Statically set from
meta-data
.
public boolean getCanRetrieveWindowContent()
Statically set from
meta-data
.
public String getDescription()
loadDescription(PackageManager)
.
Statically set from
meta-data
.
public String loadDescription(PackageManager packageManager)
Statically set from
meta-data
.
public int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel parcel, int flagz)
Parcelable
writeToParcel
in interface Parcelable
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.PARCELABLE_WRITE_RETURN_VALUE
.public String toString()
Object
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
public static String feedbackTypeToString(int feedbackType)
FEEDBACK_SPOKEN
is represented by the string FEEDBACK_SPOKEN.feedbackType
- The feedback type.