1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 */ 19 20import { AsyncCallback } from './@ohos.base'; 21import { Configuration } from './@ohos.application.Configuration'; 22import { AbilityRunningInfo } from './application/AbilityRunningInfo'; 23import { ExtensionRunningInfo } from './application/ExtensionRunningInfo'; 24import { ElementName } from './bundle/elementName'; 25 26/** 27 * The class of an ability manager. 28 * 29 * @namespace abilityManager 30 * @syscap SystemCapability.Ability.AbilityRuntime.Core 31 * @systemapi 32 * @since 8 33 * @deprecated since 9 34 * @useinstead ohos.app.ability.abilityManager/abilityManager 35 */ 36declare namespace abilityManager { 37 /** 38 * Status information for the Ability. 39 * 40 * @enum { number } 41 * @syscap SystemCapability.Ability.AbilityRuntime.Core 42 * @systemapi 43 * @since 8 44 * @deprecated since 9 45 * @useinstead ohos.app.ability.abilityManager/abilityManager#AbilityState 46 */ 47 export enum AbilityState { 48 /** 49 * Indicates that the ability is initial. 50 * 51 * @syscap SystemCapability.Ability.AbilityRuntime.Core 52 * @systemapi 53 * @since 8 54 * @deprecated since 9 55 * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#INITIAL 56 */ 57 INITIAL = 0, 58 59 /** 60 * Indicates that the ability is foreground. 61 * 62 * @syscap SystemCapability.Ability.AbilityRuntime.Core 63 * @systemapi 64 * @since 8 65 * @deprecated since 9 66 * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#FOREGROUND 67 */ 68 FOREGROUND = 9, 69 70 /** 71 * Indicates that the ability is background. 72 * 73 * @syscap SystemCapability.Ability.AbilityRuntime.Core 74 * @systemapi 75 * @since 8 76 * @deprecated since 9 77 * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#BACKGROUND 78 */ 79 BACKGROUND = 10, 80 81 /** 82 * Indicates that the ability is foregrounding. 83 * 84 * @syscap SystemCapability.Ability.AbilityRuntime.Core 85 * @systemapi 86 * @since 8 87 * @deprecated since 9 88 * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#FOREGROUNDING 89 */ 90 FOREGROUNDING = 11, 91 92 /** 93 * Indicates that the ability is backgrounding. 94 * 95 * @syscap SystemCapability.Ability.AbilityRuntime.Core 96 * @systemapi 97 * @since 8 98 * @deprecated since 9 99 * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#BACKGROUNDING 100 */ 101 BACKGROUNDING = 12 102 } 103 104 /** 105 * Updates the configuration by modifying the configuration. 106 * 107 * @permission ohos.permission.UPDATE_CONFIGURATION 108 * @param { Configuration } config - Indicates the new configuration. 109 * @param { AsyncCallback<void> } callback - The specified callback method. 110 * @syscap SystemCapability.Ability.AbilityRuntime.Core 111 * @systemapi 112 * @since 8 113 * @deprecated since 9 114 * @useinstead ohos.app.ability.abilityManager/abilityManager#updateConfiguration 115 */ 116 function updateConfiguration(config: Configuration, callback: AsyncCallback<void>): void; 117 118 /** 119 * Updates the configuration by modifying the configuration. 120 * 121 * @permission ohos.permission.UPDATE_CONFIGURATION 122 * @param { Configuration } config - Indicates the new configuration. 123 * @returns { Promise<void> } The promise returned by the function. 124 * @syscap SystemCapability.Ability.AbilityRuntime.Core 125 * @systemapi 126 * @since 8 127 * @deprecated since 9 128 * @useinstead ohos.app.ability.abilityManager/abilityManager#updateConfiguration 129 */ 130 function updateConfiguration(config: Configuration): Promise<void>; 131 132 /** 133 * Get information about running abilities 134 * 135 * @permission ohos.permission.GET_RUNNING_INFO 136 * @returns { Promise<Array<AbilityRunningInfo>> } Returns the array of {@link AbilityRunningInfo}. 137 * @syscap SystemCapability.Ability.AbilityRuntime.Core 138 * @systemapi 139 * @since 8 140 * @deprecated since 9 141 * @useinstead ohos.app.ability.abilityManager/abilityManager#getAbilityRunningInfos 142 */ 143 function getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>; 144 145 /** 146 * Get information about running abilities 147 * 148 * @permission ohos.permission.GET_RUNNING_INFO 149 * @param { AsyncCallback<Array<AbilityRunningInfo>> } callback - The specified callback method. 150 * @syscap SystemCapability.Ability.AbilityRuntime.Core 151 * @systemapi 152 * @since 8 153 * @deprecated since 9 154 * @useinstead ohos.app.ability.abilityManager/abilityManager#getAbilityRunningInfos 155 */ 156 function getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void; 157} 158 159export default abilityManager; 160