The **AccessibilityExtensionContext** module, inherited from **ExtensionContext**, provides context for **Accessibility Extension** abilities.
You can use the APIs of this module to configure the concerned information, obtain root information, and inject gestures.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
| windowId | number | No | Window for which you want to obtain the root element. If this parameter is not specified, it indicates the current active window.|
| displayId | number | No | Screen from which the window information is obtained. If this parameter is not specified, it indicates the default home screen.|
The **Accessibility** module implements the accessibility functions, including obtaining the accessibility application list, accessibility application enabled status, and captions configuration.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
...
...
@@ -13,162 +16,162 @@ import accessibility from '@ohos.accessibility';
Enumerates the states of an accessibility application.
| style | [CaptionsStyle](#captionsstyle8) | Yes| No| Style of captions.|
In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8)method to obtain a **captionsManager** instance, and then call the methods using the obtained instance.
In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8)API to obtain a **captionsManager** instance, and then call the methods using the obtained instance.
| callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Yes| Callback used to return the accessibility application list.|
@@ -430,12 +439,12 @@ Enables listening for the accessibility application or touch guide mode status c
-**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the event to listen for.<br>- **accessibilityStateChange** means to listen for enable status changes of the accessibility application.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Core<br>- **touchGuideStateChange** means to listen for enable status changes of the touch guide mode.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Vision |
| callback | Callback<boolean> | Yes | Callback invoked when the enable status changes. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to listen for.<br>- **'accessibilityStateChange'** means to listen for enabled status changes of the accessibility application.<br>**System capability**: SystemCapability.BarrierFree.Accessibility.Core<br>- **'touchGuideStateChange'** means to listen for enabled status changes of the touch guide mode.<br>**System capability**: SystemCapability.BarrierFree.Accessibility.Vision|
| callback | Callback<boolean> | Yes| Callback invoked when the enabled status of captions configuration changes.|
Disables listening for the accessibility application or touch guide mode status changes.
Disables listening for the accessibility application or touch guide mode status changes.
-**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | No | Type of the event to listen for.<br>- **accessibilityStateChange** means to listen for enable status changes of the accessibility application.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Core<br>- **touchGuideStateChange** means to listen for enable status changes of the touch guide mode.<br>**System capability**: SystemCapability.Barrierfree.Accessibility.Vision |
| callback | Callback<boolean> | No | Callback invoked when the enable status changes. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | No| Type of the event to listen for.<br>- **'accessibilityStateChange'** means to listen for enabled status changes of the accessibility application.<br>**System capability**: SystemCapability.BarrierFree.Accessibility.Core<br>- **'touchGuideStateChange'** means to listen for enabled status changes of the touch guide mode.<br>**System capability**: SystemCapability.BarrierFree.Accessibility.Vision|
| callback | Callback<boolean> | No| Callback invoked when the enabled status changes.|
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise.|
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise.|
The **AccessibilityExtensionAbility** module is based on the ExtensionAbility framework and provides the **AccessibilityExtensionAbility**.
>**NOTE**
>
>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>The APIs of this module can be used only in the stage model.
| touchBegin | A touch starts in touch guide mode.|
| touchEnd | A touch ends in touch guide mode.|
## AccessibilityExtensionAbility.onConnect
onConnect(): void;
Called when the **AccessibilityExtensionAbility** is enabled and connected to the system service. In this API, you can initialize service logic. This API can be overridden as required.
Called when the **AccessibilityExtensionAbility** is disabled and disconnected from the system service. In this API, you can implement the service logic of resource release and exit. This API can be overridden as required.
Called when an event that matches the specified bundle and event type occurs. In this API, you can implement event-specific service logic. Generally, this API needs to be overridden.