• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License"),
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file Provides accessibility extension context
18 * @kit AccessibilityKit
19 */
20
21import type { AsyncCallback, BusinessError, Callback } from '../@ohos.base';
22import ExtensionContext from './ExtensionContext';
23import type accessibility from '../@ohos.accessibility';
24import type { GesturePath } from '../@ohos.accessibility.GesturePath';
25import type Want from '../@ohos.app.ability.Want';
26import { AccessibilityAction } from '../@ohos.accessibility';
27
28/**
29 * The accessibility extension context. Used to configure, query information, and inject gestures.
30 *
31 * @extends ExtensionContext
32 * @syscap SystemCapability.BarrierFree.Accessibility.Core
33 * @since 9
34 */
35export default class AccessibilityExtensionContext extends ExtensionContext {
36  /**
37   * Set the bundle names that is interested in sending the event.
38   *
39   * @param { Array<string> } targetNames The bundle names that are interested in sending the event.
40   * @param { AsyncCallback<void> } callback Indicates the listener.
41   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
42   *     1. Mandatory parameters are left unspecified;
43   *     2. Incorrect parameter types;
44   *     3. Parameter verification failed.
45   * @syscap SystemCapability.BarrierFree.Accessibility.Core
46   * @since 9
47   * @deprecated since 12
48   */
49  setTargetBundleName(targetNames: Array<string>, callback: AsyncCallback<void>): void;
50
51  /**
52   * Set the bundle names that is interested in sending the event.
53   *
54   * @param { Array<string> } targetNames The bundle names that are interested in sending the event.
55   * @returns { Promise<void> }
56   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
57   *     1. Mandatory parameters are left unspecified;
58   *     2. Incorrect parameter types;
59   *     3. Parameter verification failed.
60   * @syscap SystemCapability.BarrierFree.Accessibility.Core
61   * @since 9
62   * @deprecated since 12
63   */
64  setTargetBundleName(targetNames: Array<string>): Promise<void>;
65
66  /**
67   * Get focus element.
68   *
69   * @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus.
70   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
71   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
72   *     1. Mandatory parameters are left unspecified;
73   *     2. Incorrect parameter types;
74   *     3. Parameter verification failed.
75   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
76   * @syscap SystemCapability.BarrierFree.Accessibility.Core
77   * @since 9
78   * @deprecated since 12
79   */
80  getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback<AccessibilityElement>): void;
81
82  /**
83   * Get focus element.
84   *
85   * @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus.
86   * @returns { Promise<AccessibilityElement> }
87   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
88   *     1. Mandatory parameters are left unspecified;
89   *     2. Incorrect parameter types;
90   *     3. Parameter verification failed.
91   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
92   * @syscap SystemCapability.BarrierFree.Accessibility.Core
93   * @since 9
94   * @deprecated since 12
95   */
96  getFocusElement(isAccessibilityFocus?: boolean): Promise<AccessibilityElement>;
97
98  /**
99   * Get focus element.
100   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
101   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
102   *     1. Mandatory parameters are left unspecified;
103   *     2. Incorrect parameter types;
104   *     3. Parameter verification failed.
105   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
106   * @syscap SystemCapability.BarrierFree.Accessibility.Core
107   * @since 9
108   * @deprecated since 12
109   */
110  getFocusElement(callback: AsyncCallback<AccessibilityElement>): void;
111
112  /**
113   * Get window root element.
114   *
115   * @param { number } windowId Indicates the window ID.
116   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
117   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
118   *     1. Mandatory parameters are left unspecified;
119   *     2. Incorrect parameter types;
120   *     3. Parameter verification failed.
121   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
122   * @syscap SystemCapability.BarrierFree.Accessibility.Core
123   * @since 9
124   * @deprecated since 12
125   */
126  getWindowRootElement(windowId: number, callback: AsyncCallback<AccessibilityElement>): void;
127
128  /**
129   * Get window root element.
130   *
131   * @param { number } [windowId] Indicates the window ID.
132   * @returns { Promise<AccessibilityElement> }
133   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
134   *     1. Mandatory parameters are left unspecified;
135   *     2. Incorrect parameter types;
136   *     3. Parameter verification failed.
137   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
138   * @syscap SystemCapability.BarrierFree.Accessibility.Core
139   * @since 9
140   * @deprecated since 12
141   */
142  getWindowRootElement(windowId?: number): Promise<AccessibilityElement>;
143
144  /**
145   * Get window root element.
146   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
147   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
148   *     1. Mandatory parameters are left unspecified;
149   *     2. Incorrect parameter types;
150   *     3. Parameter verification failed.
151   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
152   * @syscap SystemCapability.BarrierFree.Accessibility.Core
153   * @since 9
154   * @deprecated since 12
155   */
156  getWindowRootElement(callback: AsyncCallback<AccessibilityElement>): void;
157
158  /**
159   * Get window list.
160   *
161   * @param { number } displayId Indicates the display ID.
162   * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
163   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
164   *     1. Mandatory parameters are left unspecified;
165   *     2. Incorrect parameter types;
166   *     3. Parameter verification failed.
167   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
168   * @syscap SystemCapability.BarrierFree.Accessibility.Core
169   * @since 9
170   * @deprecated since 12
171   */
172  getWindows(displayId: number, callback: AsyncCallback<Array<AccessibilityElement>>): void;
173
174  /**
175   * Get window list.
176   *
177   * @param { number } displayId Indicates the display ID.
178   * @returns { Promise<Array<AccessibilityElement>> }
179   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
180   *     1. Mandatory parameters are left unspecified;
181   *     2. Incorrect parameter types;
182   *     3. Parameter verification failed.
183   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
184   * @syscap SystemCapability.BarrierFree.Accessibility.Core
185   * @since 9
186   * @deprecated since 12
187   */
188  getWindows(displayId?: number): Promise<Array<AccessibilityElement>>;
189
190  /**
191   * Get window list.
192   * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
193   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
194   *     1. Mandatory parameters are left unspecified;
195   *     2. Incorrect parameter types;
196   *     3. Parameter verification failed.
197   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
198   * @syscap SystemCapability.BarrierFree.Accessibility.Core
199   * @since 9
200   * @deprecated since 12
201   */
202  getWindows(callback: AsyncCallback<Array<AccessibilityElement>>): void;
203
204  /**
205   * Inject gesture path events.
206   *
207   * @param { GesturePath } gesturePath Indicates the gesture path.
208   * @param { AsyncCallback<void> } callback Indicates the listener.
209   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
210   *     1. Mandatory parameters are left unspecified;
211   *     2. Incorrect parameter types;
212   *     3. Parameter verification failed.
213   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
214   * @syscap SystemCapability.BarrierFree.Accessibility.Core
215   * @since 9
216   * @deprecated since 10
217   * @useinstead AccessibilityExtensionContext/AccessibilityExtensionContext#injectGestureSync
218   */
219  injectGesture(gesturePath: GesturePath, callback: AsyncCallback<void>): void;
220
221  /**
222   * Inject gesture path events.
223   *
224   * @param { GesturePath } gesturePath Indicates the gesture path.
225   * @returns { Promise<void> }
226   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
227   *     1. Mandatory parameters are left unspecified;
228   *     2. Incorrect parameter types;
229   *     3. Parameter verification failed.
230   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
231   * @syscap SystemCapability.BarrierFree.Accessibility.Core
232   * @since 9
233   * @deprecated since 10
234   * @useinstead AccessibilityExtensionContext/AccessibilityExtensionContext#injectGestureSync
235   */
236  injectGesture(gesturePath: GesturePath): Promise<void>;
237
238  /**
239   * Inject gesture path events.
240   *
241   * @param { GesturePath } gesturePath Indicates the gesture path.
242   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
243   *     1. Mandatory parameters are left unspecified;
244   *     2. Incorrect parameter types;
245   *     3. Parameter verification failed.
246   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
247   * @syscap SystemCapability.BarrierFree.Accessibility.Core
248   * @since 10
249   * @deprecated since 12
250   */
251  injectGestureSync(gesturePath: GesturePath): void;
252
253  /**
254   * Starts a new ability.
255   *
256   * @param { Want } want - Indicates the start options.
257   * @returns { Promise<void> }
258   * @throws { BusinessError } 201 - The application does not have the permission required to call the API.
259   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
260   *     1. Mandatory parameters are left unspecified;
261   *     2. Incorrect parameter types;
262   *     3. Parameter verification failed.
263   * @syscap SystemCapability.BarrierFree.Accessibility.Core
264   * @systemapi
265   * @since 12
266   */
267  startAbility(want: Want): Promise<void>;
268
269  /**
270   * get all subElements in window.
271   * @param { number } windowId Indicates the window ID.
272   * @param { number } elementId Indicates the elementId.
273   * @returns { Promise<Array<AccessibilityElement>> }
274   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
275   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
276   *    1. Mandatory parameters are left unspecified;
277   *    2. Incorrect parameter types;
278   *    3. Parameter verification failed.
279   * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
280   * @syscap SystemCapability.BarrierFree.Accessibility.Core
281   * @systemapi
282   * @since 18
283   */
284  getElements(windowId: number, elementId?: number): Promise<Array<AccessibilityElement>>;
285
286  /**
287   * Get default focused element ids.
288   * @param { number } windowId Indicates whether the windowid can be used as the default focus.
289   * @returns { Promise<Array<number>> }
290   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
291   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
292   *    1. Mandatory parameters are left unspecified;
293   *    2. Incorrect parameter types;
294   *    3. Parameter verification failed.
295   * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
296   * @syscap SystemCapability.BarrierFree.Accessibility.Core
297   * @systemapi
298   * @since 18
299   */
300  getDefaultFocusedElementIds(windowId: number): Promise<Array<number>>;
301
302  /**
303   * Hold running lock to prevent screen turning off automatically.
304   *
305   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
306   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
307   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
308   * @syscap SystemCapability.BarrierFree.Accessibility.Core
309   * @systemapi
310   * @since 20
311   */
312  holdRunningLockSync(): void;
313
314  /**
315   * Unhold running lock.
316   *
317   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
318   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
319   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
320   * @syscap SystemCapability.BarrierFree.Accessibility.Core
321   * @systemapi
322   * @since 20
323   */
324  unholdRunningLockSync(): void;
325
326  /**
327   * Register accessibilityExtensionAbility disconnect callback.
328   *
329   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
330   * @param { 'preDisconnect' } type Indicates the accessibilityExtensionAbility pre disconnect.
331   * @param { Callback<void> } callback Indicates the callback function.
332   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
333   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
334   * @syscap SystemCapability.BarrierFree.Accessibility.Core
335   * @systemapi
336   * @since 20
337   */
338  on(type: 'preDisconnect', callback: Callback<void>): void;
339
340  /**
341   * Unregister accessibilityExtensionAbility disconnect callback.
342   *
343   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
344   * @param { 'preDisconnect' } type Indicates the accessibilityExtensionAbility pre disconnect.
345   * @param { Callback<void> } callback Indicates the callback function.
346   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
347   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
348   * @syscap SystemCapability.BarrierFree.Accessibility.Core
349   * @systemapi
350   * @since 20
351   */
352  off(type: 'preDisconnect', callback?: Callback<void>): void;
353
354  /**
355   * Notify accessibility when accessibilityExtensionAbility is ready to disconnect.
356   *
357   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
358   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
359   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
360   * @syscap SystemCapability.BarrierFree.Accessibility.Core
361   * @systemapi
362   * @since 20
363   */
364  notifyDisconnect(): void;
365
366  /**
367   * Get accessibility focused element.
368   *
369   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
370   * @returns { Promise<AccessibilityElement> }
371   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
372   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
373   * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
374   * @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
375   * @syscap SystemCapability.BarrierFree.Accessibility.Core
376   * @systemapi
377   * @since 20
378   */
379  getAccessibilityFocusedElement(): Promise<AccessibilityElement>;
380
381  /**
382   * Get window root element.
383   *
384   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
385   * @param { number } [windowId] Indicates the window ID.
386   * @returns { Promise<AccessibilityElement> }
387   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
388   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
389   * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
390   * @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
391   * @syscap SystemCapability.BarrierFree.Accessibility.Core
392   * @systemapi
393   * @since 20
394   */
395  getRootInActiveWindow(windowId?: number): Promise<AccessibilityElement>;
396
397  /**
398   * Get window list.
399   *
400   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
401   * @param { number } [displayId] Indicates the display ID. If this parameter is not provided, indicates the default displayId.
402   * @returns { Array<AccessibilityElement> }
403   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
404   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
405   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
406   * @syscap SystemCapability.BarrierFree.Accessibility.Core
407   * @systemapi
408   * @since 20
409   */
410  getAccessibilityWindowsSync(displayId?: number): Array<AccessibilityElement>;
411}
412
413/**
414 * Indicates an accessibility element.
415 * Supports querying element attributes, requesting execution actions, and finding child elements by condition.
416 *
417 * @typedef AccessibilityElement
418 * @syscap SystemCapability.BarrierFree.Accessibility.Core
419 * @since 9
420 */
421declare interface AccessibilityElement {
422  /**
423   * Get a list of attribute names.
424   *
425   * @param { AsyncCallback<Array<T>> } callback Indicates the listener.
426   * @syscap SystemCapability.BarrierFree.Accessibility.Core
427   * @since 9
428   * @deprecated since 12
429   */
430  attributeNames<T extends keyof ElementAttributeValues>(callback: AsyncCallback<Array<T>>): void;
431
432  /**
433   * Get a list of attribute names.
434   * @returns { Promise<Array<T>> }
435   * @syscap SystemCapability.BarrierFree.Accessibility.Core
436   * @since 9
437   * @deprecated since 12
438   */
439  attributeNames<T extends keyof ElementAttributeValues>(): Promise<Array<T>>;
440
441  /**
442   * Get the value of an attribute.
443   *
444   * @param { T } attributeName Indicates the attribute name.
445   * @param { AsyncCallback<ElementAttributeValues[T]> } callback Indicates the listener.
446   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
447   *     1. Mandatory parameters are left unspecified;
448   *     2. Incorrect parameter types;
449   *     3. Parameter verification failed.
450   * @throws { BusinessError } 9300004 - This property does not exist.
451   * @syscap SystemCapability.BarrierFree.Accessibility.Core
452   * @since 9
453   * @deprecated since 12
454   */
455  attributeValue<T extends keyof ElementAttributeValues>(
456    attributeName: T,
457    callback: AsyncCallback<ElementAttributeValues[T]>
458  ): void;
459
460  /**
461   * Get the value of an attribute.
462   *
463   * @param { T } attributeName Indicates the attribute name.
464   * @returns { Promise<ElementAttributeValues[T]> }
465   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
466   *     1. Mandatory parameters are left unspecified;
467   *     2. Incorrect parameter types;
468   *     3. Parameter verification failed.
469   * @throws { BusinessError } 9300004 - This property does not exist.
470   * @syscap SystemCapability.BarrierFree.Accessibility.Core
471   * @since 9
472   * @deprecated since 12
473   */
474  attributeValue<T extends keyof ElementAttributeValues>(attributeName: T): Promise<ElementAttributeValues[T]>;
475
476  /**
477   * Get a list of supported actions.
478   *
479   * @param { AsyncCallback<Array<string>> } callback Indicates the listener.
480   * @syscap SystemCapability.BarrierFree.Accessibility.Core
481   * @since 9
482   * @deprecated since 12
483   */
484  actionNames(callback: AsyncCallback<Array<string>>): void;
485
486  /**
487   * Get a list of supported actions.
488   *
489   * @returns { Promise<Array<string>> }
490   * @syscap SystemCapability.BarrierFree.Accessibility.Core
491   * @since 9
492   * @deprecated since 12
493   */
494  actionNames(): Promise<Array<string>>;
495
496  /**
497   * Perform the specified action.
498   *
499   * @param { string } actionName Indicates the action name.
500   * @param { object } parameters Indicates the parameters needed to execute the action.
501   * @param { AsyncCallback<void> } callback Indicates the listener.
502   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
503   *     1. Mandatory parameters are left unspecified;
504   *     2. Incorrect parameter types;
505   *     3. Parameter verification failed.
506   * @throws { BusinessError } 9300005 - This action is not supported.
507   * @syscap SystemCapability.BarrierFree.Accessibility.Core
508   * @since 9
509   * @deprecated since 12
510   */
511  performAction(actionName: string, parameters: object, callback: AsyncCallback<void>): void;
512
513  /**
514   * Perform the specified action.
515   *
516   * @param { string } actionName Indicates the action name.
517   * @param { object } parameters Indicates the parameters needed to execute the action.
518   * @returns { Promise<void> }
519   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
520   *     1. Mandatory parameters are left unspecified;
521   *     2. Incorrect parameter types;
522   *     3. Parameter verification failed.
523   * @throws { BusinessError } 9300005 - This action is not supported.
524   * @syscap SystemCapability.BarrierFree.Accessibility.Core
525   * @since 9
526   * @deprecated since 12
527   */
528  performAction(actionName: string, parameters?: object): Promise<void>;
529
530  /**
531   * Perform the specified action.
532   *
533   * @param { string } actionName Indicates the action name.
534   * @param { AsyncCallback<void> } callback Indicates the listener.
535   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
536   *     1. Mandatory parameters are left unspecified;
537   *     2. Incorrect parameter types;
538   *     3. Parameter verification failed.
539   * @throws { BusinessError } 9300005 - This action is not supported.
540   * @syscap SystemCapability.BarrierFree.Accessibility.Core
541   * @since 9
542   * @deprecated since 12
543   */
544  performAction(actionName: string, callback: AsyncCallback<void>): void;
545
546  /**
547   * Get the position of cursor in TextInput.
548   *
549   * @param { AsyncCallback<number> } callback Indicates the listener.
550   * @syscap SystemCapability.BarrierFree.Accessibility.Core
551   * @systemapi
552   * @since 12
553   */
554  getCursorPosition(callback: AsyncCallback<number>): void;
555
556  /**
557   * Get the position of cursor in TextInput.
558   *
559   * @returns { Promise<number> }
560   * @syscap SystemCapability.BarrierFree.Accessibility.Core
561   * @systemapi
562   * @since 12
563   */
564  getCursorPosition(): Promise<number>;
565
566  /**
567   * Set the screen curtain enable or disable.
568   *
569   * @param { boolean } isEnable Indicates whether the screen curtain is enabled.
570   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
571   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
572   *     1. Mandatory parameters are left unspecified;
573   *     2. Incorrect parameter types;
574   *     3. Parameter verification failed.
575   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
576   * @syscap SystemCapability.BarrierFree.Accessibility.Core
577   * @systemapi
578   * @since 12
579   */
580  enableScreenCurtain(isEnable: boolean): void;
581
582  /**
583   * Find elements that match the condition.
584   *
585   * @param { 'content' } type The type of query condition is content.
586   * @param { string } condition Indicates the specific content to be queried.
587   * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
588   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
589   *     1. Mandatory parameters are left unspecified;
590   *     2. Incorrect parameter types;
591   *     3. Parameter verification failed.
592   * @syscap SystemCapability.BarrierFree.Accessibility.Core
593   * @since 9
594   * @deprecated since 12
595   */
596  findElement(type: 'content', condition: string, callback: AsyncCallback<Array<AccessibilityElement>>): void;
597
598  /**
599   * Find elements that match the condition.
600   *
601   * @param { 'content' } type The type of query condition is content.
602   * @param { string } condition Indicates the specific content to be queried.
603   * @returns { Promise<Array<AccessibilityElement>> }
604   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
605   *     1. Mandatory parameters are left unspecified;
606   *     2. Incorrect parameter types;
607   *     3. Parameter verification failed.
608   * @syscap SystemCapability.BarrierFree.Accessibility.Core
609   * @since 9
610   * @deprecated since 12
611   */
612  findElement(type: 'content', condition: string): Promise<Array<AccessibilityElement>>;
613
614  /**
615   * Find elements that match the condition.
616   *
617   * @param { 'focusType' } type The type of query condition is focus type.
618   * @param { FocusType } condition Indicates the type of focus to query.
619   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
620   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
621   *     1. Mandatory parameters are left unspecified;
622   *     2. Incorrect parameter types;
623   *     3. Parameter verification failed.
624   * @syscap SystemCapability.BarrierFree.Accessibility.Core
625   * @since 9
626   * @deprecated since 12
627   */
628  findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback<AccessibilityElement>): void;
629
630  /**
631   * Find elements that match the condition.
632   *
633   * @param { 'focusType' } type The type of query condition is focus type.
634   * @param { FocusType } condition Indicates the type of focus to query.
635   * @returns { Promise<AccessibilityElement> }
636   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
637   *     1. Mandatory parameters are left unspecified;
638   *     2. Incorrect parameter types;
639   *     3. Parameter verification failed.
640   * @syscap SystemCapability.BarrierFree.Accessibility.Core
641   * @since 9
642   * @deprecated since 12
643   */
644  findElement(type: 'focusType', condition: FocusType): Promise<AccessibilityElement>;
645
646  /**
647   * Find elements that match the condition.
648   *
649   * @param { 'focusDirection' } type The type of query condition is focus direction.
650   * @param { FocusDirection } condition Indicates the direction of search focus to query.
651   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
652   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
653   *     1. Mandatory parameters are left unspecified;
654   *     2. Incorrect parameter types;
655   *     3. Parameter verification failed.
656   * @syscap SystemCapability.BarrierFree.Accessibility.Core
657   * @since 9
658   * @deprecated since 12
659   */
660  findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback<AccessibilityElement>): void;
661
662  /**
663   * Find elements that match the condition.
664   *
665   * @param { 'focusDirection' } type The type of query condition is focus direction.
666   * @param { FocusDirection } condition Indicates the direction of search focus to query.
667   * @returns { Promise<AccessibilityElement> }
668   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
669   *     1. Mandatory parameters are left unspecified;
670   *     2. Incorrect parameter types;
671   *     3. Parameter verification failed.
672   * @syscap SystemCapability.BarrierFree.Accessibility.Core
673   * @since 9
674   * @deprecated since 12
675   */
676  findElement(type: 'focusDirection', condition: FocusDirection): Promise<AccessibilityElement>;
677
678  /**
679   * Find elements that match the condition.
680   *
681   * @param { 'textType' } type The type of query condition is text type.
682   * @param { string } condition Indicates the specific content to be queried.
683   * @returns { Promise<Array<AccessibilityElement>> }
684   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
685   *     1. Mandatory parameters are left unspecified;
686   *     2. Incorrect parameter types;
687   *     3. Parameter verification failed.
688   * @syscap SystemCapability.BarrierFree.Accessibility.Core
689   * @systemapi
690   * @since 12
691   */
692  findElement(type: 'textType', condition: string): Promise<Array<AccessibilityElement>>;
693
694  /**
695   * Find elements that match the condition.
696   *
697   * @param { 'elementId' } type The type of query condition is element id.
698   * @param { number } condition Indicates the specific content to be queried.
699   * @returns { Promise<AccessibilityElement> }
700   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
701   *     1. Mandatory parameters are left unspecified;
702   *     2. Incorrect parameter types;
703   *     3. Parameter verification failed.
704   * @syscap SystemCapability.BarrierFree.Accessibility.Core
705   * @systemapi
706   * @since 12
707   */
708  findElement(type: 'elementId', condition: number): Promise<AccessibilityElement>;
709
710  /**
711   * Indicates accessibility focus state.
712   *
713   * @type { ?boolean }
714   * @syscap SystemCapability.BarrierFree.Accessibility.Core
715   * @systemapi
716   * @since 20
717   */
718  accessibilityFocused?: boolean;
719
720  /**
721   * Indicates the bundle name to which it belongs.
722   *
723   * @type { ?string }
724   * @syscap SystemCapability.BarrierFree.Accessibility.Core
725   * @systemapi
726   * @since 20
727   */
728  bundleName?: string;
729
730  /**
731   * Indicates whether the element is checkable.
732   *
733   * @type { ?boolean }
734   * @syscap SystemCapability.BarrierFree.Accessibility.Core
735   * @systemapi
736   * @since 20
737   */
738  checkable?: boolean;
739
740  /**
741   * Indicates whether the element is checked.
742   *
743   * @type { ?boolean }
744   * @syscap SystemCapability.BarrierFree.Accessibility.Core
745   * @systemapi
746   * @since 20
747   */
748  checked?: boolean;
749
750  /**
751   * Indicates whether the element is clickable.
752   *
753   * @type { ?boolean }
754   * @syscap SystemCapability.BarrierFree.Accessibility.Core
755   * @systemapi
756   * @since 20
757   */
758  clickable?: boolean;
759
760  /**
761   * Indicates the component ID to which the element belongs.
762   *
763   * @type { ?number }
764   * @syscap SystemCapability.BarrierFree.Accessibility.Core
765   * @systemapi
766   * @since 20
767   */
768  componentId?: number;
769
770  /**
771   * Indicates the component type to which the element belongs.
772   *
773   * @type { ?string }
774   * @syscap SystemCapability.BarrierFree.Accessibility.Core
775   * @systemapi
776   * @since 20
777   */
778  componentType?: string;
779
780  /**
781   * Indicates the content.
782   *
783   * @type { ?Array<string> }
784   * @syscap SystemCapability.BarrierFree.Accessibility.Core
785   * @systemapi
786   * @since 20
787   */
788  contents?: Array<string>;
789
790  /**
791   * Indicates the index of the current item.
792   *
793   * @type { ?number }
794   * @syscap SystemCapability.BarrierFree.Accessibility.Core
795   * @systemapi
796   * @since 20
797   */
798  currentIndex?: number;
799
800  /**
801   * Indicates the description of the element.
802   *
803   * @type { ?string }
804   * @syscap SystemCapability.BarrierFree.Accessibility.Core
805   * @systemapi
806   * @since 20
807   */
808  description?: string;
809
810  /**
811   * Indicates whether the element is editable.
812   *
813   * @type { ?boolean }
814   * @syscap SystemCapability.BarrierFree.Accessibility.Core
815   * @systemapi
816   * @since 20
817   */
818  editable?: boolean;
819
820  /**
821   * Indicates the list index of the last item displayed on the screen.
822   *
823   * @type { ?number }
824   * @syscap SystemCapability.BarrierFree.Accessibility.Core
825   * @systemapi
826   * @since 20
827   */
828  endIndex?: number;
829
830  /**
831   * Indicates the string of error state.
832   *
833   * @type { ?string }
834   * @syscap SystemCapability.BarrierFree.Accessibility.Core
835   * @systemapi
836   * @since 20
837   */
838  error?: string;
839
840  /**
841   * Indicates whether the element is focusable.
842   *
843   * @type { ?boolean }
844   * @syscap SystemCapability.BarrierFree.Accessibility.Core
845   * @systemapi
846   * @since 20
847   */
848  focusable?: boolean;
849
850  /**
851   * Indicates the hint text.
852   *
853   * @type { ?string }
854   * @syscap SystemCapability.BarrierFree.Accessibility.Core
855   * @systemapi
856   * @since 20
857   */
858  hintText?: string;
859
860  /**
861   * Indicates the type of input text.
862   *
863   * @type { ?number }
864   * @syscap SystemCapability.BarrierFree.Accessibility.Core
865   * @systemapi
866   * @since 20
867   */
868  inputType?: number;
869
870  /**
871   * Indicates the inspector key.
872   *
873   * @type { ?string }
874   * @syscap SystemCapability.BarrierFree.Accessibility.Core
875   * @systemapi
876   * @since 20
877   */
878  inspectorKey?: string;
879
880  /**
881   * Indicates whether the element is active or not.
882   *
883   * @type { ?boolean }
884   * @syscap SystemCapability.BarrierFree.Accessibility.Core
885   * @systemapi
886   * @since 20
887   */
888  isActive?: boolean;
889
890  /**
891   * Indicates whether the element is enable or not.
892   *
893   * @type { ?boolean }
894   * @syscap SystemCapability.BarrierFree.Accessibility.Core
895   * @systemapi
896   * @since 20
897   */
898  isEnable?: boolean;
899
900  /**
901   * Indicates whether the element is hint state or not.
902   *
903   * @type { ?boolean }
904   * @syscap SystemCapability.BarrierFree.Accessibility.Core
905   * @systemapi
906   * @since 20
907   */
908  isHint?: boolean;
909
910  /**
911   * Indicates whether the element is focused or not.
912   *
913   * @type { ?boolean }
914   * @syscap SystemCapability.BarrierFree.Accessibility.Core
915   * @systemapi
916   * @since 20
917   */
918  isFocused?: boolean;
919
920  /**
921   * Indicates whether the element is password or not.
922   *
923   * @type { ?boolean }
924   * @syscap SystemCapability.BarrierFree.Accessibility.Core
925   * @systemapi
926   * @since 20
927   */
928  isPassword?: boolean;
929
930  /**
931   * Indicates whether the element is visible or not.
932   *
933   * @type { ?boolean }
934   * @syscap SystemCapability.BarrierFree.Accessibility.Core
935   * @systemapi
936   * @since 20
937   */
938  isVisible?: boolean;
939
940  /**
941   * Indicates the total count of the items.
942   *
943   * @type { ?number }
944   * @syscap SystemCapability.BarrierFree.Accessibility.Core
945   * @systemapi
946   * @since 20
947   */
948  itemCount?: number;
949
950  /**
951   * Indicates the last content.
952   *
953   * @type { ?string }
954   * @syscap SystemCapability.BarrierFree.Accessibility.Core
955   * @systemapi
956   * @since 20
957   */
958  lastContent?: string;
959
960  /**
961   * Indicates the display layer of the element.
962   *
963   * @type { ?number }
964   * @syscap SystemCapability.BarrierFree.Accessibility.Core
965   * @systemapi
966   * @since 20
967   */
968  layer?: number;
969
970  /**
971   * Indicates whether the element is long clickable.
972   *
973   * @type { ?boolean }
974   * @syscap SystemCapability.BarrierFree.Accessibility.Core
975   * @systemapi
976   * @since 20
977   */
978  longClickable?: boolean;
979
980  /**
981   * Indicates the page id.
982   *
983   * @type { ?number }
984   * @syscap SystemCapability.BarrierFree.Accessibility.Core
985   * @systemapi
986   * @since 20
987   */
988  pageId?: number;
989
990  /**
991   * Indicates whether the element supports multiple lines of text.
992   *
993   * @type { ?boolean }
994   * @syscap SystemCapability.BarrierFree.Accessibility.Core
995   * @systemapi
996   * @since 20
997   */
998  pluralLineSupported?: boolean;
999
1000  /**
1001   * Indicates the area of the element.
1002   *
1003   * @type { ?Rect }
1004   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1005   * @systemapi
1006   * @since 20
1007   */
1008  rect?: Rect;
1009
1010  /**
1011   * Indicates the resource name of the element.
1012   *
1013   * @type { ?string }
1014   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1015   * @systemapi
1016   * @since 20
1017   */
1018  resourceName?: string;
1019
1020  /**
1021   * Indicates the display area of the element.
1022   *
1023   * @type { ?Rect }
1024   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1025   * @systemapi
1026   * @since 20
1027   */
1028  screenRect?: Rect;
1029
1030  /**
1031   * Indicates whether the element is scrollable.
1032   *
1033   * @type { ?boolean }
1034   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1035   * @systemapi
1036   * @since 20
1037   */
1038  scrollable?: boolean;
1039
1040  /**
1041   * Indicates whether the element is selected.
1042   *
1043   * @type { ?boolean }
1044   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1045   * @systemapi
1046   * @since 20
1047   */
1048  selected?: boolean;
1049
1050  /**
1051   * Indicates the list index of the first item displayed on the screen.
1052   *
1053   * @type { ?number }
1054   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1055   * @systemapi
1056   * @since 20
1057   */
1058  startIndex?: number;
1059
1060  /**
1061   * Indicates the text of the element.
1062   *
1063   * @type { ?string }
1064   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1065   * @systemapi
1066   * @since 20
1067   */
1068  text?: string;
1069
1070  /**
1071   * Indicates the maximum length limit of the element text.
1072   *
1073   * @type { ?number }
1074   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1075   * @systemapi
1076   * @since 20
1077   */
1078  textLengthLimit?: number;
1079
1080  /**
1081   * Indicates the unit of movement of the element text as it is read.
1082   *
1083   * @type { ?accessibility.TextMoveUnit }
1084   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1085   * @systemapi
1086   * @since 20
1087   */
1088  textMoveUnit?: accessibility.TextMoveUnit;
1089
1090  /**
1091   * Indicates the action that triggered the element event.
1092   *
1093   * @type { ?AccessibilityAction }
1094   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1095   * @systemapi
1096   * @since 20
1097   */
1098  triggerAction?: AccessibilityAction;
1099
1100  /**
1101   * Indicates the window type of the element.
1102   *
1103   * @type { ?WindowType }
1104   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1105   * @systemapi
1106   * @since 20
1107   */
1108  type?: WindowType;
1109
1110  /**
1111   * Indicates the maximum value.
1112   *
1113   * @type { ?number }
1114   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1115   * @systemapi
1116   * @since 20
1117   */
1118  valueMax?: number;
1119
1120  /**
1121   * Indicates the minimum value.
1122   *
1123   * @type { ?number }
1124   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1125   * @systemapi
1126   * @since 20
1127   */
1128  valueMin?: number;
1129
1130  /**
1131   * Indicates the current value.
1132   *
1133   * @type { ?number }
1134   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1135   * @systemapi
1136   * @since 20
1137   */
1138  valueNow?: number;
1139
1140  /**
1141   * Indicates the window id.
1142   *
1143   * @type { ?number }
1144   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1145   * @systemapi
1146   * @since 20
1147   */
1148  windowId?: number;
1149
1150  /**
1151   * Indicates the offset.
1152   *
1153   * @type { ?number }
1154   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1155   * @systemapi
1156   * @since 20
1157   */
1158  offset?: number;
1159
1160  /**
1161   * Indicates the text type.
1162   *
1163   * @type { ?string }
1164   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1165   * @systemapi
1166   * @since 20
1167   */
1168  textType?: string;
1169
1170  /**
1171   * Indicates the accessibility text of component.
1172   *
1173   * @type { ?string }
1174   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1175   * @systemapi
1176   * @since 20
1177   */
1178  accessibilityText?: string;
1179
1180  /**
1181   * Indicates the hot area of the element.
1182   *
1183   * @type { ?Rect }
1184   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1185   * @systemapi
1186   * @since 20
1187   */
1188  hotArea?: Rect;
1189
1190  /**
1191   * Indicates the custom component type.
1192   *
1193   * @type { ?string }
1194   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1195   * @systemapi
1196   * @since 20
1197   */
1198  customComponentType?: string;
1199
1200  /**
1201   * Indicates the component next accessibility focus id.
1202   *
1203   * @type { ?number }
1204   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1205   * @systemapi
1206   * @since 20
1207   */
1208  accessibilityNextFocusId?: number;
1209
1210  /**
1211   * Indicates the component previous accessibility focus id.
1212   *
1213   * @type { ?number }
1214   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1215   * @systemapi
1216   * @since 20
1217   */
1218  accessibilityPreviousFocusId?: number;
1219
1220  /**
1221   * Indicates the extra info of the element.
1222   *
1223   * @type { ?string }
1224   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1225   * @systemapi
1226   * @since 20
1227   */
1228  extraInfo?: string;
1229
1230  /**
1231   * Indicates whether the element is scrollable for accessibility.
1232   *
1233   * @type { ?boolean }
1234   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1235   * @systemapi
1236   * @since 20
1237   */
1238  accessibilityScrollable?: boolean;
1239
1240  /**
1241   * Indicates actions the element support.
1242   *
1243   * @type { ?Array<string> }
1244   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1245   * @systemapi
1246   * @since 20
1247   */
1248  supportedActionNames?: Array<string>;
1249
1250  /**
1251   * Indicates whether the element is accessibilityGroup.
1252   *
1253   * @type { ?boolean }
1254   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1255   * @systemapi
1256   * @since 20
1257   */
1258  accessibilityGroup?: boolean;
1259
1260  /**
1261   * Indicates the accessibilityLevel of component.
1262   *
1263   * @type { ?string }
1264   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1265   * @systemapi
1266   * @since 20
1267   */
1268  accessibilityLevel?: string;
1269
1270  /**
1271   * Indicates the navDestination id of component.
1272   *
1273   * @type { ?number }
1274   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1275   * @systemapi
1276   * @since 20
1277   */
1278  navDestinationId?: number;
1279
1280  /**
1281   * Indicates the current item in grid of component.
1282   *
1283   * @type { ?AccessibilityGrid }
1284   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1285   * @systemapi
1286   * @since 20
1287   */
1288  currentItem?: AccessibilityGrid;
1289
1290  /**
1291   * Indicates the span array of component.
1292   *
1293   * @type { ?AccessibilitySpan[] }
1294   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1295   * @systemapi
1296   * @since 20
1297   */
1298  spans?: AccessibilitySpan[];
1299
1300  /**
1301   * Indicates whether the component is accessibility visible.
1302   *
1303   * @type { ?boolean }
1304   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1305   * @systemapi
1306   * @since 20
1307   */
1308  accessibilityVisible?: boolean;
1309
1310  /**
1311   * Indicates the main windowId of component.
1312   *
1313   * @type { ?number }
1314   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1315   * @systemapi
1316   * @since 20
1317   */
1318  mainWindowId?: number;
1319
1320  /**
1321   * Indicates whether the component need clip.
1322   *
1323   * @type { ?boolean }
1324   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1325   * @systemapi
1326   * @since 20
1327   */
1328  clip?: boolean;
1329
1330  /**
1331   * Indicates the parent element id of component.
1332   *
1333   * @type { ?number }
1334   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1335   * @systemapi
1336   * @since 20
1337   */
1338  parentId?: number;
1339
1340  /**
1341   * Indicates the children elements id list of component.
1342   *
1343   * @type { ?Array<number> }
1344   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1345   * @systemapi
1346   * @since 20
1347   */
1348  childrenIds?: Array<number>;
1349
1350  /**
1351   * Execute the specified action.
1352   *
1353   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1354   * @param { AccessibilityAction } action Indicates the action to execute.
1355   * @param { Parameter } [parameters] Indicates the parameters needed to execute the action.
1356   * @returns { Promise<void> }
1357   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1358   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1359   * @throws { BusinessError } 9300005 - This action is not supported.
1360   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1361   * @systemapi
1362   * @since 20
1363   */
1364  executeAction(action: AccessibilityAction, parameters?: Parameter): Promise<void>;
1365
1366  /**
1367   * Get element's parent.
1368   *
1369   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1370   * @returns { Promise<AccessibilityElement> }
1371   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1372   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1373   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1374   * @systemapi
1375   * @since 20
1376   */
1377  getParent(): Promise<AccessibilityElement>;
1378
1379  /**
1380   * Get element's children.
1381   *
1382   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1383   * @returns { Promise<Array<AccessibilityElement>> }
1384   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1385   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1386   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1387   * @systemapi
1388   * @since 20
1389   */
1390  getChildren(): Promise<Array<AccessibilityElement>>;
1391
1392  /**
1393 * Get element's root.
1394 *
1395 * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1396 * @returns { Promise<AccessibilityElement> }
1397 * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1398 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1399 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1400 * @systemapi
1401 * @since 20
1402 */
1403  getRoot(): Promise<AccessibilityElement>;
1404
1405  /**
1406   * Find elements that match the condition.
1407   *
1408   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1409   * @param { string } condition Indicates the specific content to be queried.
1410   * @returns { Promise<Array<AccessibilityElement>> }
1411   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1412   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1413   * @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
1414   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1415   * @systemapi
1416   * @since 20
1417   */
1418  findElementByContent(condition: string): Promise<Array<AccessibilityElement>>;
1419
1420  /**
1421   * Find elements that match the focus direction.
1422   *
1423   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1424   * @param { FocusDirection } condition Indicates the direction of search focus to query.
1425   * @returns { Promise<AccessibilityElement> }
1426   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1427   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1428   * @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
1429   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1430   * @systemapi
1431   * @since 20
1432   */
1433  findElementByFocusDirection(condition: FocusDirection): Promise<AccessibilityElement>;
1434
1435  /**
1436   * Find elements that match the condition.
1437   *
1438   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1439   * @param { string } condition Indicates the specific json string to be queried.
1440   * @returns { Promise<Array<AccessibilityElement>> }
1441   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1442   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1443   * @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
1444   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1445   * @systemapi
1446   * @since 20
1447   */
1448  findElementsByAccessibilityHintText(condition: string): Promise<Array<AccessibilityElement>>;
1449
1450  /**
1451   * Find elements that match the elementId.
1452   *
1453   * @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
1454   * @param { number } condition Indicates the elementId to query.
1455   * @returns { Promise<AccessibilityElement> }
1456   * @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
1457   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
1458   * @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
1459   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1460   * @systemapi
1461   * @since 20
1462   */
1463  findElementById(condition: number): Promise<AccessibilityElement>;
1464}
1465
1466/**
1467 * Indicates grid info.
1468 *
1469 * @typedef AccessibilityGrid
1470 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1471 * @systemapi
1472 * @since 20
1473 */
1474interface AccessibilityGrid {
1475  /**
1476   * The row index in grid.
1477   *
1478   * @type { number }
1479   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1480   * @systemapi
1481   * @since 20
1482   */
1483  rowIndex: number;
1484  /**
1485   * The colum index in grid.
1486   *
1487   * @type { number }
1488   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1489   * @systemapi
1490   * @since 20
1491   */
1492  columnIndex: number;
1493}
1494
1495/**
1496 * Indicates span info.
1497 *
1498 * @typedef AccessibilitySpan
1499 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1500 * @systemapi
1501 * @since 20
1502 */
1503interface AccessibilitySpan {
1504  /**
1505   * The id of span.
1506   *
1507   * @type { number }
1508   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1509   * @systemapi
1510   * @since 20
1511   */
1512  spanId: number;
1513  /**
1514   * The text of span.
1515   *
1516   * @type { string }
1517   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1518   * @systemapi
1519   * @since 20
1520   */
1521  spanText: string;
1522  /**
1523   * The accessibility text of span.
1524   *
1525   * @type { string }
1526   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1527   * @systemapi
1528   * @since 20
1529   */
1530  accessibilityText: string;
1531  /**
1532   * The accessibility description of span.
1533   *
1534   * @type { string }
1535   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1536   * @systemapi
1537   * @since 20
1538   */
1539  accessibilityDescription: string;
1540  /**
1541   * The accessibility level of span.
1542   *
1543   * @type { string }
1544   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1545   * @systemapi
1546   * @since 20
1547   */
1548  accessibilityLevel: string;
1549}
1550
1551/**
1552 * Indicates the parameter of the AccessibiltyAction.
1553 *
1554 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1555 * @systemapi
1556 * @since 20
1557 */
1558export declare class Parameter {
1559  /**
1560   * Indicates the text to set for AccessibilityAction.SET_TEXT.
1561   *
1562   * @type { ?string }
1563   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1564   * @systemapi
1565   * @since 20
1566   */
1567  setText?: string;
1568  /**
1569   * Indicates the begin position of select text  for AccessibilityAction.SET_SELECTION.
1570   *
1571   * @type { ?string }
1572   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1573   * @systemapi
1574   * @since 20
1575   */
1576  selectTextBegin?: string;
1577  /**
1578   * Indicates the end position of select text for AccessibilityAction.SET_SELECTION.
1579   *
1580   * @type { ?string }
1581   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1582   * @systemapi
1583   * @since 20
1584   */
1585  selectTextEnd?: string;
1586  /**
1587   * Indicates the direction of select text for AccessibilityAction.SET_SELECTION.
1588   *
1589   * @type { ?boolean }
1590   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1591   * @systemapi
1592   * @since 20
1593   */
1594  selectTextInForWard?: boolean;
1595  /**
1596   * Indicates the cursor position for AccessibilityAction.SET_CURSOR_POSITION.
1597   *
1598   * @type { ?string }
1599   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1600   * @systemapi
1601   * @since 20
1602   */
1603  offset?: string;
1604  /**
1605   * Indicates the span id for AccessibilityAction.SPAN_CLICK.
1606   *
1607   * @type { ?string }
1608   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1609   * @systemapi
1610   * @since 20
1611   */
1612  spanId?: string;
1613  /**
1614   * Indicates the scroll type for AccessibilityAction.SCROLL_FORWARD and AccessibilityAction.SCROLL_BACKWARD.
1615   *
1616   * @type { ?string }
1617   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1618   * @systemapi
1619   * @since 20
1620   */
1621  scrollType?: string;
1622}
1623
1624/**
1625 * Indicates the possible attributes of the element and the type of the attribute value.
1626 *
1627 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1628 * @since 9
1629 */
1630/**
1631 * Indicates the possible attributes of the element and the type of the attribute value.
1632 *
1633 * @typedef ElementAttributeValues
1634 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1635 * @since 11
1636 */
1637interface ElementAttributeValues {
1638  /**
1639   * Indicates accessibility focus state.
1640   *
1641   * @type {boolean}
1642   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1643   * @since 9
1644   */
1645  accessibilityFocused: boolean;
1646  /**
1647   * Indicates the bundle name to which it belongs.
1648   *
1649   * @type {string}
1650   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1651   * @since 9
1652   */
1653  bundleName: string;
1654  /**
1655   * Indicates whether the element is checkable.
1656   *
1657   * @type {boolean}
1658   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1659   * @since 9
1660   */
1661  checkable: boolean;
1662  /**
1663   * Indicates whether the element is checked.
1664   *
1665   * @type {boolean}
1666   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1667   * @since 9
1668   */
1669  checked: boolean;
1670  /**
1671   * Indicates all child elements.
1672   *
1673   * @type {Array<AccessibilityElement>}
1674   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1675   * @since 9
1676   */
1677  children: Array<AccessibilityElement>;
1678  /**
1679   * Indicates whether the element is clickable.
1680   *
1681   * @type {boolean}
1682   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1683   * @since 9
1684   */
1685  clickable: boolean;
1686  /**
1687   * Indicates the component ID to which the element belongs.
1688   *
1689   * @type {number}
1690   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1691   * @since 9
1692   */
1693  componentId: number;
1694  /**
1695   * Indicates the component type to which the element belongs.
1696   *
1697   * @type {string}
1698   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1699   * @since 9
1700   */
1701  componentType: string;
1702  /**
1703   * Indicates the content.
1704   *
1705   * @type {Array<string>}
1706   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1707   * @since 9
1708   */
1709  contents: Array<string>;
1710  /**
1711   * Indicates the index of the current item.
1712   *
1713   * @type {number}
1714   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1715   * @since 9
1716   */
1717  currentIndex: number;
1718  /**
1719   * Indicates the description of the element.
1720   *
1721   * @type {string}
1722   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1723   * @since 9
1724   */
1725  description: string;
1726  /**
1727   * Indicates whether the element is editable.
1728   *
1729   * @type {boolean}
1730   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1731   * @since 9
1732   */
1733  editable: boolean;
1734  /**
1735   * Indicates the list index of the last item displayed on the screen.
1736   *
1737   * @type {number}
1738   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1739   * @since 9
1740   */
1741  endIndex: number;
1742  /**
1743   * Indicates the string of error state.
1744   *
1745   * @type {string}
1746   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1747   * @since 9
1748   */
1749  error: string;
1750  /**
1751   * Indicates whether the element is focusable.
1752   *
1753   * @type {boolean}
1754   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1755   * @since 9
1756   */
1757  focusable: boolean;
1758  /**
1759   * Indicates the hint text.
1760   *
1761   * @type {string}
1762   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1763   * @since 9
1764   */
1765  hintText: string;
1766  /**
1767   * Indicates the type of input text.
1768   *
1769   * @type {number}
1770   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1771   * @since 9
1772   */
1773  inputType: number;
1774  /**
1775   * Indicates the inspector key.
1776   *
1777   * @type {string}
1778   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1779   * @since 9
1780   */
1781  inspectorKey: string;
1782  /**
1783   * Indicates whether the element is active or not.
1784   *
1785   * @type {boolean}
1786   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1787   * @since 9
1788   */
1789  isActive: boolean;
1790  /**
1791   * Indicates whether the element is enable or not.
1792   *
1793   * @type {boolean}
1794   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1795   * @since 9
1796   */
1797  isEnable: boolean;
1798  /**
1799   * Indicates whether the element is hint state or not.
1800   *
1801   * @type {boolean}
1802   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1803   * @since 9
1804   */
1805  isHint: boolean;
1806  /**
1807   * Indicates whether the element is focused or not.
1808   *
1809   * @type {boolean}
1810   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1811   * @since 9
1812   */
1813  isFocused: boolean;
1814  /**
1815   * Indicates whether the element is password or not.
1816   *
1817   * @type {boolean}
1818   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1819   * @since 9
1820   */
1821  isPassword: boolean;
1822  /**
1823   * Indicates whether the element is visible or not.
1824   *
1825   * @type {boolean}
1826   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1827   * @since 9
1828   */
1829  isVisible: boolean;
1830  /**
1831   * Indicates the total count of the items.
1832   *
1833   * @type {number}
1834   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1835   * @since 9
1836   */
1837  itemCount: number;
1838  /**
1839   * Indicates the last content.
1840   *
1841   * @type {string}
1842   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1843   * @since 9
1844   */
1845  lastContent: string;
1846  /**
1847   * Indicates the display layer of the element.
1848   *
1849   * @type {number}
1850   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1851   * @since 9
1852   */
1853  layer: number;
1854  /**
1855   * Indicates whether the element is long clickable.
1856   *
1857   * @type {boolean}
1858   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1859   * @since 9
1860   */
1861  longClickable: boolean;
1862  /**
1863   * Indicates the page id.
1864   *
1865   * @type {number}
1866   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1867   * @since 9
1868   */
1869  pageId: number;
1870  /**
1871   * Indicates the parent of the element.
1872   *
1873   * @type {AccessibilityElement}
1874   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1875   * @since 9
1876   */
1877  parent: AccessibilityElement;
1878  /**
1879   * Indicates whether the element supports multiple lines of text.
1880   *
1881   * @type {boolean}
1882   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1883   * @since 9
1884   */
1885  pluralLineSupported: boolean;
1886  /**
1887   * Indicates the area of the element.
1888   *
1889   * @type {Rect}
1890   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1891   * @since 9
1892   */
1893  rect: Rect;
1894  /**
1895   * Indicates the resource name of the element.
1896   *
1897   * @type {string}
1898   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1899   * @since 9
1900   */
1901  resourceName: string;
1902  /**
1903   * Indicates the root element of the window element.
1904   *
1905   * @type {AccessibilityElement}
1906   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1907   * @since 9
1908   */
1909  rootElement: AccessibilityElement;
1910  /**
1911   * Indicates the display area of the element.
1912   *
1913   * @type {Rect}
1914   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1915   * @since 9
1916   */
1917  screenRect: Rect;
1918  /**
1919   * Indicates whether the element is scrollable.
1920   *
1921   * @type {boolean}
1922   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1923   * @since 9
1924   */
1925  scrollable: boolean;
1926  /**
1927   * Indicates whether the element is selected.
1928   *
1929   * @type {boolean}
1930   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1931   * @since 9
1932   */
1933  selected: boolean;
1934  /**
1935   * Indicates the list index of the first item displayed on the screen.
1936   *
1937   * @type {number}
1938   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1939   * @since 9
1940   */
1941  startIndex: number;
1942  /**
1943   * Indicates the text of the element.
1944   *
1945   * @type {string}
1946   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1947   * @since 9
1948   */
1949  text: string;
1950  /**
1951   * Indicates the maximum length limit of the element text.
1952   *
1953   * @type {number}
1954   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1955   * @since 9
1956   */
1957  textLengthLimit: number;
1958  /**
1959   * Indicates the unit of movement of the element text as it is read.
1960   *
1961   * @type {accessibility.TextMoveUnit}
1962   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1963   * @since 9
1964   */
1965  textMoveUnit: accessibility.TextMoveUnit;
1966  /**
1967   * Indicates the action that triggered the element event.
1968   *
1969   * @type {accessibility.Action}
1970   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1971   * @since 9
1972   */
1973  triggerAction: accessibility.Action;
1974  /**
1975   * Indicates the window type of the element.
1976   *
1977   * @type {WindowType}
1978   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1979   * @since 9
1980   */
1981  type: WindowType;
1982  /**
1983   * Indicates the maximum value.
1984   *
1985   * @type {number}
1986   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1987   * @since 9
1988   */
1989  valueMax: number;
1990  /**
1991   * Indicates the minimum value.
1992   *
1993   * @type {number}
1994   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1995   * @since 9
1996   */
1997  valueMin: number;
1998  /**
1999   * Indicates the current value.
2000   *
2001   * @type {number}
2002   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2003   * @since 9
2004   */
2005  valueNow: number;
2006  /**
2007   * Indicates the window id.
2008   *
2009   * @type {number}
2010   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2011   * @since 9
2012   */
2013  windowId: number;
2014  /**
2015   * Indicates the offset.
2016   *
2017   * @type {number}
2018   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2019   * @since 12
2020   */
2021  offset: number;
2022  /**
2023   * Indicates the text type.
2024   *
2025   * @type {string}
2026   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2027   * @since 12
2028   */
2029  textType: string;
2030  /**
2031   * Indicates the accessibility text of component.
2032   *
2033   * @type {string}
2034   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2035   * @since 12
2036   */
2037  accessibilityText: string;
2038  /**
2039   * Indicates the hot area of the element.
2040   *
2041   * @type {Rect}
2042   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2043   * @since 12
2044   */
2045  hotArea: Rect;
2046  /**
2047   * Indicates the component next accessibility focus id.
2048   * @type { ?number }
2049   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2050   * @since 18
2051   */
2052  accessibilityNextFocusId?: number;
2053  /**
2054   * Indicates the custom component type.
2055   *
2056   * @type { ?string }
2057   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2058   * @since 18
2059   */
2060  customComponentType?: string;
2061  /**
2062   * Indicates the extra info of the element.
2063   * @type { ?string }
2064   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2065   * @since 18
2066   */
2067  extraInfo?: string;
2068  /**
2069   * Indicates the component Previous accessibility focus id.
2070   *
2071   * @type { ?number }
2072   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2073   * @since 18
2074   */
2075  accessibilityPreviousFocusId?: number;
2076  /**
2077   * Indicates whether the element is scrollable for accessibility.
2078   *
2079   * @type { ?boolean }
2080   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2081   * @since 18
2082   */
2083  accessibilityScrollable?: boolean;
2084}
2085
2086/**
2087 * Indicates the direction of the search focus.
2088 *
2089 * @typedef {'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'}
2090 * @syscap SystemCapability.BarrierFree.Accessibility.Core
2091 * @since 9
2092 */
2093type FocusDirection = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
2094
2095/**
2096 * Indicates the type of the focus.
2097 *
2098 * @typedef {'accessibility' | 'normal'}
2099 * @syscap SystemCapability.BarrierFree.Accessibility.Core
2100 * @since 9
2101 */
2102type FocusType = 'accessibility' | 'normal';
2103
2104/**
2105 * Indicates the type of the window.
2106 *
2107 * @typedef {'application' | 'system'}
2108 * @syscap SystemCapability.BarrierFree.Accessibility.Core
2109 * @since 9
2110 */
2111type WindowType = 'application' | 'system';
2112
2113/**
2114 * Indicates rectangle.
2115 *
2116 * @typedef Rect
2117 * @syscap SystemCapability.BarrierFree.Accessibility.Core
2118 * @since 9
2119 */
2120interface Rect {
2121  /**
2122   * The left position of Rect
2123   *
2124   * @type { number }
2125   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2126   * @since 9
2127   */
2128  left: number;
2129  /**
2130   * The top position of Rect
2131   *
2132   * @type { number }
2133   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2134   * @since 9
2135   */
2136  top: number;
2137  /**
2138   * The width position of Rect
2139   *
2140   * @type { number }
2141   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2142   * @since 9
2143   */
2144  width: number;
2145  /**
2146   * The height position of Rect
2147   *
2148   * @type { number }
2149   * @syscap SystemCapability.BarrierFree.Accessibility.Core
2150   * @since 9
2151   */
2152  height: number;
2153}
2154