• 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
18 * @kit AccessibilityKit
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22import type { Callback } from './@ohos.base';
23import { Resource } from './global/resource';
24
25/**
26 * Accessibility
27 *
28 * @namespace accessibility
29 * @syscap SystemCapability.BarrierFree.Accessibility.Core
30 * @since 7
31 */
32/**
33 * Accessibility
34 *
35 * @namespace accessibility
36 * @syscap SystemCapability.BarrierFree.Accessibility.Core
37 * @atomicservice
38 * @since 11
39 */
40declare namespace accessibility {
41  /**
42   * The type of the Ability app.
43   *
44   *{ 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' }
45   * @syscap SystemCapability.BarrierFree.Accessibility.Core
46   * @since 7
47   */
48  /**
49   * The type of the Ability app.
50   *
51   * { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all' }
52   * @typedef {'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all'}
53   * @syscap SystemCapability.BarrierFree.Accessibility.Core
54   * @since 9
55   */
56  type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all';
57
58  /**
59   * The action that the ability can execute.
60   * value range: { 'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' |
61   * 'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' |
62   * 'scrollForward' | 'scrollBackward' | 'setSelection' }
63   *
64   * @syscap SystemCapability.BarrierFree.Accessibility.Core
65   * @since 7
66   */
67  /**
68   * The action that the ability can execute.
69   * value range: { 'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' |
70   * 'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' |
71   * 'scrollForward' | 'scrollBackward' | 'setSelection' | 'setCursorPosition' | 'home' |
72   * 'back' | 'recentTask' | 'notificationCenter' | 'controlCenter' | 'common' }
73   *
74   * @typedef {'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' | 'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' | 'scrollForward' | 'scrollBackward' | 'setSelection' | 'setCursorPosition' | 'home' | 'back' | 'recentTask' | 'notificationCenter' | 'controlCenter' | 'common'}
75   * @syscap SystemCapability.BarrierFree.Accessibility.Core
76   * @since 12
77   */
78  type Action = 'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' |
79  'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' |
80  'scrollForward' | 'scrollBackward' | 'setSelection' | 'setCursorPosition' | 'home' |
81  'back' | 'recentTask' | 'notificationCenter' | 'controlCenter' | 'common';
82
83  /**
84   * The type of the accessibility event.
85   * windowsChange/windowContentChange/windowStateChange/announcement/notificationChange/textTraversedAtMove
86   * value range: { 'accessibilityFocus' | 'accessibilityFocusClear' |
87   * 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' |
88   * 'textUpdate' | 'textSelectionUpdate' | 'scroll' }
89   *
90   * @syscap SystemCapability.BarrierFree.Accessibility.Core
91   * @since 7
92   */
93  /**
94   * The type of the accessibility event.
95   * windowsChange/windowContentChange/windowStateChange/announcement/notificationChange/textTraversedAtMove
96   * value range: { 'accessibilityFocus' | 'accessibilityFocusClear' |
97   * 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' |
98   * 'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' |
99   * 'announceForAccessibility' }
100   *
101   * @typedef {'accessibilityFocus' | 'accessibilityFocusClear' | 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' | 'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' | 'announceForAccessibility'}
102   * @syscap SystemCapability.BarrierFree.Accessibility.Core
103   * @since 12
104   */
105  /**
106   * The type of the accessibility event.
107   * windowsChange/windowContentChange/windowStateChange/announcement/notificationChange/textTraversedAtMove
108   * value range: { 'accessibilityFocus' | 'accessibilityFocusClear' |
109   * 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' |
110   * 'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' |
111   * 'announceForAccessibility' | 'requestFocusForAccessibilityNotInterrupt' |
112   * 'announceForAccessibilityNotInterrupt' | 'scrolling' }
113   *
114   * @typedef {'accessibilityFocus' | 'accessibilityFocusClear' | 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' | 'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' | 'announceForAccessibility' | 'requestFocusForAccessibilityNotInterrupt' | 'announceForAccessibilityNotInterrupt' | 'scrolling'}
115   * @syscap SystemCapability.BarrierFree.Accessibility.Core
116   * @since 18
117   */
118  type EventType = 'accessibilityFocus' | 'accessibilityFocusClear' |
119  'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' |
120  'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' |
121  'announceForAccessibility' | 'requestFocusForAccessibilityNotInterrupt' |
122  'announceForAccessibilityNotInterrupt' | 'scrolling';
123
124  /**
125   * The change type of the windowsChange event.
126   * It's used when received the {@code windowsChange} event.
127   *
128   * @typedef {'add' | 'remove' | 'bounds' | 'active' | 'focus'}
129   * @syscap SystemCapability.BarrierFree.Accessibility.Core
130   * @since 7
131   */
132  type WindowUpdateType = 'add' | 'remove' | 'bounds' | 'active' | 'focus';
133
134  /**
135   * The type of the ability state.
136   *
137   * @typedef {'enable' | 'disable' | 'install'}
138   * @syscap SystemCapability.BarrierFree.Accessibility.Core
139   * @since 7
140   */
141  type AbilityState = 'enable' | 'disable' | 'install';
142
143  /**
144   * The ability that accessibility subsystem support.
145   * touchExplorer: Describes the capability to talkback.
146   * magnification: Describes the capability to request to control the display magnification.
147   * gesturesSimulation: Describes the capability to request to simulate the gesture.
148   * windowContent: Describes the capability to search for the content of the active window.
149   * filterKeyEvents: Describes the capability to request to filter key events.
150   * fingerprintGesture: Describes the capability to request to fingerprint gesture.
151   *
152   * @typedef {'retrieve' | 'touchGuide' | 'keyEventObserver' | 'zoom' | 'gesture'}
153   * @syscap SystemCapability.BarrierFree.Accessibility.Core
154   * @since 7
155   */
156  type Capability = 'retrieve' | 'touchGuide' | 'keyEventObserver' | 'zoom' | 'gesture';
157
158  /**
159   * The granularity of text move.
160   *
161   * @typedef {'char' | 'word' | 'line' | 'page' | 'paragraph'}
162   * @syscap SystemCapability.BarrierFree.Accessibility.Core
163   * @since 7
164   */
165  type TextMoveUnit = 'char' | 'word' | 'line' | 'page' | 'paragraph';
166
167  /**
168   * Checks whether accessibility ability is enabled.
169   *
170   * @param { AsyncCallback<boolean> } callback Asynchronous callback interface.
171   * @syscap SystemCapability.BarrierFree.Accessibility.Core
172   * @since 7
173   * @deprecated since 10
174   * @useinstead ohos.accessibility#isOpenAccessibilitySync
175   */
176  function isOpenAccessibility(callback: AsyncCallback<boolean>): void;
177
178  /**
179   * Checks whether accessibility ability is enabled.
180   *
181   * @returns { Promise<boolean> } Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise.
182   * @syscap SystemCapability.BarrierFree.Accessibility.Core
183   * @since 7
184   * @deprecated since 10
185   * @useinstead ohos.accessibility#isOpenAccessibilitySync
186   */
187  function isOpenAccessibility(): Promise<boolean>;
188
189  /**
190   * Checks whether accessibility ability is enabled.
191   *
192   * @returns { boolean } Returns true if the accessibility is enabled; returns false otherwise.
193   * @syscap SystemCapability.BarrierFree.Accessibility.Core
194   * @since 10
195   */
196  /**
197   * Checks whether accessibility ability is enabled.
198   *
199   * @returns { boolean } Returns true if the accessibility is enabled; returns false otherwise.
200   * @syscap SystemCapability.BarrierFree.Accessibility.Core
201   * @atomicservice
202   * @since 11
203   */
204  function isOpenAccessibilitySync(): boolean;
205
206  /**
207   * Checks touch browser ability (which is used by talkback) is enabled.
208   *
209   * @param { AsyncCallback<boolean> } callback Asynchronous callback interface.
210   * @syscap SystemCapability.BarrierFree.Accessibility.Vision
211   * @since 7
212   * @deprecated since 10
213   * @useinstead ohos.accessibility#isOpenTouchGuideSync
214   */
215  function isOpenTouchGuide(callback: AsyncCallback<boolean>): void;
216
217  /**
218   * Checks touch browser ability (which is used by talkback) is enabled.
219   *
220   * @returns { Promise<boolean> } Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise.
221   * @syscap SystemCapability.BarrierFree.Accessibility.Vision
222   * @since 7
223   * @deprecated since 10
224   * @useinstead ohos.accessibility#isOpenTouchGuideSync
225   */
226  function isOpenTouchGuide(): Promise<boolean>;
227
228  /**
229   * Checks touch browser ability (which is used by talkback) is enabled.
230   *
231   * @returns { boolean } Returns true if the touch browser is enabled; returns false otherwise.
232   * @syscap SystemCapability.BarrierFree.Accessibility.Vision
233   * @since 10
234   */
235  /**
236   * Checks touch browser ability (which is used by talkback) is enabled.
237   *
238   * @returns { boolean } Returns true if the touch browser is enabled; returns false otherwise.
239   * @syscap SystemCapability.BarrierFree.Accessibility.Vision
240   * @atomicservice
241   * @since 11
242   */
243  function isOpenTouchGuideSync(): boolean;
244
245  /**
246   * Checks screen reader ability (which is used by talkback) is enabled.
247   * @returns { boolean } Returns true if the screen reader is enabled; return false otherwise.
248   * @syscap SystemCapability.BarrierFree.Accessibility.Vision
249   * @since 18
250   */
251  function isScreenReaderOpenSync(): boolean;
252
253  /**
254   * Queries the list of accessibility abilities.
255   *
256   * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken
257   * @param { AbilityState } stateType The state of the accessibility ability.  {@code AbilityState} eg.installed
258   * @param { AsyncCallback<Array<AccessibilityAbilityInfo>> } callback
259   * @syscap SystemCapability.BarrierFree.Accessibility.Core
260   * @since 7
261   * @deprecated since 9
262   * @useinstead ohos.accessibility#getAccessibilityExtensionList
263   */
264  function getAbilityLists(
265    abilityType: AbilityType,
266    stateType: AbilityState,
267    callback: AsyncCallback<Array<AccessibilityAbilityInfo>>
268  ): void;
269
270  /**
271   * Queries the list of accessibility abilities.
272   *
273   * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken
274   * @param { AbilityState } stateType The state of the accessibility ability.  {@code AbilityState} eg.installed
275   * @returns { Promise<Array<AccessibilityAbilityInfo>> } Returns the list of abilityInfos.
276   * @syscap SystemCapability.BarrierFree.Accessibility.Core
277   * @since 7
278   * @deprecated since 9
279   * @useinstead ohos.accessibility#getAccessibilityExtensionList
280   */
281  function getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise<Array<AccessibilityAbilityInfo>>;
282
283  /**
284   * Queries the list of accessibility abilities.
285   *
286   * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken
287   * @param { AbilityState } stateType The state of the accessibility ability.  {@code AbilityState} eg.installed
288   * @returns { Promise<Array<AccessibilityAbilityInfo>> } Returns the list of abilityInfos.
289   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
290   *     1. Mandatory parameters are left unspecified;
291   *     2. Incorrect parameter types;
292   *     3. Parameter verification failed.
293   * @syscap SystemCapability.BarrierFree.Accessibility.Core
294   * @since 9
295   */
296  function getAccessibilityExtensionList(
297    abilityType: AbilityType,
298    stateType: AbilityState
299  ): Promise<Array<AccessibilityAbilityInfo>>;
300
301  /**
302   * Queries the list of accessibility abilities.
303   *
304   * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken
305   * @param { AbilityState } stateType The state of the accessibility ability.  {@code AbilityState} eg.installed
306   * @param { AsyncCallback<Array<AccessibilityAbilityInfo>> } callback
307   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
308   *     1. Mandatory parameters are left unspecified;
309   *     2. Incorrect parameter types;
310   *     3. Parameter verification failed.
311   * @syscap SystemCapability.BarrierFree.Accessibility.Core
312   * @since 9
313   */
314  function getAccessibilityExtensionList(
315    abilityType: AbilityType,
316    stateType: AbilityState,
317    callback: AsyncCallback<Array<AccessibilityAbilityInfo>>
318  ): void;
319
320  /**
321   * Queries the list of accessibility abilities.
322   *
323   * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken
324   * @param { AbilityState } stateType The state of the accessibility ability.  {@code AbilityState} eg.installed
325   * @returns { Array<AccessibilityAbilityInfo> } Returns the list of abilityInfos.
326   * @syscap SystemCapability.BarrierFree.Accessibility.Core
327   * @since 12
328   */
329  function getAccessibilityExtensionListSync(
330    abilityType: AbilityType,
331    stateType: AbilityState
332  ): Array<AccessibilityAbilityInfo>;
333
334  /**
335   * Send accessibility Event.
336   *
337   * @param { EventInfo } event The object of the accessibility {@code EventInfo} .
338   * @param { AsyncCallback<void> } callback Asynchronous callback interface.
339   * @syscap SystemCapability.BarrierFree.Accessibility.Core
340   * @since 7
341   * @deprecated since 9
342   * @useinstead ohos.accessibility#sendAccessibilityEvent
343   */
344  function sendEvent(event: EventInfo, callback: AsyncCallback<void>): void;
345
346  /**
347   * Send accessibility Event.
348   *
349   * @param { EventInfo } event The object of the accessibility {@code EventInfo} .
350   * @returns { Promise<void> } Returns {@code true} if success ; returns {@code false} otherwise.
351   * @syscap SystemCapability.BarrierFree.Accessibility.Core
352   * @since 7
353   * @deprecated since 9
354   * @useinstead ohos.accessibility#sendAccessibilityEvent
355   */
356  function sendEvent(event: EventInfo): Promise<void>;
357
358  /**
359   * Send accessibility event.
360   *
361   * @param { EventInfo } event The object of the accessibility {@code EventInfo} .
362   * @param { AsyncCallback<void> } callback Asynchronous callback interface.
363   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
364   *     1. Mandatory parameters are left unspecified;
365   *     2. Incorrect parameter types;
366   *     3. Parameter verification failed.
367   * @syscap SystemCapability.BarrierFree.Accessibility.Core
368   * @since 9
369   */
370  function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback<void>): void;
371
372  /**
373   * Send accessibility event.
374   *
375   * @param { EventInfo } event The object of the accessibility {@code EventInfo} .
376   * @returns { Promise<void> } Returns {@code true} if success ; returns {@code false} otherwise.
377   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
378   *     1. Mandatory parameters are left unspecified;
379   *     2. Incorrect parameter types;
380   *     3. Parameter verification failed.
381   * @syscap SystemCapability.BarrierFree.Accessibility.Core
382   * @since 9
383   */
384  function sendAccessibilityEvent(event: EventInfo): Promise<void>;
385
386  /**
387   * Register the observe of the accessibility state changed.
388   *
389   * @param { 'accessibilityStateChange' } type state event type.
390   * @param { Callback<boolean> } callback Asynchronous callback interface.
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   * @syscap SystemCapability.BarrierFree.Accessibility.Core
396   * @since 7
397   */
398  function on(type: 'accessibilityStateChange', callback: Callback<boolean>): void;
399
400  /**
401   * Register the observe of the touchGuide state changed.
402   *
403   * @param { 'touchGuideStateChange' } type state event type.
404   * @param { Callback<boolean> } callback Asynchronous callback interface.
405   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
406   *     1. Mandatory parameters are left unspecified;
407   *     2. Incorrect parameter types;
408   *     3. Parameter verification failed.
409   * @syscap SystemCapability.BarrierFree.Accessibility.Vision
410   * @since 7
411   */
412  function on(type: 'touchGuideStateChange', callback: Callback<boolean>): void;
413
414  /**
415   * Register the observe of the screen reader state changed.
416   * @param { 'screenReaderStateChange' } type state event type.
417   * @param { Callback<boolean> } callback callback Asynchronous callback interface.
418   * @throws { BusinessError } 401 Input parameter error. Possible causes:
419   * 1. Mandatory parameters are left unspecified;
420   * 2. Incorrect parameter types;
421   * 3. Parameter verification failed.
422   * @syscap SystemCapability.BarrierFree.Accessibility.Core
423   * @since 18
424   */
425  function on(type: 'screenReaderStateChange', callback: Callback<boolean>): void;
426
427  /**
428   * Unregister the observe of the accessibility state changed.
429   *
430   * @param { 'accessibilityStateChange' } type state event type
431   * @param { Callback<boolean> } callback Asynchronous callback interface.
432   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
433   *     1. Mandatory parameters are left unspecified;
434   *     2. Incorrect parameter types;
435   *     3. Parameter verification failed.
436   * @syscap SystemCapability.BarrierFree.Accessibility.Core
437   * @since 7
438   */
439  function off(type: 'accessibilityStateChange', callback?: Callback<boolean>): void;
440
441  /**
442   * Unregister the observe of the touchGuide state changed.
443   *
444   * @param { 'touchGuideStateChange' } type state event type
445   * @param { Callback<boolean> } callback Asynchronous callback interface.
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   * @syscap SystemCapability.BarrierFree.Accessibility.Core
451   * @since 7
452   */
453  function off(type: 'touchGuideStateChange', callback?: Callback<boolean>): void;
454
455  /**
456   * Unregister the observe of the screen reader state changed.
457   * @param { 'screenReaderStateChange' } type state event type
458   * @param { Callback<boolean> } callback callback Asynchronous callback interface.
459   * @throws { BusinessError } 401 - Input parameter error. Possible causes:
460   * 1. Mandatory parameters are left unspecified;
461   * 2. Incorrect parameter types;
462   * 3. Parameter verification failed.
463   * @syscap SystemCapability.BarrierFree.Accessibility.Core
464   * @since 18
465   */
466  function off(type: 'screenReaderStateChange', callback?: Callback<boolean>): void;
467
468  /**
469   * Get the captions manager.
470   *
471   * @returns { CaptionsManager } Returns the captions manager.
472   * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
473   * @since 8
474   * @deprecated since 12
475   */
476  function getCaptionsManager(): CaptionsManager;
477
478  /**
479   * Indicates the captions manager.
480   *
481   * @typedef CaptionsManager
482   * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
483   * @since 8
484   */
485  interface CaptionsManager {
486    /**
487     * Indicates whether captions are enabled.
488     *
489     * @type {boolean}
490     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
491     * @since 8
492     */
493    enabled: boolean;
494    /**
495     * Indicates the style of captions.
496     *
497     * @type {CaptionsStyle}
498     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
499     * @since 8
500     */
501    style: CaptionsStyle;
502
503    /**
504     * Register the observe of the enable state.
505     *
506     * @param { 'enableChange' } type
507     * @param { Callback<boolean> } callback
508     * @throws { BusinessError } 401 - Input parameter error. Possible causes:
509     *     1. Mandatory parameters are left unspecified;
510     *     2. Incorrect parameter types;
511     *     3. Parameter verification failed.
512     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
513     * @since 8
514     * @deprecated since 12
515     */
516    on(type: 'enableChange', callback: Callback<boolean>): void;
517
518    /**
519     * Register the observer of the style.
520     *
521     * @param { 'styleChange' } type
522     * @param { Callback<CaptionsStyle> } callback
523     * @throws { BusinessError } 401 - Input parameter error. Possible causes:
524     *     1. Mandatory parameters are left unspecified;
525     *     2. Incorrect parameter types;
526     *     3. Parameter verification failed.
527     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
528     * @since 8
529     * @deprecated since 12
530     */
531    on(type: 'styleChange', callback: Callback<CaptionsStyle>): void;
532
533    /**
534     * Unregister the observe of the enable state.
535     *
536     * @param { 'enableChange' } type
537     * @param { Callback<boolean> } callback
538     * @throws { BusinessError } 401 - Input parameter error. Possible causes:
539     *     1. Mandatory parameters are left unspecified;
540     *     2. Incorrect parameter types;
541     *     3. Parameter verification failed.
542     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
543     * @since 8
544     * @deprecated since 12
545     */
546    off(type: 'enableChange', callback?: Callback<boolean>): void;
547
548    /**
549     * Unregister the observer of the style.
550     *
551     * @param { 'styleChange' } type
552     * @param { Callback<CaptionsStyle> } callback
553     * @throws { BusinessError } 401 - Input parameter error. Possible causes:
554     *     1. Mandatory parameters are left unspecified;
555     *     2. Incorrect parameter types;
556     *     3. Parameter verification failed.
557     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
558     * @since 8
559     * @deprecated since 12
560     */
561    off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void;
562  }
563
564  /**
565   * Indicates the edge type of the captions font.
566   *
567   * @typedef {'none' | 'raised' | 'depressed' | 'uniform' | 'dropShadow'}
568   * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
569   * @since 8
570   */
571  type CaptionsFontEdgeType = 'none' | 'raised' | 'depressed' | 'uniform' | 'dropShadow';
572  /**
573   * Indicates the font family of captions.
574   *
575   * @typedef {'default' | 'monospacedSerif' | 'serif' | 'monospacedSansSerif' | 'sansSerif' | 'casual' | 'cursive' | 'smallCapitals'}
576   * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
577   * @since 8
578   */
579  type CaptionsFontFamily = 'default' | 'monospacedSerif' | 'serif' |
580  'monospacedSansSerif' | 'sansSerif' | 'casual' | 'cursive' | 'smallCapitals';
581  /**
582   * Indicates the style of captions.
583   *
584   * @typedef CaptionsStyle
585   * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
586   * @since 8
587   */
588  interface CaptionsStyle {
589    /**
590     * Indicates the font family of captions.
591     *
592     * @type {CaptionsFontFamily}
593     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
594     * @since 8
595     */
596    fontFamily: CaptionsFontFamily;
597    /**
598     * Indicates the font scaling of captions.
599     * @type { number }
600     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
601     * @since 8
602     */
603    fontScale: number;
604    /**
605     * Indicates the font color of captions.
606     * @type { number | string }
607     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
608     * @since 8
609     */
610    fontColor: number | string;
611    /**
612     * Indicates the edge type of the captions font.
613     * @type { CaptionsFontEdgeType }
614     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
615     * @since 8
616     */
617    fontEdgeType: CaptionsFontEdgeType;
618    /**
619     * Indicates the background color of captions.
620     * @type { number | string }
621     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
622     * @since 8
623     */
624    backgroundColor: number | string;
625    /**
626     * Indicates the window color of captions.
627     * @type { number | string }
628     * @syscap SystemCapability.BarrierFree.Accessibility.Hearing
629     * @since 8
630     */
631    windowColor: number | string;
632  }
633
634  /**
635   * Indicates the info of accessibility.
636   *
637   * @typedef AccessibilityAbilityInfo
638   * @syscap SystemCapability.BarrierFree.Accessibility.Core
639   * @since 7
640   */
641  interface AccessibilityAbilityInfo {
642    /**
643     * The ability id.
644     * @type { string }
645     * @readonly
646     * @syscap SystemCapability.BarrierFree.Accessibility.Core
647     * @since 7
648     */
649    readonly id: string;
650
651    /**
652     * The ability name.
653     * @type { string }
654     * @readonly
655     * @syscap SystemCapability.BarrierFree.Accessibility.Core
656     * @since 7
657     */
658    readonly name: string;
659
660    /**
661     * The bundle name of the ability.
662     * @type { string }
663     * @readonly
664     * @syscap SystemCapability.BarrierFree.Accessibility.Core
665     * @since 7
666     */
667    readonly bundleName: string;
668    /**
669     * The target bundle name for the observation.
670     * @type { Array<string> }
671     * @readonly
672     * @syscap SystemCapability.BarrierFree.Accessibility.Core
673     * @since 9
674     */
675    readonly targetBundleNames: Array<string>;
676
677    /**
678     * The type of the ability.
679     * @type { Array<AbilityType> }
680     * @readonly
681     * @syscap SystemCapability.BarrierFree.Accessibility.Core
682     * @since 7
683     */
684    readonly abilityTypes: Array<AbilityType>;
685
686    /**
687     * The capabilities of the ability.
688     * @type { Array<Capability> }
689     * @readonly
690     * @syscap SystemCapability.BarrierFree.Accessibility.Core
691     * @since 7
692     */
693    readonly capabilities: Array<Capability>;
694
695    /**
696     * The description of the ability.
697     * @type { string }
698     * @readonly
699     * @syscap SystemCapability.BarrierFree.Accessibility.Core
700     * @since 7
701     */
702    readonly description: string;
703
704    /**
705     * The events which the accessibility ability wants to observe.
706     * @type { Array<EventType> }
707     * @readonly
708     * @syscap SystemCapability.BarrierFree.Accessibility.Core
709     * @since 7
710     */
711    readonly eventTypes: Array<EventType>;
712
713    /**
714     * Indicates whether the extended service needs to be hidden.
715     * @type { boolean }
716     * @readonly
717     * @syscap SystemCapability.BarrierFree.Accessibility.Core
718     * @since 12
719     */
720    readonly needHide: boolean;
721
722    /**
723     * The label of the ability.
724     * @type { string }
725     * @readonly
726     * @syscap SystemCapability.BarrierFree.Accessibility.Core
727     * @since 12
728     */
729    readonly label: string;
730  }
731
732  /**
733   * Indicates the info of events.
734   *
735   * @syscap SystemCapability.BarrierFree.Accessibility.Core
736   * @since 7
737   */
738  class EventInfo {
739    /**
740     * A constructor used to create a EventInfo object.
741     *
742     * @param jsonObject - Character string in JSON format required for creating an object.
743     * @syscap SystemCapability.BarrierFree.Accessibility.Core
744     * @since 7
745     */
746    constructor(jsonObject);
747    /**
748     * A constructor used to create a EventInfo object.
749     *
750     * @param { EventType } type - The type of the accessibility event.
751     * @param { string } bundleName - The name of the bundle.
752     * @param { Action } triggerAction - The action that the ability can execute.
753     * @syscap SystemCapability.BarrierFree.Accessibility.Core
754     * @since 11
755     */
756    constructor(type: EventType, bundleName: string, triggerAction: Action);
757    /**
758     * The type of an accessibility event.
759     * @type { EventType }
760     * @syscap SystemCapability.BarrierFree.Accessibility.Core
761     * @since 7
762     */
763    type: EventType;
764
765    /**
766     * The type of the window change event.
767     * @type { ?WindowUpdateType }
768     * @syscap SystemCapability.BarrierFree.Accessibility.Core
769     * @since 7
770     */
771    windowUpdateType?: WindowUpdateType;
772
773    /**
774     * The bundle name of the target application.
775     * @type { string }
776     * @syscap SystemCapability.BarrierFree.Accessibility.Core
777     * @since 7
778     */
779    bundleName: string;
780
781    /**
782     * The type of the event source component,such as button, chart.
783     * @type { ?string }
784     * @syscap SystemCapability.BarrierFree.Accessibility.Core
785     * @since 7
786     */
787    componentType?: string;
788
789    /**
790     * The page id of the event source.
791     * @type { ?number }
792     * @syscap SystemCapability.BarrierFree.Accessibility.Core
793     * @since 7
794     */
795    pageId?: number;
796
797    /**
798     * The accessibility event description.
799     * @type { ?string }
800     * @syscap SystemCapability.BarrierFree.Accessibility.Core
801     * @since 7
802     */
803    description?: string;
804
805    /**
806     * The action that triggers the accessibility event, for example, clicking or focusing a view.
807     * @type { Action }
808     * @syscap SystemCapability.BarrierFree.Accessibility.Core
809     * @since 7
810     */
811    triggerAction: Action;
812
813    /**
814     * The movement step used for reading texts.
815     * @type { ?TextMoveUnit }
816     * @syscap SystemCapability.BarrierFree.Accessibility.Core
817     * @since 7
818     */
819    textMoveUnit?: TextMoveUnit;
820
821    /**
822     * The content list.
823     * @type { ?Array<string> }
824     * @syscap SystemCapability.BarrierFree.Accessibility.Core
825     * @since 7
826     */
827    contents?: Array<string>;
828
829    /**
830     * The content changed before.
831     * @type { ?string }
832     * @syscap SystemCapability.BarrierFree.Accessibility.Core
833     * @since 7
834     */
835    lastContent?: string;
836
837    /**
838     * The start index of listed items on the screen.
839     * @type { ?number }
840     * @syscap SystemCapability.BarrierFree.Accessibility.Core
841     * @since 7
842     */
843    beginIndex?: number;
844
845    /**
846     * The index of the current item on the screen.
847     * @type { ?number }
848     * @syscap SystemCapability.BarrierFree.Accessibility.Core
849     * @since 7
850     */
851    currentIndex?: number;
852
853    /**
854     * The end index of listed items on the screen.
855     * @type { ?number }
856     * @syscap SystemCapability.BarrierFree.Accessibility.Core
857     * @since 7
858     */
859    endIndex?: number;
860
861    /**
862     * The total of the items, talkback used it when scroll.
863     * @type { ?number }
864     * @syscap SystemCapability.BarrierFree.Accessibility.Core
865     * @since 7
866     */
867    itemCount?: number;
868
869    /**
870     * The id of element.
871     * @type { ?number }
872     * @syscap SystemCapability.BarrierFree.Accessibility.Core
873     * @since 12
874     */
875    elementId?: number;
876
877    /**
878     * The content of announce accessibility text.
879     * @type { ?string }
880     * @syscap SystemCapability.BarrierFree.Accessibility.Core
881     * @since 12
882     */
883    textAnnouncedForAccessibility?: string;
884
885    /**
886     * The content of announce accessibility text.
887     * @type { ?Resource }
888     * @syscap SystemCapability.BarrierFree.Accessibility.Core
889     * @since 18
890     */
891    textResourceAnnouncedForAccessibility?: Resource;
892
893    /**
894     * The customized element id.
895     * @type { ?string }
896     * @syscap SystemCapability.BarrierFree.Accessibility.Core
897     * @since 12
898     */
899    customId?: string;
900  }
901}
902export default accessibility;
903