• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16import { AsyncCallback } from './@ohos.base';
17import { Configuration } from './@ohos.application.Configuration';
18import { AbilityRunningInfo } from './application/AbilityRunningInfo';
19import { ExtensionRunningInfo } from './application/ExtensionRunningInfo';
20import { ElementName } from './bundle/elementName';
21
22/**
23 * The class of an ability manager.
24 *
25 * @namespace abilityManager
26 * @syscap SystemCapability.Ability.AbilityRuntime.Core
27 * @systemapi
28 * @since 8
29 * @deprecated since 9
30 * @useinstead ohos.app.ability.abilityManager/abilityManager
31 */
32declare namespace abilityManager {
33  /**
34   * Status information for the Ability.
35   *
36   * @enum { number }
37   * @syscap SystemCapability.Ability.AbilityRuntime.Core
38   * @systemapi
39   * @since 8
40   * @deprecated since 9
41   * @useinstead ohos.app.ability.abilityManager/abilityManager#AbilityState
42   */
43  export enum AbilityState {
44    /**
45     * Indicates that the ability is initial.
46     *
47     * @syscap SystemCapability.Ability.AbilityRuntime.Core
48     * @systemapi
49     * @since 8
50     * @deprecated since 9
51     * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#INITIAL
52     */
53    INITIAL = 0,
54
55    /**
56     * Indicates that the ability is foreground.
57     *
58     * @syscap SystemCapability.Ability.AbilityRuntime.Core
59     * @systemapi
60     * @since 8
61     * @deprecated since 9
62     * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#FOREGROUND
63     */
64    FOREGROUND = 9,
65
66    /**
67     * Indicates that the ability is background.
68     *
69     * @syscap SystemCapability.Ability.AbilityRuntime.Core
70     * @systemapi
71     * @since 8
72     * @deprecated since 9
73     * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#BACKGROUND
74     */
75    BACKGROUND = 10,
76
77    /**
78     * Indicates that the ability is foregrounding.
79     *
80     * @syscap SystemCapability.Ability.AbilityRuntime.Core
81     * @systemapi
82     * @since 8
83     * @deprecated since 9
84     * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#FOREGROUNDING
85     */
86    FOREGROUNDING = 11,
87
88    /**
89     * Indicates that the ability is backgrounding.
90     *
91     * @syscap SystemCapability.Ability.AbilityRuntime.Core
92     * @systemapi
93     * @since 8
94     * @deprecated since 9
95     * @useinstead ohos.app.ability.abilityManager/abilityManager.AbilityState#BACKGROUNDING
96     */
97    BACKGROUNDING = 12
98  }
99
100  /**
101   * Updates the configuration by modifying the configuration.
102   *
103   * @permission ohos.permission.UPDATE_CONFIGURATION
104   * @param { Configuration } config - Indicates the new configuration.
105   * @param { AsyncCallback<void> } callback - The specified callback method.
106   * @syscap SystemCapability.Ability.AbilityRuntime.Core
107   * @systemapi
108   * @since 8
109   * @deprecated since 9
110   * @useinstead ohos.app.ability.abilityManager/abilityManager#updateConfiguration
111   */
112  function updateConfiguration(config: Configuration, callback: AsyncCallback<void>): void;
113
114  /**
115   * Updates the configuration by modifying the configuration.
116   *
117   * @permission ohos.permission.UPDATE_CONFIGURATION
118   * @param { Configuration } config - Indicates the new configuration.
119   * @returns { Promise<void> } The promise returned by the function.
120   * @syscap SystemCapability.Ability.AbilityRuntime.Core
121   * @systemapi
122   * @since 8
123   * @deprecated since 9
124   * @useinstead ohos.app.ability.abilityManager/abilityManager#updateConfiguration
125   */
126  function updateConfiguration(config: Configuration): Promise<void>;
127
128  /**
129   * Get information about running abilities
130   *
131   * @permission ohos.permission.GET_RUNNING_INFO
132   * @returns { Promise<Array<AbilityRunningInfo>> } Returns the array of {@link AbilityRunningInfo}.
133   * @syscap SystemCapability.Ability.AbilityRuntime.Core
134   * @systemapi
135   * @since 8
136   * @deprecated since 9
137   * @useinstead ohos.app.ability.abilityManager/abilityManager#getAbilityRunningInfos
138   */
139  function getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;
140
141  /**
142   * Get information about running abilities
143   *
144   * @permission ohos.permission.GET_RUNNING_INFO
145   * @param { AsyncCallback<Array<AbilityRunningInfo>> } callback - The specified callback method.
146   * @syscap SystemCapability.Ability.AbilityRuntime.Core
147   * @systemapi
148   * @since 8
149   * @deprecated since 9
150   * @useinstead ohos.app.ability.abilityManager/abilityManager#getAbilityRunningInfos
151   */
152  function getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;
153}
154
155export default abilityManager;
156