public final class AccessibilityManager extends Object
AccessibilityEvent
s,
and provides facilities for querying the accessibility state of the system.
Accessibility events are generated when something notable happens in the user interface,
for example an Activity
starts, the focus or selection of a
View
changes etc. Parties interested in handling accessibility
events implement and register an accessibility service which extends
AccessibilityService
.
To obtain a handle to the accessibility manager do the following:
AccessibilityManager accessibilityManager =
(AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
Modifier and Type | Class and Description |
---|---|
static interface |
AccessibilityManager.AccessibilityStateChangeListener
Listener for the system accessibility state.
|
static interface |
AccessibilityManager.HighTextContrastChangeListener
Listener for the system high text contrast state.
|
static interface |
AccessibilityManager.TouchExplorationStateChangeListener
Listener for the system touch exploration state.
|
Modifier and Type | Field and Description |
---|---|
static int |
AUTOCLICK_DELAY_DEFAULT |
static int |
DALTONIZER_CORRECT_DEUTERANOMALY |
static int |
DALTONIZER_DISABLED |
static int |
DALTONIZER_SIMULATE_MONOCHROMACY |
static int |
STATE_FLAG_ACCESSIBILITY_ENABLED |
static int |
STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED |
static int |
STATE_FLAG_TOUCH_EXPLORATION_ENABLED |
Constructor and Description |
---|
AccessibilityManager(Context context,
IAccessibilityManager service,
int userId)
Create an instance.
|
public static final int STATE_FLAG_ACCESSIBILITY_ENABLED
public static final int STATE_FLAG_TOUCH_EXPLORATION_ENABLED
public static final int STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED
public static final int DALTONIZER_DISABLED
public static final int DALTONIZER_SIMULATE_MONOCHROMACY
public static final int DALTONIZER_CORRECT_DEUTERANOMALY
public static final int AUTOCLICK_DELAY_DEFAULT
public static AccessibilityManager getInstance(Context context)
context
- Context in which this manager operates.public IAccessibilityManagerClient getClient()
public boolean isEnabled()
public boolean isTouchExplorationEnabled()
public boolean isHighTextContrastEnabled()
Note: You need to query this only if you application is doing its own rendering and does not rely on the platform rendering pipeline.
public void sendAccessibilityEvent(AccessibilityEvent event)
AccessibilityEvent
.event
- The event to send.IllegalStateException
- if accessibility is not enabled.
Note: The preferred mechanism for sending custom accessibility
events is through calling
ViewParent.requestSendAccessibilityEvent(View, AccessibilityEvent)
instead of this method to allow predecessors to augment/filter events sent by
their descendants.public void interrupt()
@Deprecated public List<ServiceInfo> getAccessibilityServiceList()
getInstalledAccessibilityServiceList()
ServiceInfo
s of the installed accessibility services.ServiceInfo
s.public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList()
AccessibilityServiceInfo
s of the installed accessibility services.AccessibilityServiceInfo
s.public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackTypeFlags)
AccessibilityServiceInfo
s of the enabled accessibility services
for a given feedback type.feedbackTypeFlags
- The feedback type flags.AccessibilityServiceInfo
s.AccessibilityServiceInfo.FEEDBACK_AUDIBLE
,
AccessibilityServiceInfo.FEEDBACK_GENERIC
,
AccessibilityServiceInfo.FEEDBACK_HAPTIC
,
AccessibilityServiceInfo.FEEDBACK_SPOKEN
,
AccessibilityServiceInfo.FEEDBACK_VISUAL
,
AccessibilityServiceInfo.FEEDBACK_BRAILLE
public boolean addAccessibilityStateChangeListener(AccessibilityManager.AccessibilityStateChangeListener listener)
AccessibilityManager.AccessibilityStateChangeListener
for changes in
the global accessibility state of the system.listener
- The listener.public boolean removeAccessibilityStateChangeListener(AccessibilityManager.AccessibilityStateChangeListener listener)
AccessibilityManager.AccessibilityStateChangeListener
.listener
- The listener.public boolean addTouchExplorationStateChangeListener(AccessibilityManager.TouchExplorationStateChangeListener listener)
AccessibilityManager.TouchExplorationStateChangeListener
for changes in
the global touch exploration state of the system.listener
- The listener.public boolean removeTouchExplorationStateChangeListener(AccessibilityManager.TouchExplorationStateChangeListener listener)
AccessibilityManager.TouchExplorationStateChangeListener
.listener
- The listener.public boolean addHighTextContrastStateChangeListener(AccessibilityManager.HighTextContrastChangeListener listener)
AccessibilityManager.HighTextContrastChangeListener
for changes in
the global high text contrast state of the system.listener
- The listener.public boolean removeHighTextContrastStateChangeListener(AccessibilityManager.HighTextContrastChangeListener listener)
AccessibilityManager.HighTextContrastChangeListener
.listener
- The listener.public int addAccessibilityInteractionConnection(IWindow windowToken, IAccessibilityInteractionConnection connection)
windowToken
- The window token to which a connection is added.connection
- The connection.public void removeAccessibilityInteractionConnection(IWindow windowToken)
windowToken
- The window token to which a connection is removed.