From 467667c4fbb427af99e39a140c476363d25b2df9 Mon Sep 17 00:00:00 2001 From: laiguizhong Date: Tue, 18 Oct 2022 20:02:05 +0800 Subject: [PATCH] =?UTF-8?q?fixed=206d1f799=20from=20https://gitee.com/mupc?= =?UTF-8?q?eet/interface=5Fsdk-js/pulls/3044=20Revert=20"!3040=20=E5=9B=9E?= =?UTF-8?q?=E9=80=80=20'Pull=20Request=20!3013=20:=20=E6=97=A0=E9=9A=9C?= =?UTF-8?q?=E7=A2=8D=E5=A2=9E=E5=BC=BA=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=94=99=E8=AF=AF=E7=A0=81'"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 82e61d0de23b7dbc1edbf38094b79ac2348c87d0, reversing changes made to 5e281f7b65ead4e452bd564193c6169decdae0dc. Signed-off-by: laiguizhong --- api/@ohos.accessibility.config.d.ts | 24 ++++-- api/@ohos.accessibility.d.ts | 73 ++++++++++++++----- .../AccessibilityExtensionContext.d.ts | 19 ++++- 3 files changed, 87 insertions(+), 29 deletions(-) diff --git a/api/@ohos.accessibility.config.d.ts b/api/@ohos.accessibility.config.d.ts index 2dfac6d56a..690c702cff 100644 --- a/api/@ohos.accessibility.config.d.ts +++ b/api/@ohos.accessibility.config.d.ts @@ -77,6 +77,10 @@ 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 } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. + * @throws { BusinessError } 9300002 - Target ability already enabled. */ function enableAbility(name: string, capability: Array): Promise; function enableAbility(name: string, capability: Array, callback: AsyncCallback): void; @@ -84,23 +88,28 @@ declare namespace config { /** * Disable the accessibility extension ability. * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. */ function disableAbility(name: string): Promise; function disableAbility(name: string, callback: AsyncCallback): void; /** * Register the listener that watches for changes in the enabled status of accessibility extensions. - * @param type Indicates the enableAbilityListsStateChanged type. + * @param type Indicates the type of event. * @param callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. */ - 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. + * Unregister listener that watches for changes in the enabled status of accessibility extensions. + * @param type Indicates the type of event. * @param callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. */ - function off(type: 'enableAbilityListsStateChanged', callback?: Callback): void; + function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback): void; /** * Indicates setting, getting, and listening to changes in configuration. @@ -109,6 +118,8 @@ declare namespace config { /** * Setting configuration value. * @param value Indicates the value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameter error. */ set(value: T): Promise; set(value: T, callback: AsyncCallback): void; @@ -122,11 +133,12 @@ declare namespace config { /** * Register the listener to listen for configuration changes. * @param callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. */ on(callback: Callback): void; /** - * Deregister the listener to listen for configuration changes. + * Unregister the listener to listen for configuration changes. * @param callback Indicates the listener. */ off(callback?: Callback): void; diff --git a/api/@ohos.accessibility.d.ts b/api/@ohos.accessibility.d.ts index 50f45c0251..8b5b372e0a 100644 --- a/api/@ohos.accessibility.d.ts +++ b/api/@ohos.accessibility.d.ts @@ -24,13 +24,19 @@ import { Callback } from './basic'; * @import basic,abilityInfo */ declare namespace accessibility { - /** * The type of the Ability app. + * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' } * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ - type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual'; + /** + * The type of the Ability app. + * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all' } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all'; /** * The action that the ability can execute. @@ -98,7 +104,7 @@ declare namespace accessibility { * @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; @@ -108,7 +114,7 @@ declare namespace accessibility { * @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; @@ -119,24 +125,26 @@ declare namespace accessibility { * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed * @syscap SystemCapability.BarrierFree.Accessibility.Core * @return Returns the list of abilityInfos. - */ + * @deprecated since 9 + * @useinstead ohos.accessibility#getAccessibilityExtensionList + */ 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 } 401 - Input parameter error. + */ + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise>; + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; /** * Send accessibility Event. @@ -145,46 +153,64 @@ declare namespace accessibility { * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @return Returns {@code true} if success ; returns {@code false} otherwise. + * @deprecated since 9 + * @useinstead ohos.accessibility#sendAccessibilityEvent */ function sendEvent(event: EventInfo, callback: AsyncCallback): void; function sendEvent(event: EventInfo): Promise; /** - * Register the observe of the accessibility state changed. + * 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 } 401 - Input parameter error. + */ + function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback): void; + function sendAccessibilityEvent(event: EventInfo): Promise; + + /** + * Register the observer of the accessibility state changed. * @since 7 * @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 } 401 - Input parameter error. */ function on(type: 'accessibilityStateChange', callback: Callback): void; /** - * Register the observe of the touchGuide state changed. + * Register the observer of the touchGuide state changed. * @since 7 * @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 } 401 - Input parameter error. */ function on(type: 'touchGuideStateChange', callback: Callback): void; /** - * Deregister the observe of the accessibility state changed. + * Unregister the observer of the accessibility state changed. * @since 7 * @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. + * @return Returns {@code true} if the Unregister is success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. */ function off(type: 'accessibilityStateChange', callback?: Callback): void; /** - * Deregister the observe of the touchGuide state changed. + * Unregister the observer of the touchGuide state changed. * @since 7 * @param type state event type * @param callback Asynchronous callback interface. - * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * @return Returns {@code true} if the Unregister is success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. */ function off(type: 'touchGuideStateChange', callback?: Callback): void; @@ -212,19 +238,26 @@ declare namespace accessibility { style: CaptionsStyle; /** - * Register the observe of the enable state. + * Register the observer of the enable state. + * @throws { BusinessError } 401 - Input parameter error. */ on(type: 'enableChange', callback: Callback): void; + /** * Register the observer of the style. + * @throws { BusinessError } 401 - Input parameter error. */ on(type: 'styleChange', callback: Callback): void; + /** - * Deregister the observe of the enable state. + * Unregister the observer of the enable state. + * @throws { BusinessError } 401 - Input parameter error. */ off(type: 'enableChange', callback?: Callback): void; + /** - * Deregister the observer of the style. + * Unregister the observer of the style. + * @throws { BusinessError } 401 - Input parameter error. */ off(type: 'styleChange', callback?: Callback): void; } diff --git a/api/application/AccessibilityExtensionContext.d.ts b/api/application/AccessibilityExtensionContext.d.ts index 76ee1b0e0b..d3c38cddde 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 } 401 - Input parameter error. */ setTargetBundleName(targetNames: Array): Promise; setTargetBundleName(targetNames: Array, callback: AsyncCallback): void; @@ -35,6 +36,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get focus element. * @param isAccessibilityFocus Indicates whether the acquired element has an accessibility focus. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ getFocusElement(isAccessibilityFocus?: boolean): Promise; getFocusElement(callback: AsyncCallback): void; @@ -43,6 +45,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get window root element. * @param windowId Indicates the window ID. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ getWindowRootElement(windowId?: number): Promise; getWindowRootElement(callback: AsyncCallback): void; @@ -51,6 +54,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get window list. * @param displayId Indicates the display ID. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ getWindows(displayId?: number): Promise>; getWindows(callback: AsyncCallback>): void; @@ -59,6 +63,8 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Inject gesture path events. * @param gesturePath Indicates the gesture path. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ injectGesture(gesturePath: GesturePath): Promise; injectGesture(gesturePath: GesturePath, callback: AsyncCallback): void; @@ -81,6 +87,8 @@ declare interface AccessibilityElement { /** * Get the value of an attribute. * @param attributeName Indicates the attribute name. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300004 - This property does not exist. */ attributeValue(attributeName: T): Promise; attributeValue(attributeName: T, @@ -96,15 +104,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 } 401 - Input parameter error. + * @throws { BusinessError } 9300005 - This action is not supported. */ - 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 } 401 - Input parameter error. */ findElement(type: 'content', condition: string): Promise>; findElement(type: 'content', condition: string, callback: AsyncCallback>): void @@ -113,6 +124,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 } 401 - Input parameter error. */ findElement(type: 'focusType', condition: FocusType): Promise; findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback): void @@ -121,6 +133,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 } 401 - Input parameter error. */ findElement(type: 'focusDirection', condition: FocusDirection): Promise; findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback): void -- Gitee