Ai
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
AccessibilityExtensionContext.d.ts 63.17 KB
一键复制 编辑 原始数据 按行查看 历史
小发发 提交于 2025-09-04 10:34 +08:00 . description
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file Provides accessibility extension context
* @kit AccessibilityKit
*/
import type { AsyncCallback, BusinessError, Callback } from '../@ohos.base';
import ExtensionContext from './ExtensionContext';
import type accessibility from '../@ohos.accessibility';
import type { GesturePath } from '../@ohos.accessibility.GesturePath';
import type Want from '../@ohos.app.ability.Want';
import { AccessibilityAction } from '../@ohos.accessibility';
/**
* The accessibility extension context. Used to configure, query information, and inject gestures.
*
* @extends ExtensionContext
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
export default class AccessibilityExtensionContext extends ExtensionContext {
/**
* Set the bundle names that is interested in sending the event.
*
* @param { Array<string> } targetNames The bundle names that are interested in sending the event.
* @param { AsyncCallback<void> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
setTargetBundleName(targetNames: Array<string>, callback: AsyncCallback<void>): void;
/**
* Set the bundle names that is interested in sending the event.
*
* @param { Array<string> } targetNames The bundle names that are interested in sending the event.
* @returns { Promise<void> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
setTargetBundleName(targetNames: Array<string>): Promise<void>;
/**
* Get focus element.
*
* @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus.
* @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback<AccessibilityElement>): void;
/**
* Get focus element.
*
* @param { boolean } isAccessibilityFocus Indicates whether the acquired element has an accessibility focus.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getFocusElement(isAccessibilityFocus?: boolean): Promise<AccessibilityElement>;
/**
* Get focus element.
* @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getFocusElement(callback: AsyncCallback<AccessibilityElement>): void;
/**
* Get window root element.
*
* @param { number } windowId Indicates the window ID.
* @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getWindowRootElement(windowId: number, callback: AsyncCallback<AccessibilityElement>): void;
/**
* Get window root element.
*
* @param { number } [windowId] Indicates the window ID.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getWindowRootElement(windowId?: number): Promise<AccessibilityElement>;
/**
* Get window root element.
* @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getWindowRootElement(callback: AsyncCallback<AccessibilityElement>): void;
/**
* Get window list.
*
* @param { number } displayId Indicates the display ID.
* @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getWindows(displayId: number, callback: AsyncCallback<Array<AccessibilityElement>>): void;
/**
* Get window list.
*
* @param { number } displayId Indicates the display ID.
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getWindows(displayId?: number): Promise<Array<AccessibilityElement>>;
/**
* Get window list.
* @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
getWindows(callback: AsyncCallback<Array<AccessibilityElement>>): void;
/**
* Inject gesture path events.
*
* @param { GesturePath } gesturePath Indicates the gesture path.
* @param { AsyncCallback<void> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 10
* @useinstead AccessibilityExtensionContext/AccessibilityExtensionContext#injectGestureSync
*/
injectGesture(gesturePath: GesturePath, callback: AsyncCallback<void>): void;
/**
* Inject gesture path events.
*
* @param { GesturePath } gesturePath Indicates the gesture path.
* @returns { Promise<void> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 10
* @useinstead AccessibilityExtensionContext/AccessibilityExtensionContext#injectGestureSync
*/
injectGesture(gesturePath: GesturePath): Promise<void>;
/**
* Inject gesture path events.
*
* @param { GesturePath } gesturePath Indicates the gesture path.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 10
* @deprecated since 12
*/
injectGestureSync(gesturePath: GesturePath): void;
/**
* Starts a new ability.
*
* @param { Want } want - Indicates the start options.
* @returns { Promise<void> }
* @throws { BusinessError } 201 - The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 12
*/
startAbility(want: Want): Promise<void>;
/**
* get all subElements in window.
* @param { number } windowId Indicates the window ID.
* @param { number } elementId Indicates the elementId.
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 18
*/
getElements(windowId: number, elementId?: number): Promise<Array<AccessibilityElement>>;
/**
* Get default focused element ids.
* @param { number } windowId Indicates whether the windowid can be used as the default focus.
* @returns { Promise<Array<number>> }
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 18
*/
getDefaultFocusedElementIds(windowId: number): Promise<Array<number>>;
/**
* Hold running lock to prevent screen turning off automatically.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
holdRunningLockSync(): void;
/**
* Unhold running lock.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
unholdRunningLockSync(): void;
/**
* Register accessibilityExtensionAbility disconnect callback.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { 'preDisconnect' } type Indicates the accessibilityExtensionAbility pre disconnect.
* @param { Callback<void> } callback Indicates the callback function.
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
on(type: 'preDisconnect', callback: Callback<void>): void;
/**
* Unregister accessibilityExtensionAbility disconnect callback.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { 'preDisconnect' } type Indicates the accessibilityExtensionAbility pre disconnect.
* @param { Callback<void> } callback Indicates the callback function.
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
off(type: 'preDisconnect', callback?: Callback<void>): void;
/**
* Notify accessibility when accessibilityExtensionAbility is ready to disconnect.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
notifyDisconnect(): void;
/**
* Get accessibility focused element.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
getAccessibilityFocusedElement(): Promise<AccessibilityElement>;
/**
* Get window root element.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { number } [windowId] Indicates the window ID.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
getRootInActiveWindow(windowId?: number): Promise<AccessibilityElement>;
/**
* Get window list.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { number } [displayId] Indicates the display ID. If this parameter is not provided, indicates the default displayId.
* @returns { Array<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
getAccessibilityWindowsSync(displayId?: number): Array<AccessibilityElement>;
}
/**
* Indicates an accessibility element.
* Supports querying element attributes, requesting execution actions, and finding child elements by condition.
*
* @typedef AccessibilityElement
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
declare interface AccessibilityElement {
/**
* Get a list of attribute names.
*
* @param { AsyncCallback<Array<T>> } callback Indicates the listener.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
attributeNames<T extends keyof ElementAttributeValues>(callback: AsyncCallback<Array<T>>): void;
/**
* Get a list of attribute names.
* @returns { Promise<Array<T>> }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
attributeNames<T extends keyof ElementAttributeValues>(): Promise<Array<T>>;
/**
* Get the value of an attribute.
*
* @param { T } attributeName Indicates the attribute name.
* @param { AsyncCallback<ElementAttributeValues[T]> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300004 - This property does not exist.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
attributeValue<T extends keyof ElementAttributeValues>(
attributeName: T,
callback: AsyncCallback<ElementAttributeValues[T]>
): void;
/**
* Get the value of an attribute.
*
* @param { T } attributeName Indicates the attribute name.
* @returns { Promise<ElementAttributeValues[T]> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300004 - This property does not exist.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
attributeValue<T extends keyof ElementAttributeValues>(attributeName: T): Promise<ElementAttributeValues[T]>;
/**
* Get a list of supported actions.
*
* @param { AsyncCallback<Array<string>> } callback Indicates the listener.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
actionNames(callback: AsyncCallback<Array<string>>): void;
/**
* Get a list of supported actions.
*
* @returns { Promise<Array<string>> }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
actionNames(): Promise<Array<string>>;
/**
* Perform the specified action.
*
* @param { string } actionName Indicates the action name.
* @param { object } parameters Indicates the parameters needed to execute the action.
* @param { AsyncCallback<void> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300005 - This action is not supported.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
performAction(actionName: string, parameters: object, callback: AsyncCallback<void>): void;
/**
* Perform the specified action.
*
* @param { string } actionName Indicates the action name.
* @param { object } parameters Indicates the parameters needed to execute the action.
* @returns { Promise<void> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300005 - This action is not supported.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
performAction(actionName: string, parameters?: object): Promise<void>;
/**
* Perform the specified action.
*
* @param { string } actionName Indicates the action name.
* @param { AsyncCallback<void> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300005 - This action is not supported.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
performAction(actionName: string, callback: AsyncCallback<void>): void;
/**
* Get the position of cursor in TextInput.
*
* @param { AsyncCallback<number> } callback Indicates the listener.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 12
*/
getCursorPosition(callback: AsyncCallback<number>): void;
/**
* Get the position of cursor in TextInput.
*
* @returns { Promise<number> }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 12
*/
getCursorPosition(): Promise<number>;
/**
* Set the screen curtain enable or disable.
*
* @param { boolean } isEnable Indicates whether the screen curtain is enabled.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 9300003 - No accessibility permission to perform the operation.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 12
*/
enableScreenCurtain(isEnable: boolean): void;
/**
* Find elements that match the condition.
*
* @param { 'content' } type The type of query condition is content.
* @param { string } condition Indicates the specific content to be queried.
* @param { AsyncCallback<Array<AccessibilityElement>> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
findElement(type: 'content', condition: string, callback: AsyncCallback<Array<AccessibilityElement>>): void;
/**
* Find elements that match the condition.
*
* @param { 'content' } type The type of query condition is content.
* @param { string } condition Indicates the specific content to be queried.
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
findElement(type: 'content', condition: string): Promise<Array<AccessibilityElement>>;
/**
* Find elements that match the condition.
*
* @param { 'focusType' } type The type of query condition is focus type.
* @param { FocusType } condition Indicates the type of focus to query.
* @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback<AccessibilityElement>): void;
/**
* Find elements that match the condition.
*
* @param { 'focusType' } type The type of query condition is focus type.
* @param { FocusType } condition Indicates the type of focus to query.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
findElement(type: 'focusType', condition: FocusType): Promise<AccessibilityElement>;
/**
* Find elements that match the condition.
*
* @param { 'focusDirection' } type The type of query condition is focus direction.
* @param { FocusDirection } condition Indicates the direction of search focus to query.
* @param { AsyncCallback<AccessibilityElement> } callback Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback<AccessibilityElement>): void;
/**
* Find elements that match the condition.
*
* @param { 'focusDirection' } type The type of query condition is focus direction.
* @param { FocusDirection } condition Indicates the direction of search focus to query.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
* @deprecated since 12
*/
findElement(type: 'focusDirection', condition: FocusDirection): Promise<AccessibilityElement>;
/**
* Find elements that match the condition.
*
* @param { 'textType' } type The type of query condition is text type.
* @param { string } condition Indicates the specific content to be queried.
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 12
*/
findElement(type: 'textType', condition: string): Promise<Array<AccessibilityElement>>;
/**
* Find elements that match the condition.
*
* @param { 'elementId' } type The type of query condition is element id.
* @param { number } condition Indicates the specific content to be queried.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 12
*/
findElement(type: 'elementId', condition: number): Promise<AccessibilityElement>;
/**
* Indicates accessibility focus state.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityFocused?: boolean;
/**
* Indicates the bundle name to which it belongs.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
bundleName?: string;
/**
* Indicates whether the element is checkable.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
checkable?: boolean;
/**
* Indicates whether the element is checked.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
checked?: boolean;
/**
* Indicates whether the element is clickable.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
clickable?: boolean;
/**
* Indicates the component ID to which the element belongs.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
componentId?: number;
/**
* Indicates the component type to which the element belongs.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
componentType?: string;
/**
* Indicates the content.
*
* @type { ?Array<string> }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
contents?: Array<string>;
/**
* Indicates the index of the current item.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
currentIndex?: number;
/**
* Indicates the description of the element.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
description?: string;
/**
* Indicates whether the element is editable.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
editable?: boolean;
/**
* Indicates the list index of the last item displayed on the screen.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
endIndex?: number;
/**
* Indicates the string of error state.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
error?: string;
/**
* Indicates whether the element is focusable.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
focusable?: boolean;
/**
* Indicates the hint text.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
hintText?: string;
/**
* Indicates the type of input text.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
inputType?: number;
/**
* Indicates the inspector key.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
inspectorKey?: string;
/**
* Indicates whether the element is active or not.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
isActive?: boolean;
/**
* Indicates whether the element is enable or not.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
isEnable?: boolean;
/**
* Indicates whether the element is hint state or not.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
isHint?: boolean;
/**
* Indicates whether the element is focused or not.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
isFocused?: boolean;
/**
* Indicates whether the element is password or not.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
isPassword?: boolean;
/**
* Indicates whether the element is visible or not.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
isVisible?: boolean;
/**
* Indicates the total count of the items.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
itemCount?: number;
/**
* Indicates the last content.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
lastContent?: string;
/**
* Indicates the display layer of the element.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
layer?: number;
/**
* Indicates whether the element is long clickable.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
longClickable?: boolean;
/**
* Indicates the page id.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
pageId?: number;
/**
* Indicates whether the element supports multiple lines of text.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
pluralLineSupported?: boolean;
/**
* Indicates the area of the element.
*
* @type { ?Rect }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
rect?: Rect;
/**
* Indicates the resource name of the element.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
resourceName?: string;
/**
* Indicates the display area of the element.
*
* @type { ?Rect }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
screenRect?: Rect;
/**
* Indicates whether the element is scrollable.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
scrollable?: boolean;
/**
* Indicates whether the element is selected.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
selected?: boolean;
/**
* Indicates the list index of the first item displayed on the screen.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
startIndex?: number;
/**
* Indicates the text of the element.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
text?: string;
/**
* Indicates the maximum length limit of the element text.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
textLengthLimit?: number;
/**
* Indicates the unit of movement of the element text as it is read.
*
* @type { ?accessibility.TextMoveUnit }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
textMoveUnit?: accessibility.TextMoveUnit;
/**
* Indicates the action that triggered the element event.
*
* @type { ?AccessibilityAction }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
triggerAction?: AccessibilityAction;
/**
* Indicates the window type of the element.
*
* @type { ?WindowType }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
type?: WindowType;
/**
* Indicates the maximum value.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
valueMax?: number;
/**
* Indicates the minimum value.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
valueMin?: number;
/**
* Indicates the current value.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
valueNow?: number;
/**
* Indicates the window id.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
windowId?: number;
/**
* Indicates the offset.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
offset?: number;
/**
* Indicates the text type.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
textType?: string;
/**
* Indicates the accessibility text of component.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityText?: string;
/**
* Indicates the hot area of the element.
*
* @type { ?Rect }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
hotArea?: Rect;
/**
* Indicates the custom component type.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
customComponentType?: string;
/**
* Indicates the component next accessibility focus id.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityNextFocusId?: number;
/**
* Indicates the component previous accessibility focus id.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityPreviousFocusId?: number;
/**
* Indicates the extra info of the element.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
extraInfo?: string;
/**
* Indicates whether the element is scrollable for accessibility.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityScrollable?: boolean;
/**
* Indicates actions the element support.
*
* @type { ?Array<string> }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
supportedActionNames?: Array<string>;
/**
* Indicates whether the element is accessibilityGroup.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityGroup?: boolean;
/**
* Indicates the accessibilityLevel of component.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityLevel?: string;
/**
* Indicates the navDestination id of component.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
navDestinationId?: number;
/**
* Indicates the current item in grid of component.
*
* @type { ?AccessibilityGrid }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
currentItem?: AccessibilityGrid;
/**
* Indicates the span array of component.
*
* @type { ?AccessibilitySpan[] }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
spans?: AccessibilitySpan[];
/**
* Indicates whether the component is accessibility visible.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityVisible?: boolean;
/**
* Indicates the main windowId of component.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
mainWindowId?: number;
/**
* Indicates whether the component need clip.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
clip?: boolean;
/**
* Indicates the parent element id of component.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
parentId?: number;
/**
* Indicates the children elements id list of component.
*
* @type { ?Array<number> }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
childrenIds?: Array<number>;
/**
* Execute the specified action.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { AccessibilityAction } action Indicates the action to execute.
* @param { Parameter } [parameters] Indicates the parameters needed to execute the action.
* @returns { Promise<void> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300005 - This action is not supported.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
executeAction(action: AccessibilityAction, parameters?: Parameter): Promise<void>;
/**
* Get element's parent.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
getParent(): Promise<AccessibilityElement>;
/**
* Get element's children.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
getChildren(): Promise<Array<AccessibilityElement>>;
/**
* Get element's root.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
getRoot(): Promise<AccessibilityElement>;
/**
* Find elements that match the condition.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { string } condition Indicates the specific content to be queried.
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
findElementByContent(condition: string): Promise<Array<AccessibilityElement>>;
/**
* Find elements that match the focus direction.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { FocusDirection } condition Indicates the direction of search focus to query.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
findElementByFocusDirection(condition: FocusDirection): Promise<AccessibilityElement>;
/**
* Find elements that match the condition.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { string } condition Indicates the specific json string to be queried.
* @returns { Promise<Array<AccessibilityElement>> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
findElementsByAccessibilityHintText(condition: string): Promise<Array<AccessibilityElement>>;
/**
* Find elements that match the elementId.
*
* @permission ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY
* @param { number } condition Indicates the elementId to query.
* @returns { Promise<AccessibilityElement> }
* @throws { BusinessError } 201 - Permission verification failed.The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 9300006 - The target application failed to connect to accessibility service.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
findElementById(condition: number): Promise<AccessibilityElement>;
}
/**
* Indicates grid info.
*
* @typedef AccessibilityGrid
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
interface AccessibilityGrid {
/**
* The row index in grid.
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
rowIndex: number;
/**
* The colum index in grid.
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
columnIndex: number;
}
/**
* Indicates span info.
*
* @typedef AccessibilitySpan
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
interface AccessibilitySpan {
/**
* The id of span.
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
spanId: number;
/**
* The text of span.
*
* @type { string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
spanText: string;
/**
* The accessibility text of span.
*
* @type { string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityText: string;
/**
* The accessibility description of span.
*
* @type { string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityDescription: string;
/**
* The accessibility level of span.
*
* @type { string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
accessibilityLevel: string;
}
/**
* Indicates the parameter of the AccessibiltyAction.
*
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
export declare class Parameter {
/**
* Indicates the text to set for AccessibilityAction.SET_TEXT.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
setText?: string;
/**
* Indicates the begin position of select text for AccessibilityAction.SET_SELECTION.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
selectTextBegin?: string;
/**
* Indicates the end position of select text for AccessibilityAction.SET_SELECTION.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
selectTextEnd?: string;
/**
* Indicates the direction of select text for AccessibilityAction.SET_SELECTION.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
selectTextInForWard?: boolean;
/**
* Indicates the cursor position for AccessibilityAction.SET_CURSOR_POSITION.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
offset?: string;
/**
* Indicates the span id for AccessibilityAction.SPAN_CLICK.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
spanId?: string;
/**
* Indicates the scroll type for AccessibilityAction.SCROLL_FORWARD and AccessibilityAction.SCROLL_BACKWARD.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @systemapi
* @since 20
*/
scrollType?: string;
}
/**
* Indicates the possible attributes of the element and the type of the attribute value.
*
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
/**
* Indicates the possible attributes of the element and the type of the attribute value.
*
* @typedef ElementAttributeValues
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 11
*/
interface ElementAttributeValues {
/**
* Indicates accessibility focus state.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
accessibilityFocused: boolean;
/**
* Indicates the bundle name to which it belongs.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
bundleName: string;
/**
* Indicates whether the element is checkable.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
checkable: boolean;
/**
* Indicates whether the element is checked.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
checked: boolean;
/**
* Indicates all child elements.
*
* @type {Array<AccessibilityElement>}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
children: Array<AccessibilityElement>;
/**
* Indicates whether the element is clickable.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
clickable: boolean;
/**
* Indicates the component ID to which the element belongs.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
componentId: number;
/**
* Indicates the component type to which the element belongs.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
componentType: string;
/**
* Indicates the content.
*
* @type {Array<string>}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
contents: Array<string>;
/**
* Indicates the index of the current item.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
currentIndex: number;
/**
* Indicates the description of the element.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
description: string;
/**
* Indicates whether the element is editable.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
editable: boolean;
/**
* Indicates the list index of the last item displayed on the screen.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
endIndex: number;
/**
* Indicates the string of error state.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
error: string;
/**
* Indicates whether the element is focusable.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
focusable: boolean;
/**
* Indicates the hint text.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
hintText: string;
/**
* Indicates the type of input text.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
inputType: number;
/**
* Indicates the inspector key.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
inspectorKey: string;
/**
* Indicates whether the element is active or not.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
isActive: boolean;
/**
* Indicates whether the element is enable or not.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
isEnable: boolean;
/**
* Indicates whether the element is hint state or not.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
isHint: boolean;
/**
* Indicates whether the element is focused or not.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
isFocused: boolean;
/**
* Indicates whether the element is password or not.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
isPassword: boolean;
/**
* Indicates whether the element is visible or not.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
isVisible: boolean;
/**
* Indicates the total count of the items.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
itemCount: number;
/**
* Indicates the last content.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
lastContent: string;
/**
* Indicates the display layer of the element.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
layer: number;
/**
* Indicates whether the element is long clickable.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
longClickable: boolean;
/**
* Indicates the page id.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
pageId: number;
/**
* Indicates the parent of the element.
*
* @type {AccessibilityElement}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
parent: AccessibilityElement;
/**
* Indicates whether the element supports multiple lines of text.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
pluralLineSupported: boolean;
/**
* Indicates the area of the element.
*
* @type {Rect}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
rect: Rect;
/**
* Indicates the resource name of the element.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
resourceName: string;
/**
* Indicates the root element of the window element.
*
* @type {AccessibilityElement}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
rootElement: AccessibilityElement;
/**
* Indicates the display area of the element.
*
* @type {Rect}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
screenRect: Rect;
/**
* Indicates whether the element is scrollable.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
scrollable: boolean;
/**
* Indicates whether the element is selected.
*
* @type {boolean}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
selected: boolean;
/**
* Indicates the list index of the first item displayed on the screen.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
startIndex: number;
/**
* Indicates the text of the element.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
text: string;
/**
* Indicates the maximum length limit of the element text.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
textLengthLimit: number;
/**
* Indicates the unit of movement of the element text as it is read.
*
* @type {accessibility.TextMoveUnit}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
textMoveUnit: accessibility.TextMoveUnit;
/**
* Indicates the action that triggered the element event.
*
* @type {accessibility.Action}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
triggerAction: accessibility.Action;
/**
* Indicates the window type of the element.
*
* @type {WindowType}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
type: WindowType;
/**
* Indicates the maximum value.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
valueMax: number;
/**
* Indicates the minimum value.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
valueMin: number;
/**
* Indicates the current value.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
valueNow: number;
/**
* Indicates the window id.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
windowId: number;
/**
* Indicates the offset.
*
* @type {number}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 12
*/
offset: number;
/**
* Indicates the text type.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 12
*/
textType: string;
/**
* Indicates the accessibility text of component.
*
* @type {string}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 12
*/
accessibilityText: string;
/**
* Indicates the hot area of the element.
*
* @type {Rect}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 12
*/
hotArea: Rect;
/**
* Indicates the component next accessibility focus id.
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 18
*/
accessibilityNextFocusId?: number;
/**
* Indicates the custom component type.
*
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 18
*/
customComponentType?: string;
/**
* Indicates the extra info of the element.
* @type { ?string }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 18
*/
extraInfo?: string;
/**
* Indicates the component Previous accessibility focus id.
*
* @type { ?number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 18
*/
accessibilityPreviousFocusId?: number;
/**
* Indicates whether the element is scrollable for accessibility.
*
* @type { ?boolean }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 18
*/
accessibilityScrollable?: boolean;
}
/**
* Indicates the direction of the search focus.
*
* @typedef {'up' | 'down' | 'left' | 'right' | 'forward' | 'backward'}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
type FocusDirection = 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
/**
* Indicates the type of the focus.
*
* @typedef {'accessibility' | 'normal'}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
type FocusType = 'accessibility' | 'normal';
/**
* Indicates the type of the window.
*
* @typedef {'application' | 'system'}
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
type WindowType = 'application' | 'system';
/**
* Indicates rectangle.
*
* @typedef Rect
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
interface Rect {
/**
* The left position of Rect
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
left: number;
/**
* The top position of Rect
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
top: number;
/**
* The width position of Rect
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
width: number;
/**
* The height position of Rect
*
* @type { number }
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
height: number;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助