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