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 
16 #ifndef OHOS_DISTRIBUTED_MISSION_CHANGE_LISTENER_H
17 #define OHOS_DISTRIBUTED_MISSION_CHANGE_LISTENER_H
18 
19 #include "event_handler.h"
20 #include "mission_listener_stub.h"
21 
22 namespace OHOS {
23 namespace DistributedSchedule {
24 class DistributedMissionChangeListener : public AAFwk::MissionListenerStub {
25 public:
26     DistributedMissionChangeListener() = default;
27     virtual ~DistributedMissionChangeListener() = default;
28 
29     /**
30      * @brief When a mission is created, AbilityMs notifies the listener of the mission id
31      *
32      * @param missionId, mission Id.
33      */
34     void OnMissionCreated(int32_t missionId) override;
35 
36     /**
37      * @brief When a mission is destroyed, AbilityMs notifies the listener of the mission id
38      *
39      * @param missionId, mission Id.
40      */
41     void OnMissionDestroyed(int32_t missionId) override;
42 
43     /**
44      * @brief When the snapshot of a mission changes, AbilityMs notifies the listener of the mission id
45      *
46      * @param missionId, mission Id.
47      */
48     void OnMissionSnapshotChanged(int32_t missionId) override;
49 
50     /**
51      * @brief When a mission is moved to front, AbilityMs notifies the listener of the mission id
52      *
53      * @param missionId, mission Id.
54      */
55     void OnMissionMovedToFront(int32_t missionId) override;
56 
57 #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
58     /**
59      * @brief Called when a mission has changed it's icon.
60      *
61      * @param missionId, mission Id.
62      * @param icon, mission icon.
63      */
64     void OnMissionIconUpdated(int32_t missionId, const std::shared_ptr<OHOS::Media::PixelMap> &icon) override;
65 #endif
66 
67     /**
68      * @brief When a mission is closed, AbilityMs notifies the listener of the mission id
69      *
70      * @param missionId, mission Id.
71      */
72     virtual void OnMissionClosed(int32_t missionId) override;
73 
74     /**
75      * @brief When a mission's label changed, AbilityMs notifies the listener of the mission id
76      *
77      * @param missionId, mission Id.
78      */
79     virtual void OnMissionLabelUpdated(int32_t missionId) override;
80 };
81 } // namespace DistributedSchedule
82 } // namespace OHOS
83 #endif // OHOS_DISTRIBUTED_MISSION_CHANGE_LISTENER_H
84