• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 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 { MissionInfo } from './application/MissionInfo';
18import { MissionListener } from './application/MissionListener';
19import { MissionSnapshot } from './application/MissionSnapshot';
20import StartOptions from "./@ohos.app.ability.StartOptions";
21
22/**
23 * This module provides the capability to manage abilities and obtaining system task information.
24 *
25 * @name missionManager
26 * @since 8
27 * @syscap SystemCapability.Ability.AbilityRuntime.Mission
28 * @permission ohos.permission.MANAGE_MISSIONS
29 * @systemapi hide for inner use.
30 * @deprecated since 9
31 * @useinstead ohos.app.ability.missionManager
32 */
33declare namespace missionManager {
34    /**
35     * Register the missionListener to ams.
36     *
37     * @since 8
38     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
39     * @param listener Indicates the MissionListener to be registered.
40     * @returns The index number of the MissionListener.
41     */
42    function registerMissionListener(listener: MissionListener): number;
43
44    /**
45     * Unregister the missionListener to ams.
46     *
47     * @since 8
48     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
49     * @param listenerId Indicates the listener id to be unregistered.
50     * @returns -
51     */
52    function unregisterMissionListener(listenerId: number, callback: AsyncCallback<void>): void;
53    function unregisterMissionListener(listenerId: number): Promise<void>;
54
55    /**
56     * Get the missionInfo with the given missionId.
57     *
58     * @since 8
59     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
60     * @param deviceId Indicates the device to be queried.
61     * @param missionId Indicates mission id to be queried.
62     * @returns the {@link MissionInfo} of the given id.
63     */
64    function getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<MissionInfo>): void;
65    function getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>;
66
67    /**
68     * Get the missionInfo with the given missionId.
69     *
70     * @since 8
71     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
72     * @param deviceId Indicates the device to be queried.
73     * @param numMax Indicates the maximum number of returned missions.
74     * @returns The array of the {@link MissionInfo}.
75     */
76    function getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Array<MissionInfo>>): void;
77    function getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionInfo>>;
78
79    /**
80     * Get the mission snapshot with the given missionId.
81     *
82     * @since 8
83     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
84     * @param deviceId Indicates the device to be queried.
85     * @param missionId Indicates mission id to be queried.
86     * @returns The {@link MissionSnapshot} of the given id.
87     */
88    function getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback<MissionSnapshot>): void;
89    function getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnapshot>;
90
91    /**
92     * Lock the mission.
93     *
94     * @since 8
95     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
96     * @param missionId Indicates mission id to be locked.
97     * @returns -
98     */
99    function lockMission(missionId: number, callback: AsyncCallback<void>): void;
100    function lockMission(missionId: number): Promise<void>;
101
102    /**
103     * Unlock the mission.
104     *
105     * @since 8
106     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
107     * @param missionId Indicates mission id to be unlocked.
108     * @returns -
109     */
110    function unlockMission(missionId: number, callback: AsyncCallback<void>): void;
111    function unlockMission(missionId: number): Promise<void>;
112
113    /**
114     * Clear the given mission in the ability manager service.
115     *
116     * @since 8
117     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
118     * @param missionId Indicates mission id to be cleared.
119     * @returns -
120     */
121    function clearMission(missionId: number, callback: AsyncCallback<void>): void;
122    function clearMission(missionId: number): Promise<void>;
123
124    /**
125     * Clear all missions in the ability manager service.
126     *
127     * @since 8
128     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
129     * @returns -
130     */
131    function clearAllMissions(callback: AsyncCallback<void>): void;
132    function clearAllMissions(): Promise<void>;
133
134    /**
135     * Schedule the given mission to foreground.
136     *
137     * @since 8
138     * @syscap SystemCapability.Ability.AbilityRuntime.Mission
139     * @param missionId Indicates mission id to be moved to foreground.
140     * @param options Indicates the start options.
141     * @returns -
142     */
143    function moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void;
144    function moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCallback<void>): void;
145    function moveMissionToFront(missionId: number, options?: StartOptions): Promise<void>;
146}
147
148export default missionManager;