to top
Android APIs
public class

AccessibilityServiceInfo

extends Object
implements Parcelable
java.lang.Object
   ↳ android.accessibilityservice.AccessibilityServiceInfo

Class Overview

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.

Summary

Constants
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_REQUEST_TOUCH_EXPLORATION_MODE This flag requests that the system gets into touch exploration mode.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<AccessibilityServiceInfo> CREATOR
public int eventTypes The event types an AccessibilityService is interested in.
public int feedbackType The feedback type an AccessibilityService provides.
public int flags This field represents a set of flags used for configuring an AccessibilityService.
public long notificationTimeout The timeout 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
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()
This method was deprecated in API level 16. Use loadDescription(PackageManager).
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 writeToParcel(Parcel parcel, int flagz)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int DEFAULT

Added in API level 4

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)

public static final int FEEDBACK_ALL_MASK

Added in API level 14

Mask for all feedback types.

Constant Value: -1 (0xffffffff)

public static final int FEEDBACK_AUDIBLE

Added in API level 4

Denotes audible (not spoken) feedback.

Constant Value: 4 (0x00000004)

public static final int FEEDBACK_BRAILLE

Added in API level 17

Denotes braille feedback.

Constant Value: 32 (0x00000020)

public static final int FEEDBACK_GENERIC

Added in API level 4

Denotes generic feedback.

Constant Value: 16 (0x00000010)

public static final int FEEDBACK_HAPTIC

Added in API level 4

Denotes haptic feedback.

Constant Value: 2 (0x00000002)

public static final int FEEDBACK_SPOKEN

Added in API level 4

Denotes spoken feedback.

Constant Value: 1 (0x00000001)

public static final int FEEDBACK_VISUAL

Added in API level 4

Denotes visual feedback.

Constant Value: 8 (0x00000008)

public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS

Added in API level 16

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 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 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 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.

Constant Value: 2 (0x00000002)

public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE

Added in API level 16

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.

Constant Value: 4 (0x00000004)

Fields

public static final Creator<AccessibilityServiceInfo> CREATOR

Added in API level 4

public int feedbackType

Added in API level 4

The feedback type an AccessibilityService provides.

Can be dynamically set at runtime.

public int flags

Added in API level 4

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

Can be dynamically set at runtime.

public long notificationTimeout

Added in API level 4

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.

public String[] packageNames

Added in API level 4

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

Can be dynamically set at runtime.

Public Constructors

public AccessibilityServiceInfo ()

Added in API level 4

Creates a new instance.

Public Methods

public int describeContents ()

Added in API level 4

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

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public static String feedbackTypeToString (int feedbackType)

Added in API level 14

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

Parameters
feedbackType The feedback type.
Returns
  • The string representation.

public static String flagToString (int flag)

Added in API level 14

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

Parameters
flag The flag.
Returns
  • The string representation.

public boolean getCanRetrieveWindowContent ()

Added in API level 14

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

Statically set from meta-data.

Returns
  • True if window content can be retrieved.

public String getDescription ()

Added in API level 14

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.

Returns
  • The description.

public String getId ()

Added in API level 14

The accessibility service id.

Generated by the system.

Returns
  • The id.

public ResolveInfo getResolveInfo ()

Added in API level 14

The service ResolveInfo.

Generated by the system.

Returns
  • The info.

public String getSettingsActivityName ()

Added in API level 14

The settings activity name.

Statically set from meta-data.

Returns
  • The settings activity name.

public String loadDescription (PackageManager packageManager)

Added in API level 16

The localized description of the accessibility service.

Statically set from meta-data.

Returns
  • The localized description.

public String toString ()

Added in API level 4

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.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel parcel, int flagz)

Added in API level 4

Flatten this object in to a Parcel.

Parameters
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.