• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 './basic';
17import { AbilityMissionInfo } from './app/abilityMissionInfo';
18import { ActiveProcessInfo } from './app/activeProcessInfo';
19
20/**
21 * This module provides the capability to manage abilities and obtaining system task information.
22 *
23 * @since 7
24 * @SysCap SystemCapability.Appexecfwk
25 * @devices phone, tablet, tv, wearable, car
26 * @import import abilityManager from '@ohos.app.abilityManager'
27 * @permission N/A
28 */
29declare namespace abilityManager {
30
31    enum ProcessErrCode {
32        NO_ERROR = 0,
33        CRASHED,
34        NO_RESPONSE,
35    }
36
37
38    /**
39     * Get information about running processes
40     * @since 7
41     * @SysCap SystemCapability.Appexecfwk
42     * @devices phone, tablet, tv, wearable, car
43     * @return a list of ActiveProcessInfo records describing each process.
44     * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
45     * @systemapi hide this for inner system use
46     */
47    function getActiveProcessInfos(): Promise<Array<ActiveProcessInfo>>;
48    function getActiveProcessInfos(callback: AsyncCallback<Array<ActiveProcessInfo>>): void;
49
50    /**
51     * Get information about the running ability missions
52     * @since 7
53     * @SysCap SystemCapability.Appexecfwk
54     * @devices phone, tablet, tv, wearable, car
55     * @param upperLimit The maximum number of mission infos to return in the array.
56     * @return an array of AbilityMissionInfo records describing each active mission.
57     * @permission ohos.permission.ACCESS_MISSIONS
58     * @systemapi hide this for inner system use
59     */
60    function getActiveAbilityMissionInfos(upperLimit: number): Promise<Array<AbilityMissionInfo>>;
61    function getActiveAbilityMissionInfos(upperLimit: number, callback: AsyncCallback<Array<AbilityMissionInfo>>): void;
62
63    /**
64     * Get information about recently run missions
65     * @since 7
66     * @SysCap SystemCapability.Appexecfwk
67     * @devices phone, tablet, tv, wearable, car
68     * @param upperLimit The maximum number of previous mission infos to return in the array.
69     * @return an array of AbilityMissionInfo records describing each of the previous mission.
70     * @permission ohos.permission.ACCESS_MISSIONS_EXTRA
71     * @systemapi hide this for inner system use
72     */
73    function getPreviousAbilityMissionInfos(upperLimit: number): Promise<Array<AbilityMissionInfo>>;
74    function getPreviousAbilityMissionInfos(upperLimit: number, callback: AsyncCallback<Array<AbilityMissionInfo>>): void;
75
76    /**
77     * Delete the specified missions
78     * @since 7
79     * @SysCap SystemCapability.Appexecfwk
80     * @devices phone, tablet, tv, wearable, car
81     * @param missionIds An array of missions, representing the missions that need to be deleted.
82     * @permission ohos.permission.DELETE_MISSIONS
83     * @systemapi hide this for inner system use
84     */
85    function deleteMissions(missionIds: Array<number>): Promise<void>;
86    function deleteMissions(missionIds: Array<number>, callback: AsyncCallback<void>): void;
87
88}
89
90export default abilityManager;
91