161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"), 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit AbilityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AbilityResult } from './ability/abilityResult'; 2261847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base'; 2361847f8eSopenharmony_ciimport { Configuration } from './@ohos.app.ability.Configuration'; 2461847f8eSopenharmony_ciimport Context from './application/Context'; 2561847f8eSopenharmony_ciimport { AbilityRunningInfo as _AbilityRunningInfo } from './application/AbilityRunningInfo'; 2661847f8eSopenharmony_ciimport { ExtensionRunningInfo as _ExtensionRunningInfo } from './application/ExtensionRunningInfo'; 2761847f8eSopenharmony_ciimport { ElementName } from './bundleManager/ElementName'; 2861847f8eSopenharmony_ciimport * as _AbilityForegroundStateObserver from './application/AbilityForegroundStateObserver'; 2961847f8eSopenharmony_ciimport * as _AbilityStateData from './application/AbilityStateData'; 3061847f8eSopenharmony_ci 3161847f8eSopenharmony_ci/** 3261847f8eSopenharmony_ci * The class of an ability manager. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @namespace abilityManager 3561847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 3661847f8eSopenharmony_ci * @systemapi 3761847f8eSopenharmony_ci * @since 9 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_cideclare namespace abilityManager { 4061847f8eSopenharmony_ci /** 4161847f8eSopenharmony_ci * Enum for the ability state. 4261847f8eSopenharmony_ci * 4361847f8eSopenharmony_ci * @enum { number } 4461847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 4561847f8eSopenharmony_ci * @systemapi 4661847f8eSopenharmony_ci * @since 9 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_ci export enum AbilityState { 4961847f8eSopenharmony_ci /** 5061847f8eSopenharmony_ci * Ability is initialized. 5161847f8eSopenharmony_ci * 5261847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 5361847f8eSopenharmony_ci * @systemapi 5461847f8eSopenharmony_ci * @since 9 5561847f8eSopenharmony_ci */ 5661847f8eSopenharmony_ci INITIAL = 0, 5761847f8eSopenharmony_ci 5861847f8eSopenharmony_ci /** 5961847f8eSopenharmony_ci * Ability is in the state of getting focus. 6061847f8eSopenharmony_ci * 6161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 6261847f8eSopenharmony_ci * @systemapi 6361847f8eSopenharmony_ci * @since 9 6461847f8eSopenharmony_ci */ 6561847f8eSopenharmony_ci FOCUS = 2, 6661847f8eSopenharmony_ci 6761847f8eSopenharmony_ci /** 6861847f8eSopenharmony_ci * Ability is in the foreground state. 6961847f8eSopenharmony_ci * 7061847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 7161847f8eSopenharmony_ci * @systemapi 7261847f8eSopenharmony_ci * @since 9 7361847f8eSopenharmony_ci */ 7461847f8eSopenharmony_ci FOREGROUND = 9, 7561847f8eSopenharmony_ci 7661847f8eSopenharmony_ci /** 7761847f8eSopenharmony_ci * Ability is in the background state. 7861847f8eSopenharmony_ci * 7961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 8061847f8eSopenharmony_ci * @systemapi 8161847f8eSopenharmony_ci * @since 9 8261847f8eSopenharmony_ci */ 8361847f8eSopenharmony_ci BACKGROUND = 10, 8461847f8eSopenharmony_ci 8561847f8eSopenharmony_ci /** 8661847f8eSopenharmony_ci * Ability is in the process of scheduling at the foreground. 8761847f8eSopenharmony_ci * 8861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 8961847f8eSopenharmony_ci * @systemapi 9061847f8eSopenharmony_ci * @since 9 9161847f8eSopenharmony_ci */ 9261847f8eSopenharmony_ci FOREGROUNDING = 11, 9361847f8eSopenharmony_ci 9461847f8eSopenharmony_ci /** 9561847f8eSopenharmony_ci * Ability is in the process of scheduling in the background. 9661847f8eSopenharmony_ci * 9761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 9861847f8eSopenharmony_ci * @systemapi 9961847f8eSopenharmony_ci * @since 9 10061847f8eSopenharmony_ci */ 10161847f8eSopenharmony_ci BACKGROUNDING = 12 10261847f8eSopenharmony_ci } 10361847f8eSopenharmony_ci 10461847f8eSopenharmony_ci /** 10561847f8eSopenharmony_ci * Enum for the user status. 10661847f8eSopenharmony_ci * 10761847f8eSopenharmony_ci * @enum { number } 10861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 10961847f8eSopenharmony_ci * @systemapi 11061847f8eSopenharmony_ci * @stagemodelonly 11161847f8eSopenharmony_ci * @since 12 11261847f8eSopenharmony_ci */ 11361847f8eSopenharmony_ci export enum UserStatus { 11461847f8eSopenharmony_ci /** 11561847f8eSopenharmony_ci * Indicates the status of the operation that the user clicks to terminate. 11661847f8eSopenharmony_ci * 11761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 11861847f8eSopenharmony_ci * @systemapi 11961847f8eSopenharmony_ci * @stagemodelonly 12061847f8eSopenharmony_ci * @since 12 12161847f8eSopenharmony_ci */ 12261847f8eSopenharmony_ci ASSERT_TERMINATE = 0, 12361847f8eSopenharmony_ci 12461847f8eSopenharmony_ci /** 12561847f8eSopenharmony_ci * Indicates the status of the operation that the user clicks to continue. 12661847f8eSopenharmony_ci * 12761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 12861847f8eSopenharmony_ci * @systemapi 12961847f8eSopenharmony_ci * @stagemodelonly 13061847f8eSopenharmony_ci * @since 12 13161847f8eSopenharmony_ci */ 13261847f8eSopenharmony_ci ASSERT_CONTINUE = 1, 13361847f8eSopenharmony_ci 13461847f8eSopenharmony_ci /** 13561847f8eSopenharmony_ci * Indicates the status of the operation that the user clicks to retry. 13661847f8eSopenharmony_ci * 13761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 13861847f8eSopenharmony_ci * @systemapi 13961847f8eSopenharmony_ci * @stagemodelonly 14061847f8eSopenharmony_ci * @since 12 14161847f8eSopenharmony_ci */ 14261847f8eSopenharmony_ci ASSERT_RETRY = 2 14361847f8eSopenharmony_ci } 14461847f8eSopenharmony_ci 14561847f8eSopenharmony_ci /** 14661847f8eSopenharmony_ci * Register Ability foreground or background state observer. 14761847f8eSopenharmony_ci * 14861847f8eSopenharmony_ci * @permission ohos.permission.RUNNING_STATE_OBSERVER 14961847f8eSopenharmony_ci * @param { 'abilityForegroundState' } type - ability foreground or background state. 15061847f8eSopenharmony_ci * @param { AbilityForegroundStateObserver } observer - The ability foreground state observer. 15161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 15261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 15361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 15461847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 15561847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 15661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 15761847f8eSopenharmony_ci * @systemapi 15861847f8eSopenharmony_ci * @since 11 15961847f8eSopenharmony_ci */ 16061847f8eSopenharmony_ci function on(type: 'abilityForegroundState', observer: AbilityForegroundStateObserver): void; 16161847f8eSopenharmony_ci 16261847f8eSopenharmony_ci /** 16361847f8eSopenharmony_ci * Unregister Ability foreground or background state observer. 16461847f8eSopenharmony_ci * 16561847f8eSopenharmony_ci * @permission ohos.permission.RUNNING_STATE_OBSERVER 16661847f8eSopenharmony_ci * @param { 'abilityForegroundState' } type - ability foreground or background state. 16761847f8eSopenharmony_ci * @param { AbilityForegroundStateObserver } [observer] - The ability foreground state observer. 16861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 16961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 17061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 17161847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 17261847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 17361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 17461847f8eSopenharmony_ci * @systemapi 17561847f8eSopenharmony_ci * @since 11 17661847f8eSopenharmony_ci */ 17761847f8eSopenharmony_ci function off(type: 'abilityForegroundState', observer?: AbilityForegroundStateObserver): void; 17861847f8eSopenharmony_ci 17961847f8eSopenharmony_ci /** 18061847f8eSopenharmony_ci * Updates the configuration by modifying the configuration. 18161847f8eSopenharmony_ci * 18261847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 18361847f8eSopenharmony_ci * @param { Configuration } config - Indicates the new configuration. 18461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of updateConfiguration. 18561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 18661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 18761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 18861847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 18961847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 19061847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 19161847f8eSopenharmony_ci * @systemapi 19261847f8eSopenharmony_ci * @since 9 19361847f8eSopenharmony_ci */ 19461847f8eSopenharmony_ci function updateConfiguration(config: Configuration, callback: AsyncCallback<void>): void; 19561847f8eSopenharmony_ci 19661847f8eSopenharmony_ci /** 19761847f8eSopenharmony_ci * Updates the configuration by modifying the configuration. 19861847f8eSopenharmony_ci * 19961847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 20061847f8eSopenharmony_ci * @param { Configuration } config - Indicates the new configuration. 20161847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 20261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 20361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 20461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 20561847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 20661847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 20761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 20861847f8eSopenharmony_ci * @systemapi 20961847f8eSopenharmony_ci * @since 9 21061847f8eSopenharmony_ci */ 21161847f8eSopenharmony_ci function updateConfiguration(config: Configuration): Promise<void>; 21261847f8eSopenharmony_ci 21361847f8eSopenharmony_ci /** 21461847f8eSopenharmony_ci * If you apply for permission, you can obtain information about all abilities. If you do not apply, you can only 21561847f8eSopenharmony_ci * obtain information about the current ability. 21661847f8eSopenharmony_ci * 21761847f8eSopenharmony_ci * @permission ohos.permission.GET_RUNNING_INFO 21861847f8eSopenharmony_ci * @returns { Promise<Array<AbilityRunningInfo>> } Returns the array of AbilityRunningInfo. 21961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 22061847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 22161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 22261847f8eSopenharmony_ci * @systemapi 22361847f8eSopenharmony_ci * @since 9 22461847f8eSopenharmony_ci */ 22561847f8eSopenharmony_ci function getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>; 22661847f8eSopenharmony_ci 22761847f8eSopenharmony_ci /** 22861847f8eSopenharmony_ci * If you apply for permission, you can obtain information about all abilities. If you do not apply, you can only 22961847f8eSopenharmony_ci * obtain information about the current ability. 23061847f8eSopenharmony_ci * 23161847f8eSopenharmony_ci * @permission ohos.permission.GET_RUNNING_INFO 23261847f8eSopenharmony_ci * @param { AsyncCallback<Array<AbilityRunningInfo>> } callback - The callback is used to return the array of 23361847f8eSopenharmony_ci * AbilityRunningInfo. 23461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 23561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 23661847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 23761847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 23861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 23961847f8eSopenharmony_ci * @systemapi 24061847f8eSopenharmony_ci * @since 9 24161847f8eSopenharmony_ci */ 24261847f8eSopenharmony_ci function getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void; 24361847f8eSopenharmony_ci 24461847f8eSopenharmony_ci /** 24561847f8eSopenharmony_ci * If you apply for permission, you can obtain information about all extensions. If you do not apply, you can only 24661847f8eSopenharmony_ci * obtain information about the current extension. 24761847f8eSopenharmony_ci * 24861847f8eSopenharmony_ci * @permission ohos.permission.GET_RUNNING_INFO 24961847f8eSopenharmony_ci * @param { number } upperLimit - Get the maximum limit of the number of messages. 25061847f8eSopenharmony_ci * @returns { Promise<Array<ExtensionRunningInfo>> } Returns the array of ExtensionRunningInfo. 25161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 25261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 25361847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 25461847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 25561847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 25661847f8eSopenharmony_ci * @systemapi 25761847f8eSopenharmony_ci * @since 9 25861847f8eSopenharmony_ci */ 25961847f8eSopenharmony_ci function getExtensionRunningInfos(upperLimit: number): Promise<Array<ExtensionRunningInfo>>; 26061847f8eSopenharmony_ci 26161847f8eSopenharmony_ci /** 26261847f8eSopenharmony_ci * If you apply for permission, you can obtain information about all extensions. If you do not apply, you can only 26361847f8eSopenharmony_ci * obtain information about the current extension. 26461847f8eSopenharmony_ci * 26561847f8eSopenharmony_ci * @permission ohos.permission.GET_RUNNING_INFO 26661847f8eSopenharmony_ci * @param { number } upperLimit - Get the maximum limit of the number of messages. 26761847f8eSopenharmony_ci * @param { AsyncCallback<Array<ExtensionRunningInfo>> } callback - The callback is used to return the array of 26861847f8eSopenharmony_ci * ExtensionRunningInfo. 26961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 27061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 27161847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 27261847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 27361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 27461847f8eSopenharmony_ci * @systemapi 27561847f8eSopenharmony_ci * @since 9 27661847f8eSopenharmony_ci */ 27761847f8eSopenharmony_ci function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback<Array<ExtensionRunningInfo>>): void; 27861847f8eSopenharmony_ci 27961847f8eSopenharmony_ci /** 28061847f8eSopenharmony_ci * Get the top ability information of the display. 28161847f8eSopenharmony_ci * 28261847f8eSopenharmony_ci * @returns { Promise<ElementName> } Returns the elementName info of the top ability. 28361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 28461847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 28561847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 28661847f8eSopenharmony_ci * @systemapi 28761847f8eSopenharmony_ci * @since 9 28861847f8eSopenharmony_ci */ 28961847f8eSopenharmony_ci function getTopAbility(): Promise<ElementName>; 29061847f8eSopenharmony_ci 29161847f8eSopenharmony_ci /** 29261847f8eSopenharmony_ci * Get the top ability information of the display. 29361847f8eSopenharmony_ci * 29461847f8eSopenharmony_ci * @param { AsyncCallback<ElementName> } callback - The callback is used to return elementName info of top ability. 29561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 29661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 29761847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 29861847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 29961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 30061847f8eSopenharmony_ci * @systemapi 30161847f8eSopenharmony_ci * @since 9 30261847f8eSopenharmony_ci */ 30361847f8eSopenharmony_ci function getTopAbility(callback: AsyncCallback<ElementName>): void; 30461847f8eSopenharmony_ci 30561847f8eSopenharmony_ci /** 30661847f8eSopenharmony_ci * Acquire the shared data from target ability. 30761847f8eSopenharmony_ci * 30861847f8eSopenharmony_ci * @param { number } missionId - The missionId of target ability. 30961847f8eSopenharmony_ci * @param { AsyncCallback<{ [key: string]: Object }> } callback - The callback is used to return the params of sharing 31061847f8eSopenharmony_ci * data and result code. 31161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 31261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 31361847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 31461847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 31561847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 31661847f8eSopenharmony_ci * @systemapi 31761847f8eSopenharmony_ci * @since 10 31861847f8eSopenharmony_ci */ 31961847f8eSopenharmony_ci /** 32061847f8eSopenharmony_ci * Acquire the shared data from target ability. 32161847f8eSopenharmony_ci * 32261847f8eSopenharmony_ci * @param { number } missionId - The missionId of target ability. 32361847f8eSopenharmony_ci * @param { AsyncCallback<Record<string, Object>> } callback - The callback is used to return the params of sharing 32461847f8eSopenharmony_ci * data and result code. 32561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 32661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 32761847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 32861847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 32961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 33061847f8eSopenharmony_ci * @systemapi 33161847f8eSopenharmony_ci * @since 11 33261847f8eSopenharmony_ci */ 33361847f8eSopenharmony_ci function acquireShareData(missionId: number, callback: AsyncCallback<Record<string, Object>>): void; 33461847f8eSopenharmony_ci 33561847f8eSopenharmony_ci /** 33661847f8eSopenharmony_ci * Acquire the shared data from target ability. 33761847f8eSopenharmony_ci * 33861847f8eSopenharmony_ci * @param { number } missionId - The missionId of target ability. 33961847f8eSopenharmony_ci * @returns { Promise<{ [key: string]: Object }> } The promise returned by the function. 34061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 34161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 34261847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 34361847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 34461847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 34561847f8eSopenharmony_ci * @systemapi 34661847f8eSopenharmony_ci * @since 10 34761847f8eSopenharmony_ci */ 34861847f8eSopenharmony_ci /** 34961847f8eSopenharmony_ci * Acquire the shared data from target ability. 35061847f8eSopenharmony_ci * 35161847f8eSopenharmony_ci * @param { number } missionId - The missionId of target ability. 35261847f8eSopenharmony_ci * @returns { Promise<Record<string, Object>> } The promise returned by the function. 35361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 35461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 35561847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 35661847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 35761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 35861847f8eSopenharmony_ci * @systemapi 35961847f8eSopenharmony_ci * @since 11 36061847f8eSopenharmony_ci */ 36161847f8eSopenharmony_ci function acquireShareData(missionId: number): Promise<Record<string, Object>>; 36261847f8eSopenharmony_ci 36361847f8eSopenharmony_ci /** 36461847f8eSopenharmony_ci * Notify the result of save as to target ability. 36561847f8eSopenharmony_ci * @param { AbilityResult } parameter - Indicates the result to return. 36661847f8eSopenharmony_ci * @param { number } requestCode - Request code defined by the user. 36761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of the function. 36861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 36961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 37061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 37161847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 37261847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 37361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 37461847f8eSopenharmony_ci * @systemapi 37561847f8eSopenharmony_ci * @StageModelOnly 37661847f8eSopenharmony_ci * @since 10 37761847f8eSopenharmony_ci */ 37861847f8eSopenharmony_ci function notifySaveAsResult(parameter: AbilityResult, requestCode: number, callback: AsyncCallback<void>): void; 37961847f8eSopenharmony_ci 38061847f8eSopenharmony_ci /** 38161847f8eSopenharmony_ci * Notify the result of save as to target ability. 38261847f8eSopenharmony_ci * @param { AbilityResult } parameter - Indicates the result to return. 38361847f8eSopenharmony_ci * @param { number } requestCode - Request code defined by the user. 38461847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 38561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 38661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 38761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 38861847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 38961847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 39061847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 39161847f8eSopenharmony_ci * @systemapi 39261847f8eSopenharmony_ci * @StageModelOnly 39361847f8eSopenharmony_ci * @since 10 39461847f8eSopenharmony_ci */ 39561847f8eSopenharmony_ci function notifySaveAsResult(parameter: AbilityResult, requestCode: number): Promise<void>; 39661847f8eSopenharmony_ci 39761847f8eSopenharmony_ci /** 39861847f8eSopenharmony_ci * Get the foreground ui abilities. 39961847f8eSopenharmony_ci * 40061847f8eSopenharmony_ci * @permission ohos.permission.GET_RUNNING_INFO 40161847f8eSopenharmony_ci * @param { AsyncCallback<Array<AbilityStateData>> } callback - The callback is used to return the list of AbilityStateDatas. 40261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 40361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 40461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 40561847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 40661847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 40761847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 40861847f8eSopenharmony_ci * @systemapi 40961847f8eSopenharmony_ci * @since 11 41061847f8eSopenharmony_ci */ 41161847f8eSopenharmony_ci function getForegroundUIAbilities(callback: AsyncCallback<Array<AbilityStateData>>): void; 41261847f8eSopenharmony_ci 41361847f8eSopenharmony_ci /** 41461847f8eSopenharmony_ci * Get the foreground ui abilities. 41561847f8eSopenharmony_ci * 41661847f8eSopenharmony_ci * @permission ohos.permission.GET_RUNNING_INFO 41761847f8eSopenharmony_ci * @returns { Promise<Array<AbilityStateData>> } Returns the list of AbilityStateDatas. 41861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 41961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 42061847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 42161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 42261847f8eSopenharmony_ci * @systemapi 42361847f8eSopenharmony_ci * @since 11 42461847f8eSopenharmony_ci */ 42561847f8eSopenharmony_ci function getForegroundUIAbilities(): Promise<Array<AbilityStateData>>; 42661847f8eSopenharmony_ci 42761847f8eSopenharmony_ci /** 42861847f8eSopenharmony_ci * Querying whether to allow embedded startup of atomic service. 42961847f8eSopenharmony_ci * 43061847f8eSopenharmony_ci * @param { Context } context - The context that initiates the query request. 43161847f8eSopenharmony_ci * @param { string } appId - Globally unique identifier of an application, which is allocated by the cloud. 43261847f8eSopenharmony_ci * @returns { Promise<boolean> } Returns the result in the form of callback. 43361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 43461847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 43561847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 43661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 43761847f8eSopenharmony_ci * @systemapi 43861847f8eSopenharmony_ci * @StageModelOnly 43961847f8eSopenharmony_ci * @since 12 44061847f8eSopenharmony_ci */ 44161847f8eSopenharmony_ci function isEmbeddedOpenAllowed(context: Context, appId: string): Promise<boolean>; 44261847f8eSopenharmony_ci 44361847f8eSopenharmony_ci /** 44461847f8eSopenharmony_ci * Notifies the application of the assertion debugging result. 44561847f8eSopenharmony_ci * 44661847f8eSopenharmony_ci * @permission ohos.permission.NOTIFY_DEBUG_ASSERT_RESULT 44761847f8eSopenharmony_ci * @param { string } sessionId - Indicates the request ID of AssertFault. 44861847f8eSopenharmony_ci * @param { UserStatus } status - Operation status of the user. 44961847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 45061847f8eSopenharmony_ci * @throws { BusinessError } 201 - The application does not have permission to call the interface. 45161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application. 45261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 45361847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 45461847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 45561847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 45661847f8eSopenharmony_ci * @systemapi 45761847f8eSopenharmony_ci * @stagemodelonly 45861847f8eSopenharmony_ci * @since 12 45961847f8eSopenharmony_ci */ 46061847f8eSopenharmony_ci function notifyDebugAssertResult(sessionId: string, status: UserStatus): Promise<void>; 46161847f8eSopenharmony_ci 46261847f8eSopenharmony_ci /** 46361847f8eSopenharmony_ci * Set the enable status for starting and stopping resident processes. 46461847f8eSopenharmony_ci * The caller application can only set the resident status of the configured process. 46561847f8eSopenharmony_ci * 46661847f8eSopenharmony_ci * @param { string } bundleName - The bundle name of the resident process. 46761847f8eSopenharmony_ci * @param { boolean } enable - Set resident process enable status. 46861847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 46961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not a system application. 47061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible cause: 1.Non empty package name needs to be provided, 2.The second parameter needs to provide a Boolean type setting value. 47161847f8eSopenharmony_ci * @throws { BusinessError } 16000050 - Internal error. 47261847f8eSopenharmony_ci * @throws { BusinessError } 16200006 - The caller application can only set the resident status of the configured process. 47361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 47461847f8eSopenharmony_ci * @systemapi 47561847f8eSopenharmony_ci * @since 12 47661847f8eSopenharmony_ci */ 47761847f8eSopenharmony_ci function setResidentProcessEnabled(bundleName: string, enable: boolean): Promise<void>; 47861847f8eSopenharmony_ci 47961847f8eSopenharmony_ci /** 48061847f8eSopenharmony_ci * The class of an ability running information. 48161847f8eSopenharmony_ci * 48261847f8eSopenharmony_ci * @typedef { _AbilityRunningInfo } 48361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 48461847f8eSopenharmony_ci * @systemapi 48561847f8eSopenharmony_ci * @since 9 48661847f8eSopenharmony_ci */ 48761847f8eSopenharmony_ci export type AbilityRunningInfo = _AbilityRunningInfo; 48861847f8eSopenharmony_ci 48961847f8eSopenharmony_ci /** 49061847f8eSopenharmony_ci * The ability state data. 49161847f8eSopenharmony_ci * 49261847f8eSopenharmony_ci * @typedef { _AbilityStateData.default } 49361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 49461847f8eSopenharmony_ci * @systemapi 49561847f8eSopenharmony_ci * @since 11 49661847f8eSopenharmony_ci */ 49761847f8eSopenharmony_ci export type AbilityStateData = _AbilityStateData.default; 49861847f8eSopenharmony_ci 49961847f8eSopenharmony_ci /** 50061847f8eSopenharmony_ci * The class of an extension running information. 50161847f8eSopenharmony_ci * 50261847f8eSopenharmony_ci * @typedef { _ExtensionRunningInfo } 50361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 50461847f8eSopenharmony_ci * @systemapi 50561847f8eSopenharmony_ci * @since 9 50661847f8eSopenharmony_ci */ 50761847f8eSopenharmony_ci export type ExtensionRunningInfo = _ExtensionRunningInfo; 50861847f8eSopenharmony_ci 50961847f8eSopenharmony_ci /** 51061847f8eSopenharmony_ci * The ability foreground state observer. 51161847f8eSopenharmony_ci * 51261847f8eSopenharmony_ci * @typedef { _AbilityForegroundStateObserver.default } 51361847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 51461847f8eSopenharmony_ci * @systemapi 51561847f8eSopenharmony_ci * @since 11 51661847f8eSopenharmony_ci */ 51761847f8eSopenharmony_ci export type AbilityForegroundStateObserver = _AbilityForegroundStateObserver.default; 51861847f8eSopenharmony_ci} 51961847f8eSopenharmony_ci 52061847f8eSopenharmony_ciexport default abilityManager; 521