/* * Copyright (c) 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 * @kit AccessibilityKit */ import type accessibility from './@ohos.accessibility'; import type { AsyncCallback, Callback } from './@ohos.base'; /** * Configuration of the accessibility. * * @namespace config * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ declare namespace config { /** * @constant * Indicates the configuration of daltonization state. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ const daltonizationState: Config; /** * @constant * Indicates the configuration of audio mono. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 10 */ const audioMono: Config; /** * @constant * Indicates the configuration of audio balance. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 10 */ const audioBalance: Config; /** * Indicates the configuration of high-contrast text. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var highContrastText: Config; /** * Indicates the configuration of invert color. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var invertColor: Config; /** * Indicates the configuration of daltonization color filter. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var daltonizationColorFilter: Config; /** * Indicates the configuration of content timeout. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var contentTimeout: Config; /** * Indicates the configuration of animation state. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var animationOff: Config; /** * Indicates the configuration of brightness discount. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var brightnessDiscount: Config; /** * Indicates the configuration of mouse key state. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var mouseKey: Config; /** * Indicates the configuration of mouse auto click. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var mouseAutoClick: Config; /** * Indicates the configuration of short key state. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var shortkey: Config; /** * Indicates the configuration of short key target. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var shortkeyTarget: Config; /** * Indicates the configuration of short key multi targets. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ const shortkeyMultiTargets: Config>; /** * Indicates the configuration of captions state. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var captions: Config; /** * Indicates the configuration of captions style. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ var captionsStyle: Config; /** * Indicates the configuration of click response time. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ const clickResponseTime: Config; /** * Indicates the configuration of ignore repeat click. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ const ignoreRepeatClick: Config; /** * Indicates the configuration of ignore repeat click interval. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ const repeatClickInterval: Config; /** * Enable the accessibility extension ability. * * @permission ohos.permission.WRITE_ACCESSIBILITY_CONFIG * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. * @param { Array } capability Indicates the ability. * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. * @throws { BusinessError } 9300002 - Target ability already enabled. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ function enableAbility(name: string, capability: Array): Promise; /** * Enable the accessibility extension ability. * * @permission ohos.permission.WRITE_ACCESSIBILITY_CONFIG * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. * @param { Array } capability Indicates the ability. * @param { AsyncCallback } callback * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. * @throws { BusinessError } 9300002 - Target ability already enabled. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ function enableAbility( name: string, capability: Array, callback: AsyncCallback ): void; /** * Disable the accessibility extension ability. * * @permission ohos.permission.WRITE_ACCESSIBILITY_CONFIG * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ function disableAbility(name: string): Promise; /** * Disable the accessibility extension ability. * * @permission ohos.permission.WRITE_ACCESSIBILITY_CONFIG * @param { string } name Indicates the accessibility extension name, in "bundleName/abilityName" format. * @param { AsyncCallback } callback * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ function disableAbility(name: string, callback: AsyncCallback): void; /** * Register the listener that watches for changes in the enabled status of accessibility extensions. * * @permission ohos.permission.READ_ACCESSIBILITY_CONFIG * @param { 'enabledAccessibilityExtensionListChange' } type Indicates the type of event. * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ function on(type: 'enabledAccessibilityExtensionListChange', callback: Callback): void; /** * Unregister listener that watches for changes in the enabled status of accessibility extensions. * * @permission ohos.permission.READ_ACCESSIBILITY_CONFIG * @param { 'enabledAccessibilityExtensionListChange' } type Indicates the type of event. * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback): void; /** * Indicates setting, getting, and listening to changes in configuration. * * @typedef Config * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ interface Config { /** * Setting configuration value. * * @permission ohos.permission.WRITE_ACCESSIBILITY_CONFIG * @param { T } value Indicates the value. * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ set(value: T): Promise; /** * Setting configuration value. * * @permission ohos.permission.WRITE_ACCESSIBILITY_CONFIG * @param { T } value Indicates the value. * @param { AsyncCallback } callback * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ set(value: T, callback: AsyncCallback): void; /** * Getting configuration value. * * @returns { Promise } * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ get(): Promise; /** * Getting configuration value. * * @param { AsyncCallback } callback * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ get(callback: AsyncCallback): void; /** * Register the listener to listen for configuration changes. * * @permission ohos.permission.READ_ACCESSIBILITY_CONFIG * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter error. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ on(callback: Callback): void; /** * Unregister the listener to listen for configuration changes. * * @permission ohos.permission.READ_ACCESSIBILITY_CONFIG * @param { Callback } callback Indicates the listener. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ off(callback?: Callback): void; } /** * Indicates the type of daltonization color filter. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 9 */ type DaltonizationColorFilter = 'Normal' | 'Protanomaly' | 'Deuteranomaly' | 'Tritanomaly'; /** * Indicates the type of click response time. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ type ClickResponseTime = 'Short' | 'Medium' | 'Long'; /** * Indicates the type of ignore repeat click interval. * * @syscap SystemCapability.BarrierFree.Accessibility.Core * @systemapi * @since 11 */ type RepeatClickInterval = 'Shortest' | 'Short' | 'Medium' | 'Long' | 'Longest'; } export default config;