diff --git a/api/@ohos.accessibility.config.d.ts b/api/@ohos.accessibility.config.d.ts index 2dfac6d56a12e8b0f7d6f5389a8e05bf6d719822..cbb2721498f794bda3d97171ea19f8e9e3989368 100644 --- a/api/@ohos.accessibility.config.d.ts +++ b/api/@ohos.accessibility.config.d.ts @@ -77,13 +77,20 @@ declare namespace config { * Enable the accessibility extension ability. * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. * @param capability Indicates the ability. + * @throws {BusinessError} 如果没有设置属性的权限. + * @throws {BusinessError} 如果包名不正确或者不存在. + * @throws {BusinessError} 如果该扩展已经使能. + * @throws {BusinessError} 如果callback参数类型错误。 */ function enableAbility(name: string, capability: Array): Promise; function enableAbility(name: string, capability: Array, callback: AsyncCallback): void; /** - * Disable the accessibility extension ability. + * Disable the accessibility exte+nsion ability. * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @throws {BusinessError} 如果没有设置属性的权限. + * @throws {BusinessError} 如果包名不正确或者不存在. + * @throws {BusinessError} 如果callback参数类型错误. */ function disableAbility(name: string): Promise; function disableAbility(name: string, callback: AsyncCallback): void; @@ -92,15 +99,18 @@ declare namespace config { * Register the listener that watches for changes in the enabled status of accessibility extensions. * @param type Indicates the enableAbilityListsStateChanged type. * @param callback Indicates the listener. + * @throws {BusinessError} 如果callback参数类型错误。 */ - function on(type: 'enableAbilityListsStateChanged', callback: Callback): void; + function on(type: 'enabledAccessibilityExtensionListChange', callback: Callback): void; + // 变更理由:原方法名有问题,不合适。 /** * Deregister listener that watches for changes in the enabled status of accessibility extensions. * @param type Indicates the enableAbilityListsStateChanged type. * @param callback Indicates the listener. + * @throws {BusinessError} 如果callback参数类型错误。 */ - function off(type: 'enableAbilityListsStateChanged', callback?: Callback): void; + function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback): void; /** * Indicates setting, getting, and listening to changes in configuration. @@ -109,12 +119,16 @@ declare namespace config { /** * Setting configuration value. * @param value Indicates the value. + * @throws {BusinessError} 如果没有设置属性的权限. + * @throws {BusinessError} 如果callback参数类型错误。 */ set(value: T): Promise; set(value: T, callback: AsyncCallback): void; /** * Getting configuration value. + * @throws {BusinessError} 如果没有获取属性的权限. + * @throws {BusinessError} 如果callback参数类型错误。 */ get(): Promise; get(callback: AsyncCallback): void; @@ -122,12 +136,15 @@ declare namespace config { /** * Register the listener to listen for configuration changes. * @param callback Indicates the listener. + * @throws {BusinessError} 如果没有获取属性的权限. + * @throws {BusinessError} 如果callback参数类型错误。 */ on(callback: Callback): void; /** * Deregister the listener to listen for configuration changes. * @param callback Indicates the listener. + * @throws {BusinessError} 如果callback参数类型错误。 */ off(callback?: Callback): void; } diff --git a/api/@ohos.accessibility.d.ts b/api/@ohos.accessibility.d.ts index 50f45c02511d3221390c5f66ef819796005be0cf..9a86be03a1bbf58cf58102100b54975314f18786 100644 --- a/api/@ohos.accessibility.d.ts +++ b/api/@ohos.accessibility.d.ts @@ -95,52 +95,78 @@ declare namespace accessibility { /** * Checks whether accessibility ability is enabled. * @since 7 + * @deprecated since 9 * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @return Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. - */ + */ function isOpenAccessibility(callback: AsyncCallback): void; function isOpenAccessibility(): Promise; + /** + * Checks whether accessibility ability is enabled. + * @since 9 + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @return Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. + * @throws {BusinessError} 如果callback参数类型错误。 + */ + function isAccessibilityExtensionEnabled(callback: AsyncCallback): void; + function isAccessibilityExtensionEnabled(): Promise; + /** * Checks touch browser ability (which is used by talkback) is enabled. * @since 7 + * @deprecated since 9 * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Vision * @return Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. - */ + */ function isOpenTouchGuide(callback: AsyncCallback): void; function isOpenTouchGuide(): Promise; + /** + * Checks touch browser ability (which is used by talkback) is enabled. + * @since 9 + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @return Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. + * @throws {BusinessError} 如果参数类型错误。 + */ + function isScreenReaderEnabled(callback: AsyncCallback): void; + function isScreenReaderEnabled(): Promise; + /** * Queries the list of accessibility abilities. * @since 7 + * @deprecated since 9 * @param abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed * @syscap SystemCapability.BarrierFree.Accessibility.Core * @return Returns the list of abilityInfos. - */ + */ function getAbilityLists(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; function getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise>; + /** * Queries the list of accessibility abilities. * @since 9 - * @param abilityType The all type of the accessibility ability. + * @param abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed * @syscap SystemCapability.BarrierFree.Accessibility.Core * @return Returns the list of abilityInfos. - */ - function getAbilityLists(abilityType: 'all', stateType: AbilityState, - callback: AsyncCallback>): void; - function getAbilityLists(abilityType: 'all', - stateType: AbilityState): Promise>; + * @throws {BusinessError} 如果abilityType或者stateType参数类型错误,callback参数类型错误 + */ + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise>; + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; /** * Send accessibility Event. * @since 7 + * @deprecated since 9 * @param event The object of the accessibility {@code EventInfo} . * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core @@ -149,9 +175,22 @@ declare namespace accessibility { function sendEvent(event: EventInfo, callback: AsyncCallback): void; function sendEvent(event: EventInfo): Promise; + /** + * Send accessibility Event. + * @since 9 + * @param event The object of the accessibility {@code EventInfo} . + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @return Returns {@code true} if success ; returns {@code false} otherwise. + * @throws {BusinessError} 如果event或者callback参数类型错误。 + */ + function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback): void; + function sendAccessibilityEvent(event: EventInfo): Promise; + /** * Register the observe of the accessibility state changed. * @since 7 + * @deprecated since 9 * @param type state event type. * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core @@ -159,9 +198,21 @@ declare namespace accessibility { */ function on(type: 'accessibilityStateChange', callback: Callback): void; + /** + * Register the observe of the accessibility extension enable state changed. + * @since 9 + * @param type state event type. + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @return Returns {@code true} if the register is success ; returns {@code false} otherwise. + * @throws {BusinessError} 如果callback参数类型错误。 + */ + function on(type: 'accessibilityExtensionEnableStateChange', callback: Callback): void; + /** * Register the observe of the touchGuide state changed. * @since 7 + * @deprecated since 9 * @param type state event type. * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Vision @@ -169,9 +220,21 @@ declare namespace accessibility { */ function on(type: 'touchGuideStateChange', callback: Callback): void; + /** + * Register the observe of the screen reader enable state changed. + * @since 9 + * @param type state event type. + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @return Returns {@code true} if the register is success ; returns {@code false} otherwise. + * @throws {BusinessError} 如果callback参数类型错误。 + */ + function on(type: 'screenReaderEnableStateChange', callback: Callback): void; + /** * Deregister the observe of the accessibility state changed. * @since 7 + * @deprecated since 9 * @param type state event type * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core @@ -179,15 +242,38 @@ declare namespace accessibility { */ function off(type: 'accessibilityStateChange', callback?: Callback): void; + + /** + * Deregister the observe of the accessibility extension enable state changed. + * @since 9 + * @param type state event type + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * @throws {BusinessError} 如果callback参数类型错误。 + */ + function off(type: 'accessibilityExtensionEnableStateChange', callback?: Callback): void; + /** * Deregister the observe of the touchGuide state changed. * @since 7 + * @deprecated since 9 * @param type state event type * @param callback Asynchronous callback interface. * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. */ function off(type: 'touchGuideStateChange', callback?: Callback): void; + /** + * Deregister the observe of the screen reader enable state changed. + * @since 9 + * @param type state event type + * @param callback Asynchronous callback interface. + * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * @throws {BusinessError} 如果callback参数类型错误。 + */ + function off(type: 'screenReaderEnableStateChange', callback?: Callback): void; + /** * Get the captions manager. * @syscap SystemCapability.BarrierFree.Accessibility.Hearing @@ -213,20 +299,49 @@ declare namespace accessibility { /** * Register the observe of the enable state. + * @deprecated since 9 */ on(type: 'enableChange', callback: Callback): void; + + /** + * Register the observe of the enable state. + * @since 9 + * @throws {BusinessError} 如果callback参数类型错误。 + */ + on(type: 'enableStateChange', callback: Callback): void; + /** * Register the observer of the style. + * @deprecated since 9 */ on(type: 'styleChange', callback: Callback): void; + + /** + * Register the observer of the style. + */ + on(type: 'captionsStyleChange', callback: Callback): void; + /** * Deregister the observe of the enable state. + * @deprecated since 9 */ off(type: 'enableChange', callback?: Callback): void; + + /** + * Deregister the observe of the enable state. + */ + off(type: 'enableStateChange', callback?: Callback): void; + /** * Deregister the observer of the style. + * @deprecated since 9 */ off(type: 'styleChange', callback?: Callback): void; + + /** + * Deregister the observer of the style. + */ + off(type: 'captionsStyleChange', callback?: Callback): void; } /** diff --git a/api/application/AccessibilityExtensionContext.d.ts b/api/application/AccessibilityExtensionContext.d.ts index 13522488182722a18ee7bef578b2c72ce56bda73..50a0acce9ab2f6591f6b0166846be9ee21c08421 100644 --- a/api/application/AccessibilityExtensionContext.d.ts +++ b/api/application/AccessibilityExtensionContext.d.ts @@ -28,6 +28,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Set the name of the bundle name that is interested in sending the event. * @param targetNames + * @throws {BusinessError} 如果callback参数类型错误。 */ setTargetBundleName(targetNames: Array): Promise; setTargetBundleName(targetNames: Array, callback: AsyncCallback): void; @@ -35,6 +36,8 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get focus element. * @param isAccessibilityFocus Indicates whether the acquired element has an accessibility focus. + * @throws {BusinessError} 如果用户没有给予执行该方法的权限。 + * @throws {BusinessError} 如果参数类型错误。 */ getFocusElement(isAccessibilityFocus?: boolean): Promise; getFocusElement(callback: AsyncCallback): void; @@ -43,6 +46,8 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get window root element. * @param windowId Indicates the window ID. + * @throws {BusinessError} 如果用户没有给予执行该方法的权限。 + * @throws {BusinessError} 如果参数类型错误。 */ getWindowRootElement(windowId?: number): Promise; getWindowRootElement(callback: AsyncCallback): void; @@ -51,6 +56,8 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get window list. * @param displayId Indicates the display ID. + * @throws {BusinessError} 如果用户没有给予执行该方法的权限。 + * @throws {BusinessError} 如果callback参数类型错误。 */ getWindows(displayId?: number): Promise>; getWindows(callback: AsyncCallback>): void; @@ -59,6 +66,8 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Inject gesture path events. * @param gesturePath Indicates the gesture path. + * @throws {BusinessError} 如果用户没有给予执行该方法的权限。 + * @throws {BusinessError} 如果callback参数类型错误。 */ injectGesture(gesturePath: GesturePath): Promise; injectGesture(gesturePath: GesturePath, callback: AsyncCallback): void; @@ -74,6 +83,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { declare interface AccessibilityElement { /** * Get a list of attribute names. + * @throws {BusinessError} 如果callback参数类型错误。 */ attributeNames(): Promise>; attributeNames(callback: AsyncCallback>): void; @@ -81,6 +91,8 @@ declare interface AccessibilityElement { /** * Get the value of an attribute. * @param attributeName Indicates the attribute name. + * @throws {BusinessError} 如果属性不存在。 + * @throws {BusinessError} 如果callback参数类型错误。 */ attributeValue(attributeName: T): Promise; attributeValue(attributeName: T, @@ -88,6 +100,7 @@ declare interface AccessibilityElement { /** * Get a list of supported actions. + * @throws {BusinessError} 如果callback参数类型错误。 */ actionNames(): Promise>; actionNames(callback: AsyncCallback>): void; @@ -96,15 +109,18 @@ declare interface AccessibilityElement { * Perform the specified action. * @param actionName Indicates the action name. * @param parameters Indicates the parameters needed to execute the action. + * @throws {BusinessError} 如果不支持该动作。 + * @throws {BusinessError} 如果callback参数类型错误。 */ - performAction(actionName: string, parameters?: object): Promise; - performAction(actionName: string, callback: AsyncCallback): void; - performAction(actionName: string, parameters: object, callback: AsyncCallback): void; + performAction(actionName: string, parameters?: object): Promise; + performAction(actionName: string, callback: AsyncCallback): void; + performAction(actionName: string, parameters: object, callback: AsyncCallback): void; /** * Find elements that match the condition. * @param type The type of query condition is content. * @param condition Indicates the specific content to be queried. + * @throws {BusinessError} 如果callback参数类型错误。 */ findElement(type: 'content', condition: string): Promise>; findElement(type: 'content', condition: string, callback: AsyncCallback>): void @@ -113,6 +129,7 @@ declare interface AccessibilityElement { * Find elements that match the condition. * @param type The type of query condition is focus type. * @param condition Indicates the type of focus to query. + * @throws {BusinessError} 如果callback参数类型错误。 */ findElement(type: 'focusType', condition: FocusType): Promise; findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback): void @@ -121,6 +138,7 @@ declare interface AccessibilityElement { * Find elements that match the condition. * @param type The type of query condition is focus direction. * @param condition Indicates the direction of search focus to query. + * @throws {BusinessError} 如果callback参数类型错误。 */ findElement(type: 'focusDirection', condition: FocusDirection): Promise; findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback): void