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 } 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/** 270 * Indicates an accessibility element. 271 * Supports querying element attributes, requesting execution actions, and finding child elements by condition. 272 * 273 * @typedef AccessibilityElement 274 * @syscap SystemCapability.BarrierFree.Accessibility.Core 275 * @since 9 276 */ 277declare interface AccessibilityElement { 278 /** 279 * Get a list of attribute names. 280 * 281 * @param { AsyncCallback<Array<T>> } callback Indicates the listener. 282 * @syscap SystemCapability.BarrierFree.Accessibility.Core 283 * @since 9 284 * @deprecated since 12 285 */ 286 attributeNames<T extends keyof ElementAttributeValues>(callback: AsyncCallback<Array<T>>): void; 287 288 /** 289 * Get a list of attribute names. 290 * @returns { Promise<Array<T>> } 291 * @syscap SystemCapability.BarrierFree.Accessibility.Core 292 * @since 9 293 * @deprecated since 12 294 */ 295 attributeNames<T extends keyof ElementAttributeValues>(): Promise<Array<T>>; 296 297 /** 298 * Get the value of an attribute. 299 * 300 * @param { T } attributeName Indicates the attribute name. 301 * @param { AsyncCallback<ElementAttributeValues[T]> } callback Indicates the listener. 302 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 303 * 1. Mandatory parameters are left unspecified; 304 * 2. Incorrect parameter types; 305 * 3. Parameter verification failed. 306 * @throws { BusinessError } 9300004 - This property does not exist. 307 * @syscap SystemCapability.BarrierFree.Accessibility.Core 308 * @since 9 309 * @deprecated since 12 310 */ 311 attributeValue<T extends keyof ElementAttributeValues>( 312 attributeName: T, 313 callback: AsyncCallback<ElementAttributeValues[T]> 314 ): void; 315 316 /** 317 * Get the value of an attribute. 318 * 319 * @param { T } attributeName Indicates the attribute name. 320 * @returns { Promise<ElementAttributeValues[T]> } 321 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 322 * 1. Mandatory parameters are left unspecified; 323 * 2. Incorrect parameter types; 324 * 3. Parameter verification failed. 325 * @throws { BusinessError } 9300004 - This property does not exist. 326 * @syscap SystemCapability.BarrierFree.Accessibility.Core 327 * @since 9 328 * @deprecated since 12 329 */ 330 attributeValue<T extends keyof ElementAttributeValues>(attributeName: T): Promise<ElementAttributeValues[T]>; 331 332 /** 333 * Get a list of supported actions. 334 * 335 * @param { AsyncCallback<Array<string>> } callback Indicates the listener. 336 * @syscap SystemCapability.BarrierFree.Accessibility.Core 337 * @since 9 338 * @deprecated since 12 339 */ 340 actionNames(callback: AsyncCallback<Array<string>>): void; 341 342 /** 343 * Get a list of supported actions. 344 * 345 * @returns { Promise<Array<string>> } 346 * @syscap SystemCapability.BarrierFree.Accessibility.Core 347 * @since 9 348 * @deprecated since 12 349 */ 350 actionNames(): Promise<Array<string>>; 351 352 /** 353 * Perform the specified action. 354 * 355 * @param { string } actionName Indicates the action name. 356 * @param { object } parameters Indicates the parameters needed to execute the action. 357 * @param { AsyncCallback<void> } callback Indicates the listener. 358 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 359 * 1. Mandatory parameters are left unspecified; 360 * 2. Incorrect parameter types; 361 * 3. Parameter verification failed. 362 * @throws { BusinessError } 9300005 - This action is not supported. 363 * @syscap SystemCapability.BarrierFree.Accessibility.Core 364 * @since 9 365 * @deprecated since 12 366 */ 367 performAction(actionName: string, parameters: object, callback: AsyncCallback<void>): void; 368 369 /** 370 * Perform the specified action. 371 * 372 * @param { string } actionName Indicates the action name. 373 * @param { object } parameters Indicates the parameters needed to execute the action. 374 * @returns { Promise<void> } 375 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 376 * 1. Mandatory parameters are left unspecified; 377 * 2. Incorrect parameter types; 378 * 3. Parameter verification failed. 379 * @throws { BusinessError } 9300005 - This action is not supported. 380 * @syscap SystemCapability.BarrierFree.Accessibility.Core 381 * @since 9 382 * @deprecated since 12 383 */ 384 performAction(actionName: string, parameters?: object): Promise<void>; 385 386 /** 387 * Perform the specified action. 388 * 389 * @param { string } actionName Indicates the action name. 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, callback: AsyncCallback<void>): void; 401 402 /** 403 * Get the position of cursor in TextInput. 404 * 405 * @param { AsyncCallback<number> } callback Indicates the listener. 406 * @syscap SystemCapability.BarrierFree.Accessibility.Core 407 * @systemapi 408 * @since 12 409 */ 410 getCursorPosition(callback: AsyncCallback<number>): void; 411 412 /** 413 * Get the position of cursor in TextInput. 414 * 415 * @returns { Promise<number> } 416 * @syscap SystemCapability.BarrierFree.Accessibility.Core 417 * @systemapi 418 * @since 12 419 */ 420 getCursorPosition(): Promise<number>; 421 422 /** 423 * Set the screen curtain enable or disable. 424 * 425 * @param { boolean } isEnable Indicates whether the screen curtain is enabled. 426 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 427 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 428 * 1. Mandatory parameters are left unspecified; 429 * 2. Incorrect parameter types; 430 * 3. Parameter verification failed. 431 * @throws { BusinessError } 9300003 - No accessibility permission to perform the operation. 432 * @syscap SystemCapability.BarrierFree.Accessibility.Core 433 * @systemapi 434 * @since 12 435 */ 436 enableScreenCurtain(isEnable: boolean): void; 437 438 /** 439 * Find elements that match the condition. 440 * 441 * @param { 'content' } type The type of query condition is content. 442 * @param { string } condition Indicates the specific content to be queried. 443 * @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener. 444 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 445 * 1. Mandatory parameters are left unspecified; 446 * 2. Incorrect parameter types; 447 * 3. Parameter verification failed. 448 * @syscap SystemCapability.BarrierFree.Accessibility.Core 449 * @since 9 450 * @deprecated since 12 451 */ 452 findElement(type: 'content', condition: string, callback: AsyncCallback<Array<AccessibilityElement>>): void; 453 454 /** 455 * Find elements that match the condition. 456 * 457 * @param { 'content' } type The type of query condition is content. 458 * @param { string } condition Indicates the specific content to be queried. 459 * @returns { Promise<Array<AccessibilityElement>> } 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 * @syscap SystemCapability.BarrierFree.Accessibility.Core 465 * @since 9 466 * @deprecated since 12 467 */ 468 findElement(type: 'content', condition: string): Promise<Array<AccessibilityElement>>; 469 470 /** 471 * Find elements that match the condition. 472 * 473 * @param { 'focusType' } type The type of query condition is focus type. 474 * @param { FocusType } condition Indicates the type of focus to query. 475 * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener. 476 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 477 * 1. Mandatory parameters are left unspecified; 478 * 2. Incorrect parameter types; 479 * 3. Parameter verification failed. 480 * @syscap SystemCapability.BarrierFree.Accessibility.Core 481 * @since 9 482 * @deprecated since 12 483 */ 484 findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback<AccessibilityElement>): void; 485 486 /** 487 * Find elements that match the condition. 488 * 489 * @param { 'focusType' } type The type of query condition is focus type. 490 * @param { FocusType } condition Indicates the type of focus to query. 491 * @returns { Promise<AccessibilityElement> } 492 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 493 * 1. Mandatory parameters are left unspecified; 494 * 2. Incorrect parameter types; 495 * 3. Parameter verification failed. 496 * @syscap SystemCapability.BarrierFree.Accessibility.Core 497 * @since 9 498 * @deprecated since 12 499 */ 500 findElement(type: 'focusType', condition: FocusType): Promise<AccessibilityElement>; 501 502 /** 503 * Find elements that match the condition. 504 * 505 * @param { 'focusDirection' } type The type of query condition is focus direction. 506 * @param { FocusDirection } condition Indicates the direction of search focus to query. 507 * @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener. 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.Core 513 * @since 9 514 * @deprecated since 12 515 */ 516 findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback<AccessibilityElement>): void; 517 518 /** 519 * Find elements that match the condition. 520 * 521 * @param { 'focusDirection' } type The type of query condition is focus direction. 522 * @param { FocusDirection } condition Indicates the direction of search focus to query. 523 * @returns { Promise<AccessibilityElement> } 524 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 525 * 1. Mandatory parameters are left unspecified; 526 * 2. Incorrect parameter types; 527 * 3. Parameter verification failed. 528 * @syscap SystemCapability.BarrierFree.Accessibility.Core 529 * @since 9 530 * @deprecated since 12 531 */ 532 findElement(type: 'focusDirection', condition: FocusDirection): Promise<AccessibilityElement>; 533 534 /** 535 * Find elements that match the condition. 536 * 537 * @param { 'textType' } type The type of query condition is text type. 538 * @param { string } condition Indicates the specific content to be queried. 539 * @returns { Promise<Array<AccessibilityElement>> } 540 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 541 * 1. Mandatory parameters are left unspecified; 542 * 2. Incorrect parameter types; 543 * 3. Parameter verification failed. 544 * @syscap SystemCapability.BarrierFree.Accessibility.Core 545 * @systemapi 546 * @since 12 547 */ 548 findElement(type: 'textType', condition: string): Promise<Array<AccessibilityElement>>; 549 550 /** 551 * Find elements that match the condition. 552 * 553 * @param { 'elementId' } type The type of query condition is element id. 554 * @param { number } condition Indicates the specific content to be queried. 555 * @returns { Promise<AccessibilityElement> } 556 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 557 * 1. Mandatory parameters are left unspecified; 558 * 2. Incorrect parameter types; 559 * 3. Parameter verification failed. 560 * @syscap SystemCapability.BarrierFree.Accessibility.Core 561 * @systemapi 562 * @since 12 563 */ 564 findElement(type: 'elementId', condition: number): Promise<AccessibilityElement>; 565} 566 567/** 568 * Indicates the possible attributes of the element and the type of the attribute value. 569 * 570 * @syscap SystemCapability.BarrierFree.Accessibility.Core 571 * @since 9 572 */ 573/** 574 * Indicates the possible attributes of the element and the type of the attribute value. 575 * 576 * @typedef ElementAttributeValues 577 * @syscap SystemCapability.BarrierFree.Accessibility.Core 578 * @since 11 579 */ 580interface ElementAttributeValues { 581 /** 582 * Indicates accessibility focus state. 583 * 584 * @type {boolean} 585 * @syscap SystemCapability.BarrierFree.Accessibility.Core 586 * @since 9 587 */ 588 accessibilityFocused: boolean; 589 /** 590 * Indicates the bundle name to which it belongs. 591 * 592 * @type {string} 593 * @syscap SystemCapability.BarrierFree.Accessibility.Core 594 * @since 9 595 */ 596 bundleName: string; 597 /** 598 * Indicates whether the element is checkable. 599 * 600 * @type {boolean} 601 * @syscap SystemCapability.BarrierFree.Accessibility.Core 602 * @since 9 603 */ 604 checkable: boolean; 605 /** 606 * Indicates whether the element is checked. 607 * 608 * @type {boolean} 609 * @syscap SystemCapability.BarrierFree.Accessibility.Core 610 * @since 9 611 */ 612 checked: boolean; 613 /** 614 * Indicates all child elements. 615 * 616 * @type {Array<AccessibilityElement>} 617 * @syscap SystemCapability.BarrierFree.Accessibility.Core 618 * @since 9 619 */ 620 children: Array<AccessibilityElement>; 621 /** 622 * Indicates whether the element is clickable. 623 * 624 * @type {boolean} 625 * @syscap SystemCapability.BarrierFree.Accessibility.Core 626 * @since 9 627 */ 628 clickable: boolean; 629 /** 630 * Indicates the component ID to which the element belongs. 631 * 632 * @type {number} 633 * @syscap SystemCapability.BarrierFree.Accessibility.Core 634 * @since 9 635 */ 636 componentId: number; 637 /** 638 * Indicates the component type to which the element belongs. 639 * 640 * @type {string} 641 * @syscap SystemCapability.BarrierFree.Accessibility.Core 642 * @since 9 643 */ 644 componentType: string; 645 /** 646 * Indicates the content. 647 * 648 * @type {Array<string>} 649 * @syscap SystemCapability.BarrierFree.Accessibility.Core 650 * @since 9 651 */ 652 contents: Array<string>; 653 /** 654 * Indicates the index of the current item. 655 * 656 * @type {number} 657 * @syscap SystemCapability.BarrierFree.Accessibility.Core 658 * @since 9 659 */ 660 currentIndex: number; 661 /** 662 * Indicates the description of the element. 663 * 664 * @type {string} 665 * @syscap SystemCapability.BarrierFree.Accessibility.Core 666 * @since 9 667 */ 668 description: string; 669 /** 670 * Indicates whether the element is editable. 671 * 672 * @type {boolean} 673 * @syscap SystemCapability.BarrierFree.Accessibility.Core 674 * @since 9 675 */ 676 editable: boolean; 677 /** 678 * Indicates the list index of the last item displayed on the screen. 679 * 680 * @type {number} 681 * @syscap SystemCapability.BarrierFree.Accessibility.Core 682 * @since 9 683 */ 684 endIndex: number; 685 /** 686 * Indicates the string of error state. 687 * 688 * @type {string} 689 * @syscap SystemCapability.BarrierFree.Accessibility.Core 690 * @since 9 691 */ 692 error: string; 693 /** 694 * Indicates whether the element is focusable. 695 * 696 * @type {boolean} 697 * @syscap SystemCapability.BarrierFree.Accessibility.Core 698 * @since 9 699 */ 700 focusable: boolean; 701 /** 702 * Indicates the hint text. 703 * 704 * @type {string} 705 * @syscap SystemCapability.BarrierFree.Accessibility.Core 706 * @since 9 707 */ 708 hintText: string; 709 /** 710 * Indicates the type of input text. 711 * 712 * @type {number} 713 * @syscap SystemCapability.BarrierFree.Accessibility.Core 714 * @since 9 715 */ 716 inputType: number; 717 /** 718 * Indicates the inspector key. 719 * 720 * @type {string} 721 * @syscap SystemCapability.BarrierFree.Accessibility.Core 722 * @since 9 723 */ 724 inspectorKey: string; 725 /** 726 * Indicates whether the element is active or not. 727 * 728 * @type {boolean} 729 * @syscap SystemCapability.BarrierFree.Accessibility.Core 730 * @since 9 731 */ 732 isActive: boolean; 733 /** 734 * Indicates whether the element is enable or not. 735 * 736 * @type {boolean} 737 * @syscap SystemCapability.BarrierFree.Accessibility.Core 738 * @since 9 739 */ 740 isEnable: boolean; 741 /** 742 * Indicates whether the element is hint state or not. 743 * 744 * @type {boolean} 745 * @syscap SystemCapability.BarrierFree.Accessibility.Core 746 * @since 9 747 */ 748 isHint: boolean; 749 /** 750 * Indicates whether the element is focused or not. 751 * 752 * @type {boolean} 753 * @syscap SystemCapability.BarrierFree.Accessibility.Core 754 * @since 9 755 */ 756 isFocused: boolean; 757 /** 758 * Indicates whether the element is password or not. 759 * 760 * @type {boolean} 761 * @syscap SystemCapability.BarrierFree.Accessibility.Core 762 * @since 9 763 */ 764 isPassword: boolean; 765 /** 766 * Indicates whether the element is visible or not. 767 * 768 * @type {boolean} 769 * @syscap SystemCapability.BarrierFree.Accessibility.Core 770 * @since 9 771 */ 772 isVisible: boolean; 773 /** 774 * Indicates the total count of the items. 775 * 776 * @type {number} 777 * @syscap SystemCapability.BarrierFree.Accessibility.Core 778 * @since 9 779 */ 780 itemCount: number; 781 /** 782 * Indicates the last content. 783 * 784 * @type {string} 785 * @syscap SystemCapability.BarrierFree.Accessibility.Core 786 * @since 9 787 */ 788 lastContent: string; 789 /** 790 * Indicates the display layer of the element. 791 * 792 * @type {number} 793 * @syscap SystemCapability.BarrierFree.Accessibility.Core 794 * @since 9 795 */ 796 layer: number; 797 /** 798 * Indicates whether the element is long clickable. 799 * 800 * @type {boolean} 801 * @syscap SystemCapability.BarrierFree.Accessibility.Core 802 * @since 9 803 */ 804 longClickable: boolean; 805 /** 806 * Indicates the page id. 807 * 808 * @type {number} 809 * @syscap SystemCapability.BarrierFree.Accessibility.Core 810 * @since 9 811 */ 812 pageId: number; 813 /** 814 * Indicates the parent of the element. 815 * 816 * @type {AccessibilityElement} 817 * @syscap SystemCapability.BarrierFree.Accessibility.Core 818 * @since 9 819 */ 820 parent: AccessibilityElement; 821 /** 822 * Indicates whether the element supports multiple lines of text. 823 * 824 * @type {boolean} 825 * @syscap SystemCapability.BarrierFree.Accessibility.Core 826 * @since 9 827 */ 828 pluralLineSupported: boolean; 829 /** 830 * Indicates the area of the element. 831 * 832 * @type {Rect} 833 * @syscap SystemCapability.BarrierFree.Accessibility.Core 834 * @since 9 835 */ 836 rect: Rect; 837 /** 838 * Indicates the resource name of the element. 839 * 840 * @type {string} 841 * @syscap SystemCapability.BarrierFree.Accessibility.Core 842 * @since 9 843 */ 844 resourceName: string; 845 /** 846 * Indicates the root element of the window element. 847 * 848 * @type {AccessibilityElement} 849 * @syscap SystemCapability.BarrierFree.Accessibility.Core 850 * @since 9 851 */ 852 rootElement: AccessibilityElement; 853 /** 854 * Indicates the display area of the element. 855 * 856 * @type {Rect} 857 * @syscap SystemCapability.BarrierFree.Accessibility.Core 858 * @since 9 859 */ 860 screenRect: Rect; 861 /** 862 * Indicates whether the element is scrollable. 863 * 864 * @type {boolean} 865 * @syscap SystemCapability.BarrierFree.Accessibility.Core 866 * @since 9 867 */ 868 scrollable: boolean; 869 /** 870 * Indicates whether the element is selected. 871 * 872 * @type {boolean} 873 * @syscap SystemCapability.BarrierFree.Accessibility.Core 874 * @since 9 875 */ 876 selected: boolean; 877 /** 878 * Indicates the list index of the first item displayed on the screen. 879 * 880 * @type {number} 881 * @syscap SystemCapability.BarrierFree.Accessibility.Core 882 * @since 9 883 */ 884 startIndex: number; 885 /** 886 * Indicates the text of the element. 887 * 888 * @type {string} 889 * @syscap SystemCapability.BarrierFree.Accessibility.Core 890 * @since 9 891 */ 892 text: string; 893 /** 894 * Indicates the maximum length limit of the element text. 895 * 896 * @type {number} 897 * @syscap SystemCapability.BarrierFree.Accessibility.Core 898 * @since 9 899 */ 900 textLengthLimit: number; 901 /** 902 * Indicates the unit of movement of the element text as it is read. 903 * 904 * @type {accessibility.TextMoveUnit} 905 * @syscap SystemCapability.BarrierFree.Accessibility.Core 906 * @since 9 907 */ 908 textMoveUnit: accessibility.TextMoveUnit; 909 /** 910 * Indicates the action that triggered the element event. 911 * 912 * @type {accessibility.Action} 913 * @syscap SystemCapability.BarrierFree.Accessibility.Core 914 * @since 9 915 */ 916 triggerAction: accessibility.Action; 917 /** 918 * Indicates the window type of the element. 919 * 920 * @type {WindowType} 921 * @syscap SystemCapability.BarrierFree.Accessibility.Core 922 * @since 9 923 */ 924 type: WindowType; 925 /** 926 * Indicates the maximum value. 927 * 928 * @type {number} 929 * @syscap SystemCapability.BarrierFree.Accessibility.Core 930 * @since 9 931 */ 932 valueMax: number; 933 /** 934 * Indicates the minimum value. 935 * 936 * @type {number} 937 * @syscap SystemCapability.BarrierFree.Accessibility.Core 938 * @since 9 939 */ 940 valueMin: number; 941 /** 942 * Indicates the current value. 943 * 944 * @type {number} 945 * @syscap SystemCapability.BarrierFree.Accessibility.Core 946 * @since 9 947 */ 948 valueNow: number; 949 /** 950 * Indicates the window id. 951 * 952 * @type {number} 953 * @syscap SystemCapability.BarrierFree.Accessibility.Core 954 * @since 9 955 */ 956 windowId: number; 957 /** 958 * Indicates the offset. 959 * 960 * @type {number} 961 * @syscap SystemCapability.BarrierFree.Accessibility.Core 962 * @since 12 963 */ 964 offset: number; 965 /** 966 * Indicates the text type. 967 * 968 * @type {string} 969 * @syscap SystemCapability.BarrierFree.Accessibility.Core 970 * @since 12 971 */ 972 textType: string; 973 /** 974 * Indicates the accessibility text of component. 975 * 976 * @type {string} 977 * @syscap SystemCapability.BarrierFree.Accessibility.Core 978 * @since 12 979 */ 980 accessibilityText: string; 981 /** 982 * Indicates the hot area of the element. 983 * 984 * @type {Rect} 985 * @syscap SystemCapability.BarrierFree.Accessibility.Core 986 * @since 12 987 */ 988 hotArea: Rect; 989} 990 991/** 992 * Indicates the direction of the search focus. 993 * 994 * @typedef {'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'} 995 * @syscap SystemCapability.BarrierFree.Accessibility.Core 996 * @since 9 997 */ 998type FocusDirection = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'; 999 1000/** 1001 * Indicates the type of the focus. 1002 * 1003 * @typedef {'accessibility' | 'normal'} 1004 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1005 * @since 9 1006 */ 1007type FocusType = 'accessibility' | 'normal'; 1008 1009/** 1010 * Indicates the type of the window. 1011 * 1012 * @typedef {'application' | 'system'} 1013 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1014 * @since 9 1015 */ 1016type WindowType = 'application' | 'system'; 1017 1018/** 1019 * Indicates rectangle. 1020 * 1021 * @typedef Rect 1022 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1023 * @since 9 1024 */ 1025interface Rect { 1026 /** 1027 * The left position of Rect 1028 * 1029 * @type { number } 1030 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1031 * @since 9 1032 */ 1033 left: number; 1034 /** 1035 * The top position of Rect 1036 * 1037 * @type { number } 1038 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1039 * @since 9 1040 */ 1041 top: number; 1042 /** 1043 * The width position of Rect 1044 * 1045 * @type { number } 1046 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1047 * @since 9 1048 */ 1049 width: number; 1050 /** 1051 * The height position of Rect 1052 * 1053 * @type { number } 1054 * @syscap SystemCapability.BarrierFree.Accessibility.Core 1055 * @since 9 1056 */ 1057 height: number; 1058} 1059