• 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 } 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';
26
27/**
28 * The accessibility extension context. Used to configure, query information, and inject gestures.
29 *
30 * @extends ExtensionContext
31 * @syscap SystemCapability.BarrierFree.Accessibility.Core
32 * @since 9
33 */
34export default class AccessibilityExtensionContext extends ExtensionContext {
35  /**
36   * Set the bundle names that is interested in sending the event.
37   *
38   * @param { Array<string> } targetNames The bundle names that are interested in sending the event.
39   * @param { AsyncCallback<void> } callback Indicates the listener.
40   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
41   *     1. Mandatory parameters are left unspecified;
42   *     2. Incorrect parameter types;
43   *     3. Parameter verification failed.
44   * @syscap SystemCapability.BarrierFree.Accessibility.Core
45   * @since 9
46   * @deprecated since 12
47   */
48  setTargetBundleName(targetNames: Array<string>, callback: AsyncCallback<void>): void;
49
50  /**
51   * Set the bundle names that is interested in sending the event.
52   *
53   * @param { Array<string> } targetNames The bundle names that are interested in sending the event.
54   * @returns { Promise<void> }
55   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
56   *     1. Mandatory parameters are left unspecified;
57   *     2. Incorrect parameter types;
58   *     3. Parameter verification failed.
59   * @syscap SystemCapability.BarrierFree.Accessibility.Core
60   * @since 9
61   * @deprecated since 12
62   */
63  setTargetBundleName(targetNames: Array<string>): Promise<void>;
64
65  /**
66   * Get focus element.
67   *
68   * @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus.
69   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
70   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
71   *     1. Mandatory parameters are left unspecified;
72   *     2. Incorrect parameter types;
73   *     3. Parameter verification failed.
74   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
75   * @syscap SystemCapability.BarrierFree.Accessibility.Core
76   * @since 9
77   * @deprecated since 12
78   */
79  getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback<AccessibilityElement>): void;
80
81  /**
82   * Get focus element.
83   *
84   * @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus.
85   * @returns { Promise<AccessibilityElement> }
86   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
87   *     1. Mandatory parameters are left unspecified;
88   *     2. Incorrect parameter types;
89   *     3. Parameter verification failed.
90   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
91   * @syscap SystemCapability.BarrierFree.Accessibility.Core
92   * @since 9
93   * @deprecated since 12
94   */
95  getFocusElement(isAccessibilityFocus?: boolean): Promise<AccessibilityElement>;
96
97  /**
98   * Get focus element.
99   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
100   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
101   *     1. Mandatory parameters are left unspecified;
102   *     2. Incorrect parameter types;
103   *     3. Parameter verification failed.
104   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
105   * @syscap SystemCapability.BarrierFree.Accessibility.Core
106   * @since 9
107   * @deprecated since 12
108   */
109  getFocusElement(callback: AsyncCallback<AccessibilityElement>): void;
110
111  /**
112   * Get window root element.
113   *
114   * @param { number } windowId Indicates the window ID.
115   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
116   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
117   *     1. Mandatory parameters are left unspecified;
118   *     2. Incorrect parameter types;
119   *     3. Parameter verification failed.
120   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
121   * @syscap SystemCapability.BarrierFree.Accessibility.Core
122   * @since 9
123   * @deprecated since 12
124   */
125  getWindowRootElement(windowId: number, callback: AsyncCallback<AccessibilityElement>): void;
126
127  /**
128   * Get window root element.
129   *
130   * @param { number } windowId Indicates the window ID.
131   * @returns { Promise<AccessibilityElement> }
132   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
133   *     1. Mandatory parameters are left unspecified;
134   *     2. Incorrect parameter types;
135   *     3. Parameter verification failed.
136   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
137   * @syscap SystemCapability.BarrierFree.Accessibility.Core
138   * @since 9
139   * @deprecated since 12
140   */
141  getWindowRootElement(windowId?: number): Promise<AccessibilityElement>;
142
143  /**
144   * Get window root element.
145   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
146   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
147   *     1. Mandatory parameters are left unspecified;
148   *     2. Incorrect parameter types;
149   *     3. Parameter verification failed.
150   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
151   * @syscap SystemCapability.BarrierFree.Accessibility.Core
152   * @since 9
153   * @deprecated since 12
154   */
155  getWindowRootElement(callback: AsyncCallback<AccessibilityElement>): void;
156
157  /**
158   * Get window list.
159   *
160   * @param { number } displayId Indicates the display ID.
161   * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
162   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
163   *     1. Mandatory parameters are left unspecified;
164   *     2. Incorrect parameter types;
165   *     3. Parameter verification failed.
166   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
167   * @syscap SystemCapability.BarrierFree.Accessibility.Core
168   * @since 9
169   * @deprecated since 12
170   */
171  getWindows(displayId: number, callback: AsyncCallback<Array<AccessibilityElement>>): void;
172
173  /**
174   * Get window list.
175   *
176   * @param { number } displayId Indicates the display ID.
177   * @returns { Promise<Array<AccessibilityElement>> }
178   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
179   *     1. Mandatory parameters are left unspecified;
180   *     2. Incorrect parameter types;
181   *     3. Parameter verification failed.
182   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
183   * @syscap SystemCapability.BarrierFree.Accessibility.Core
184   * @since 9
185   * @deprecated since 12
186   */
187  getWindows(displayId?: number): Promise<Array<AccessibilityElement>>;
188
189  /**
190   * Get window list.
191   * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
192   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
193   *     1. Mandatory parameters are left unspecified;
194   *     2. Incorrect parameter types;
195   *     3. Parameter verification failed.
196   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
197   * @syscap SystemCapability.BarrierFree.Accessibility.Core
198   * @since 9
199   * @deprecated since 12
200   */
201  getWindows(callback: AsyncCallback<Array<AccessibilityElement>>): void;
202
203  /**
204   * Inject gesture path events.
205   *
206   * @param { GesturePath } gesturePath Indicates the gesture path.
207   * @param { AsyncCallback<void> } callback Indicates the listener.
208   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
209   *     1. Mandatory parameters are left unspecified;
210   *     2. Incorrect parameter types;
211   *     3. Parameter verification failed.
212   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
213   * @syscap SystemCapability.BarrierFree.Accessibility.Core
214   * @since 9
215   * @deprecated since 10
216   * @useinstead AccessibilityExtensionContext/AccessibilityExtensionContext#injectGestureSync
217   */
218  injectGesture(gesturePath: GesturePath, callback: AsyncCallback<void>): void;
219
220  /**
221   * Inject gesture path events.
222   *
223   * @param { GesturePath } gesturePath Indicates the gesture path.
224   * @returns { Promise<void> }
225   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
226   *     1. Mandatory parameters are left unspecified;
227   *     2. Incorrect parameter types;
228   *     3. Parameter verification failed.
229   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
230   * @syscap SystemCapability.BarrierFree.Accessibility.Core
231   * @since 9
232   * @deprecated since 10
233   * @useinstead AccessibilityExtensionContext/AccessibilityExtensionContext#injectGestureSync
234   */
235  injectGesture(gesturePath: GesturePath): Promise<void>;
236
237  /**
238   * Inject gesture path events.
239   *
240   * @param { GesturePath } gesturePath Indicates the gesture path.
241   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
242   *     1. Mandatory parameters are left unspecified;
243   *     2. Incorrect parameter types;
244   *     3. Parameter verification failed.
245   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
246   * @syscap SystemCapability.BarrierFree.Accessibility.Core
247   * @since 10
248   * @deprecated since 12
249   */
250  injectGestureSync(gesturePath: GesturePath): void;
251
252  /**
253   * Starts a new ability.
254   *
255   * @param { Want } want - Indicates the start options.
256   * @returns { Promise<void> }
257   * @throws { BusinessError } 201 - The application does not have the permission required to call the API.
258   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
259   *     1. Mandatory parameters are left unspecified;
260   *     2. Incorrect parameter types;
261   *     3. Parameter verification failed.
262   * @syscap SystemCapability.BarrierFree.Accessibility.Core
263   * @systemapi
264   * @since 12
265   */
266  startAbility(want: Want): Promise<void>;
267
268  /**
269   * get all subElements in window.
270   * @param { number } windowId Indicates the window ID.
271   * @param { number } elementId Indicates the elementId.
272   * @returns { Promise<Array<AccessibilityElement>> }
273   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
274   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
275   *    1. Mandatory parameters are left unspecified;
276   *    2. Incorrect parameter types;
277   *    3. Parameter verification failed.
278   * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
279   * @syscap SystemCapability.BarrierFree.Accessibility.Core
280   * @systemapi
281   * @since 18
282   */
283  getElements(windowId: number, elementId?: number): Promise<Array<AccessibilityElement>>;
284
285  /**
286   * Get default focused element ids.
287   * @param { number } windowId Indicates whether the windowid can be used as the default focus.
288   * @returns { Promise<Array<number>> }
289   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
290   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
291   *    1. Mandatory parameters are left unspecified;
292   *    2. Incorrect parameter types;
293   *    3. Parameter verification failed.
294   * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
295   * @syscap SystemCapability.BarrierFree.Accessibility.Core
296   * @systemapi
297   * @since 18
298   */
299  getDefaultFocusedElementIds(windowId: number): Promise<Array<number>>;
300}
301
302/**
303 * Indicates an accessibility element.
304 * Supports querying element attributes, requesting execution actions, and finding child elements by condition.
305 *
306 * @typedef AccessibilityElement
307 * @syscap SystemCapability.BarrierFree.Accessibility.Core
308 * @since 9
309 */
310declare interface AccessibilityElement {
311  /**
312   * Get a list of attribute names.
313   *
314   * @param { AsyncCallback<Array<T>> } callback Indicates the listener.
315   * @syscap SystemCapability.BarrierFree.Accessibility.Core
316   * @since 9
317   * @deprecated since 12
318   */
319  attributeNames<T extends keyof ElementAttributeValues>(callback: AsyncCallback<Array<T>>): void;
320
321  /**
322   * Get a list of attribute names.
323   * @returns { Promise<Array<T>> }
324   * @syscap SystemCapability.BarrierFree.Accessibility.Core
325   * @since 9
326   * @deprecated since 12
327   */
328  attributeNames<T extends keyof ElementAttributeValues>(): Promise<Array<T>>;
329
330  /**
331   * Get the value of an attribute.
332   *
333   * @param { T } attributeName Indicates the attribute name.
334   * @param { AsyncCallback<ElementAttributeValues[T]> } callback Indicates the listener.
335   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
336   *     1. Mandatory parameters are left unspecified;
337   *     2. Incorrect parameter types;
338   *     3. Parameter verification failed.
339   * @throws { BusinessError } 9300004 - This property does not exist.
340   * @syscap SystemCapability.BarrierFree.Accessibility.Core
341   * @since 9
342   * @deprecated since 12
343   */
344  attributeValue<T extends keyof ElementAttributeValues>(
345    attributeName: T,
346    callback: AsyncCallback<ElementAttributeValues[T]>
347  ): void;
348
349  /**
350   * Get the value of an attribute.
351   *
352   * @param { T } attributeName Indicates the attribute name.
353   * @returns { Promise<ElementAttributeValues[T]> }
354   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
355   *     1. Mandatory parameters are left unspecified;
356   *     2. Incorrect parameter types;
357   *     3. Parameter verification failed.
358   * @throws { BusinessError } 9300004 - This property does not exist.
359   * @syscap SystemCapability.BarrierFree.Accessibility.Core
360   * @since 9
361   * @deprecated since 12
362   */
363  attributeValue<T extends keyof ElementAttributeValues>(attributeName: T): Promise<ElementAttributeValues[T]>;
364
365  /**
366   * Get a list of supported actions.
367   *
368   * @param { AsyncCallback<Array<string>> } callback Indicates the listener.
369   * @syscap SystemCapability.BarrierFree.Accessibility.Core
370   * @since 9
371   * @deprecated since 12
372   */
373  actionNames(callback: AsyncCallback<Array<string>>): void;
374
375  /**
376   * Get a list of supported actions.
377   *
378   * @returns { Promise<Array<string>> }
379   * @syscap SystemCapability.BarrierFree.Accessibility.Core
380   * @since 9
381   * @deprecated since 12
382   */
383  actionNames(): Promise<Array<string>>;
384
385  /**
386   * Perform the specified action.
387   *
388   * @param { string } actionName Indicates the action name.
389   * @param { object } parameters Indicates the parameters needed to execute the action.
390   * @param { AsyncCallback<void> } callback Indicates the listener.
391   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
392   *     1. Mandatory parameters are left unspecified;
393   *     2. Incorrect parameter types;
394   *     3. Parameter verification failed.
395   * @throws { BusinessError } 9300005 - This action is not supported.
396   * @syscap SystemCapability.BarrierFree.Accessibility.Core
397   * @since 9
398   * @deprecated since 12
399   */
400  performAction(actionName: string, parameters: object, callback: AsyncCallback<void>): void;
401
402  /**
403   * Perform the specified action.
404   *
405   * @param { string } actionName Indicates the action name.
406   * @param { object } parameters Indicates the parameters needed to execute the action.
407   * @returns { Promise<void> }
408   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
409   *     1. Mandatory parameters are left unspecified;
410   *     2. Incorrect parameter types;
411   *     3. Parameter verification failed.
412   * @throws { BusinessError } 9300005 - This action is not supported.
413   * @syscap SystemCapability.BarrierFree.Accessibility.Core
414   * @since 9
415   * @deprecated since 12
416   */
417  performAction(actionName: string, parameters?: object): Promise<void>;
418
419  /**
420   * Perform the specified action.
421   *
422   * @param { string } actionName Indicates the action name.
423   * @param { AsyncCallback<void> } callback Indicates the listener.
424   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
425   *     1. Mandatory parameters are left unspecified;
426   *     2. Incorrect parameter types;
427   *     3. Parameter verification failed.
428   * @throws { BusinessError } 9300005 - This action is not supported.
429   * @syscap SystemCapability.BarrierFree.Accessibility.Core
430   * @since 9
431   * @deprecated since 12
432   */
433  performAction(actionName: string, callback: AsyncCallback<void>): void;
434
435  /**
436   * Get the position of cursor in TextInput.
437   *
438   * @param { AsyncCallback<number> } callback Indicates the listener.
439   * @syscap SystemCapability.BarrierFree.Accessibility.Core
440   * @systemapi
441   * @since 12
442   */
443  getCursorPosition(callback: AsyncCallback<number>): void;
444
445  /**
446   * Get the position of cursor in TextInput.
447   *
448   * @returns { Promise<number> }
449   * @syscap SystemCapability.BarrierFree.Accessibility.Core
450   * @systemapi
451   * @since 12
452   */
453  getCursorPosition(): Promise<number>;
454
455  /**
456   * Set the screen curtain enable or disable.
457   *
458   * @param { boolean } isEnable Indicates whether the screen curtain is enabled.
459   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
460   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
461   *     1. Mandatory parameters are left unspecified;
462   *     2. Incorrect parameter types;
463   *     3. Parameter verification failed.
464   * @throws { BusinessError } 9300003 -  No accessibility permission to perform the operation.
465   * @syscap SystemCapability.BarrierFree.Accessibility.Core
466   * @systemapi
467   * @since 12
468   */
469  enableScreenCurtain(isEnable: boolean): void;
470
471  /**
472   * Find elements that match the condition.
473   *
474   * @param { 'content' } type The type of query condition is content.
475   * @param { string } condition Indicates the specific content to be queried.
476   * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
477   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
478   *     1. Mandatory parameters are left unspecified;
479   *     2. Incorrect parameter types;
480   *     3. Parameter verification failed.
481   * @syscap SystemCapability.BarrierFree.Accessibility.Core
482   * @since 9
483   * @deprecated since 12
484   */
485  findElement(type: 'content', condition: string, callback: AsyncCallback<Array<AccessibilityElement>>): void;
486
487  /**
488   * Find elements that match the condition.
489   *
490   * @param { 'content' } type The type of query condition is content.
491   * @param { string } condition Indicates the specific content to be queried.
492   * @returns { Promise<Array<AccessibilityElement>> }
493   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
494   *     1. Mandatory parameters are left unspecified;
495   *     2. Incorrect parameter types;
496   *     3. Parameter verification failed.
497   * @syscap SystemCapability.BarrierFree.Accessibility.Core
498   * @since 9
499   * @deprecated since 12
500   */
501  findElement(type: 'content', condition: string): Promise<Array<AccessibilityElement>>;
502
503  /**
504   * Find elements that match the condition.
505   *
506   * @param { 'focusType' } type The type of query condition is focus type.
507   * @param { FocusType } condition Indicates the type of focus to query.
508   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
509   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
510   *     1. Mandatory parameters are left unspecified;
511   *     2. Incorrect parameter types;
512   *     3. Parameter verification failed.
513   * @syscap SystemCapability.BarrierFree.Accessibility.Core
514   * @since 9
515   * @deprecated since 12
516   */
517  findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback<AccessibilityElement>): void;
518
519  /**
520   * Find elements that match the condition.
521   *
522   * @param { 'focusType' } type The type of query condition is focus type.
523   * @param { FocusType } condition Indicates the type of focus to query.
524   * @returns { Promise<AccessibilityElement> }
525   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
526   *     1. Mandatory parameters are left unspecified;
527   *     2. Incorrect parameter types;
528   *     3. Parameter verification failed.
529   * @syscap SystemCapability.BarrierFree.Accessibility.Core
530   * @since 9
531   * @deprecated since 12
532   */
533  findElement(type: 'focusType', condition: FocusType): Promise<AccessibilityElement>;
534
535  /**
536   * Find elements that match the condition.
537   *
538   * @param { 'focusDirection' } type The type of query condition is focus direction.
539   * @param { FocusDirection } condition Indicates the direction of search focus to query.
540   * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
541   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
542   *     1. Mandatory parameters are left unspecified;
543   *     2. Incorrect parameter types;
544   *     3. Parameter verification failed.
545   * @syscap SystemCapability.BarrierFree.Accessibility.Core
546   * @since 9
547   * @deprecated since 12
548   */
549  findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback<AccessibilityElement>): void;
550
551  /**
552   * Find elements that match the condition.
553   *
554   * @param { 'focusDirection' } type The type of query condition is focus direction.
555   * @param { FocusDirection } condition Indicates the direction of search focus to query.
556   * @returns { Promise<AccessibilityElement> }
557   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
558   *     1. Mandatory parameters are left unspecified;
559   *     2. Incorrect parameter types;
560   *     3. Parameter verification failed.
561   * @syscap SystemCapability.BarrierFree.Accessibility.Core
562   * @since 9
563   * @deprecated since 12
564   */
565  findElement(type: 'focusDirection', condition: FocusDirection): Promise<AccessibilityElement>;
566
567  /**
568   * Find elements that match the condition.
569   *
570   * @param { 'textType' } type The type of query condition is text type.
571   * @param { string } condition Indicates the specific content to be queried.
572   * @returns { Promise<Array<AccessibilityElement>> }
573   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
574   *     1. Mandatory parameters are left unspecified;
575   *     2. Incorrect parameter types;
576   *     3. Parameter verification failed.
577   * @syscap SystemCapability.BarrierFree.Accessibility.Core
578   * @systemapi
579   * @since 12
580   */
581  findElement(type: 'textType', condition: string): Promise<Array<AccessibilityElement>>;
582
583  /**
584   * Find elements that match the condition.
585   *
586   * @param { 'elementId' } type The type of query condition is element id.
587   * @param { number } condition Indicates the specific content to be queried.
588   * @returns { Promise<AccessibilityElement> }
589   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
590   *     1. Mandatory parameters are left unspecified;
591   *     2. Incorrect parameter types;
592   *     3. Parameter verification failed.
593   * @syscap SystemCapability.BarrierFree.Accessibility.Core
594   * @systemapi
595   * @since 12
596   */
597  findElement(type: 'elementId', condition: number): Promise<AccessibilityElement>;
598}
599
600/**
601 * Indicates the possible attributes of the element and the type of the attribute value.
602 *
603 * @syscap SystemCapability.BarrierFree.Accessibility.Core
604 * @since 9
605 */
606/**
607 * Indicates the possible attributes of the element and the type of the attribute value.
608 *
609 * @typedef ElementAttributeValues
610 * @syscap SystemCapability.BarrierFree.Accessibility.Core
611 * @since 11
612 */
613interface ElementAttributeValues {
614  /**
615   * Indicates accessibility focus state.
616   *
617   * @type {boolean}
618   * @syscap SystemCapability.BarrierFree.Accessibility.Core
619   * @since 9
620   */
621  accessibilityFocused: boolean;
622  /**
623   * Indicates the bundle name to which it belongs.
624   *
625   * @type {string}
626   * @syscap SystemCapability.BarrierFree.Accessibility.Core
627   * @since 9
628   */
629  bundleName: string;
630  /**
631   * Indicates whether the element is checkable.
632   *
633   * @type {boolean}
634   * @syscap SystemCapability.BarrierFree.Accessibility.Core
635   * @since 9
636   */
637  checkable: boolean;
638  /**
639   * Indicates whether the element is checked.
640   *
641   * @type {boolean}
642   * @syscap SystemCapability.BarrierFree.Accessibility.Core
643   * @since 9
644   */
645  checked: boolean;
646  /**
647   * Indicates all child elements.
648   *
649   * @type {Array<AccessibilityElement>}
650   * @syscap SystemCapability.BarrierFree.Accessibility.Core
651   * @since 9
652   */
653  children: Array<AccessibilityElement>;
654  /**
655   * Indicates whether the element is clickable.
656   *
657   * @type {boolean}
658   * @syscap SystemCapability.BarrierFree.Accessibility.Core
659   * @since 9
660   */
661  clickable: boolean;
662  /**
663   * Indicates the component ID to which the element belongs.
664   *
665   * @type {number}
666   * @syscap SystemCapability.BarrierFree.Accessibility.Core
667   * @since 9
668   */
669  componentId: number;
670  /**
671   * Indicates the component type to which the element belongs.
672   *
673   * @type {string}
674   * @syscap SystemCapability.BarrierFree.Accessibility.Core
675   * @since 9
676   */
677  componentType: string;
678  /**
679   * Indicates the content.
680   *
681   * @type {Array<string>}
682   * @syscap SystemCapability.BarrierFree.Accessibility.Core
683   * @since 9
684   */
685  contents: Array<string>;
686  /**
687   * Indicates the index of the current item.
688   *
689   * @type {number}
690   * @syscap SystemCapability.BarrierFree.Accessibility.Core
691   * @since 9
692   */
693  currentIndex: number;
694  /**
695   * Indicates the description of the element.
696   *
697   * @type {string}
698   * @syscap SystemCapability.BarrierFree.Accessibility.Core
699   * @since 9
700   */
701  description: string;
702  /**
703   * Indicates whether the element is editable.
704   *
705   * @type {boolean}
706   * @syscap SystemCapability.BarrierFree.Accessibility.Core
707   * @since 9
708   */
709  editable: boolean;
710  /**
711   * Indicates the list index of the last item displayed on the screen.
712   *
713   * @type {number}
714   * @syscap SystemCapability.BarrierFree.Accessibility.Core
715   * @since 9
716   */
717  endIndex: number;
718  /**
719   * Indicates the string of error state.
720   *
721   * @type {string}
722   * @syscap SystemCapability.BarrierFree.Accessibility.Core
723   * @since 9
724   */
725  error: string;
726  /**
727   * Indicates whether the element is focusable.
728   *
729   * @type {boolean}
730   * @syscap SystemCapability.BarrierFree.Accessibility.Core
731   * @since 9
732   */
733  focusable: boolean;
734  /**
735   * Indicates the hint text.
736   *
737   * @type {string}
738   * @syscap SystemCapability.BarrierFree.Accessibility.Core
739   * @since 9
740   */
741  hintText: string;
742  /**
743   * Indicates the type of input text.
744   *
745   * @type {number}
746   * @syscap SystemCapability.BarrierFree.Accessibility.Core
747   * @since 9
748   */
749  inputType: number;
750  /**
751   * Indicates the inspector key.
752   *
753   * @type {string}
754   * @syscap SystemCapability.BarrierFree.Accessibility.Core
755   * @since 9
756   */
757  inspectorKey: string;
758  /**
759   * Indicates whether the element is active or not.
760   *
761   * @type {boolean}
762   * @syscap SystemCapability.BarrierFree.Accessibility.Core
763   * @since 9
764   */
765  isActive: boolean;
766  /**
767   * Indicates whether the element is enable or not.
768   *
769   * @type {boolean}
770   * @syscap SystemCapability.BarrierFree.Accessibility.Core
771   * @since 9
772   */
773  isEnable: boolean;
774  /**
775   * Indicates whether the element is hint state or not.
776   *
777   * @type {boolean}
778   * @syscap SystemCapability.BarrierFree.Accessibility.Core
779   * @since 9
780   */
781  isHint: boolean;
782  /**
783   * Indicates whether the element is focused or not.
784   *
785   * @type {boolean}
786   * @syscap SystemCapability.BarrierFree.Accessibility.Core
787   * @since 9
788   */
789  isFocused: boolean;
790  /**
791   * Indicates whether the element is password or not.
792   *
793   * @type {boolean}
794   * @syscap SystemCapability.BarrierFree.Accessibility.Core
795   * @since 9
796   */
797  isPassword: boolean;
798  /**
799   * Indicates whether the element is visible or not.
800   *
801   * @type {boolean}
802   * @syscap SystemCapability.BarrierFree.Accessibility.Core
803   * @since 9
804   */
805  isVisible: boolean;
806  /**
807   * Indicates the total count of the items.
808   *
809   * @type {number}
810   * @syscap SystemCapability.BarrierFree.Accessibility.Core
811   * @since 9
812   */
813  itemCount: number;
814  /**
815   * Indicates the last content.
816   *
817   * @type {string}
818   * @syscap SystemCapability.BarrierFree.Accessibility.Core
819   * @since 9
820   */
821  lastContent: string;
822  /**
823   * Indicates the display layer of the element.
824   *
825   * @type {number}
826   * @syscap SystemCapability.BarrierFree.Accessibility.Core
827   * @since 9
828   */
829  layer: number;
830  /**
831   * Indicates whether the element is long clickable.
832   *
833   * @type {boolean}
834   * @syscap SystemCapability.BarrierFree.Accessibility.Core
835   * @since 9
836   */
837  longClickable: boolean;
838  /**
839   * Indicates the page id.
840   *
841   * @type {number}
842   * @syscap SystemCapability.BarrierFree.Accessibility.Core
843   * @since 9
844   */
845  pageId: number;
846  /**
847   * Indicates the parent of the element.
848   *
849   * @type {AccessibilityElement}
850   * @syscap SystemCapability.BarrierFree.Accessibility.Core
851   * @since 9
852   */
853  parent: AccessibilityElement;
854  /**
855   * Indicates whether the element supports multiple lines of text.
856   *
857   * @type {boolean}
858   * @syscap SystemCapability.BarrierFree.Accessibility.Core
859   * @since 9
860   */
861  pluralLineSupported: boolean;
862  /**
863   * Indicates the area of the element.
864   *
865   * @type {Rect}
866   * @syscap SystemCapability.BarrierFree.Accessibility.Core
867   * @since 9
868   */
869  rect: Rect;
870  /**
871   * Indicates the resource name of the element.
872   *
873   * @type {string}
874   * @syscap SystemCapability.BarrierFree.Accessibility.Core
875   * @since 9
876   */
877  resourceName: string;
878  /**
879   * Indicates the root element of the window element.
880   *
881   * @type {AccessibilityElement}
882   * @syscap SystemCapability.BarrierFree.Accessibility.Core
883   * @since 9
884   */
885  rootElement: AccessibilityElement;
886  /**
887   * Indicates the display area of the element.
888   *
889   * @type {Rect}
890   * @syscap SystemCapability.BarrierFree.Accessibility.Core
891   * @since 9
892   */
893  screenRect: Rect;
894  /**
895   * Indicates whether the element is scrollable.
896   *
897   * @type {boolean}
898   * @syscap SystemCapability.BarrierFree.Accessibility.Core
899   * @since 9
900   */
901  scrollable: boolean;
902  /**
903   * Indicates whether the element is selected.
904   *
905   * @type {boolean}
906   * @syscap SystemCapability.BarrierFree.Accessibility.Core
907   * @since 9
908   */
909  selected: boolean;
910  /**
911   * Indicates the list index of the first item displayed on the screen.
912   *
913   * @type {number}
914   * @syscap SystemCapability.BarrierFree.Accessibility.Core
915   * @since 9
916   */
917  startIndex: number;
918  /**
919   * Indicates the text of the element.
920   *
921   * @type {string}
922   * @syscap SystemCapability.BarrierFree.Accessibility.Core
923   * @since 9
924   */
925  text: string;
926  /**
927   * Indicates the maximum length limit of the element text.
928   *
929   * @type {number}
930   * @syscap SystemCapability.BarrierFree.Accessibility.Core
931   * @since 9
932   */
933  textLengthLimit: number;
934  /**
935   * Indicates the unit of movement of the element text as it is read.
936   *
937   * @type {accessibility.TextMoveUnit}
938   * @syscap SystemCapability.BarrierFree.Accessibility.Core
939   * @since 9
940   */
941  textMoveUnit: accessibility.TextMoveUnit;
942  /**
943   * Indicates the action that triggered the element event.
944   *
945   * @type {accessibility.Action}
946   * @syscap SystemCapability.BarrierFree.Accessibility.Core
947   * @since 9
948   */
949  triggerAction: accessibility.Action;
950  /**
951   * Indicates the window type of the element.
952   *
953   * @type {WindowType}
954   * @syscap SystemCapability.BarrierFree.Accessibility.Core
955   * @since 9
956   */
957  type: WindowType;
958  /**
959   * Indicates the maximum value.
960   *
961   * @type {number}
962   * @syscap SystemCapability.BarrierFree.Accessibility.Core
963   * @since 9
964   */
965  valueMax: number;
966  /**
967   * Indicates the minimum value.
968   *
969   * @type {number}
970   * @syscap SystemCapability.BarrierFree.Accessibility.Core
971   * @since 9
972   */
973  valueMin: number;
974  /**
975   * Indicates the current value.
976   *
977   * @type {number}
978   * @syscap SystemCapability.BarrierFree.Accessibility.Core
979   * @since 9
980   */
981  valueNow: number;
982  /**
983   * Indicates the window id.
984   *
985   * @type {number}
986   * @syscap SystemCapability.BarrierFree.Accessibility.Core
987   * @since 9
988   */
989  windowId: number;
990  /**
991   * Indicates the offset.
992   *
993   * @type {number}
994   * @syscap SystemCapability.BarrierFree.Accessibility.Core
995   * @since 12
996   */
997  offset: number;
998  /**
999   * Indicates the text type.
1000   *
1001   * @type {string}
1002   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1003   * @since 12
1004   */
1005  textType: string;
1006  /**
1007   * Indicates the accessibility text of component.
1008   *
1009   * @type {string}
1010   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1011   * @since 12
1012   */
1013  accessibilityText: string;
1014  /**
1015   * Indicates the hot area of the element.
1016   *
1017   * @type {Rect}
1018   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1019   * @since 12
1020   */
1021  hotArea: Rect;
1022  /**
1023   * Indicates the component next accessibility focus id.
1024   * @type { ?number }
1025   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1026   * @since 18
1027   */
1028  accessibilityNextFocusId?: number;
1029  /**
1030   * Indicates the custom component type.
1031   *
1032   * @type { ?string }
1033   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1034   * @since 18
1035   */
1036  customComponentType?: string;
1037  /**
1038   * Indicates the extra info of the element.
1039   * @type { ?string }
1040   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1041   * @since 18
1042   */
1043  extraInfo?: string;
1044  /**
1045   * Indicates the component Previous accessibility focus id.
1046   *
1047   * @type { ?number }
1048   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1049   * @since 18
1050   */
1051  accessibilityPreviousFocusId?: number;
1052  /**
1053   * Indicates whether the element is scrollable for accessibility.
1054   *
1055   * @type { ?boolean }
1056   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1057   * @since 18
1058   */
1059  accessibilityScrollable?: boolean;
1060}
1061
1062/**
1063 * Indicates the direction of the search focus.
1064 *
1065 * @typedef {'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'}
1066 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1067 * @since 9
1068 */
1069type FocusDirection = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
1070
1071/**
1072 * Indicates the type of the focus.
1073 *
1074 * @typedef {'accessibility' | 'normal'}
1075 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1076 * @since 9
1077 */
1078type FocusType = 'accessibility' | 'normal';
1079
1080/**
1081 * Indicates the type of the window.
1082 *
1083 * @typedef {'application' | 'system'}
1084 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1085 * @since 9
1086 */
1087type WindowType = 'application' | 'system';
1088
1089/**
1090 * Indicates rectangle.
1091 *
1092 * @typedef Rect
1093 * @syscap SystemCapability.BarrierFree.Accessibility.Core
1094 * @since 9
1095 */
1096interface Rect {
1097  /**
1098   * The left position of Rect
1099   *
1100   * @type { number }
1101   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1102   * @since 9
1103   */
1104  left: number;
1105  /**
1106   * The top position of Rect
1107   *
1108   * @type { number }
1109   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1110   * @since 9
1111   */
1112  top: number;
1113  /**
1114   * The width position of Rect
1115   *
1116   * @type { number }
1117   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1118   * @since 9
1119   */
1120  width: number;
1121  /**
1122   * The height position of Rect
1123   *
1124   * @type { number }
1125   * @syscap SystemCapability.BarrierFree.Accessibility.Core
1126   * @since 9
1127   */
1128  height: number;
1129}
1130