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