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 16 #ifndef OHOS_ABILITY_RUNTIME_MISSION_LISTENER_INTERFACE_H 17 #define OHOS_ABILITY_RUNTIME_MISSION_LISTENER_INTERFACE_H 18 19 #include "iremote_broker.h" 20 #ifdef SUPPORT_GRAPHICS 21 #include "pixel_map.h" 22 #endif 23 24 namespace OHOS { 25 namespace AAFwk { 26 /** 27 * @class IMissionListener 28 * IMissionListener is used to notify caller ability that connect or disconnect is complete. 29 */ 30 class IMissionListener : public OHOS::IRemoteBroker { 31 public: 32 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.MissionListener"); 33 34 /** 35 * @brief When a mission is created, AbilityMs notifies the listener of the mission id 36 * 37 * @param missionId, mission Id. 38 */ 39 virtual void OnMissionCreated(int32_t missionId) = 0; 40 41 /** 42 * @brief When a mission is destroyed, AbilityMs notifies the listener of the mission id 43 * 44 * @param missionId, mission Id. 45 */ 46 virtual void OnMissionDestroyed(int32_t missionId) = 0; 47 48 /** 49 * @brief When the snapshot of a mission changes, AbilityMs notifies the listener of the mission id 50 * 51 * @param missionId, mission Id. 52 */ 53 virtual void OnMissionSnapshotChanged(int32_t missionId) = 0; 54 55 /** 56 * @brief When a mission is moved to front, AbilityMs notifies the listener of the mission id 57 * 58 * @param missionId, mission Id. 59 */ 60 virtual void OnMissionMovedToFront(int32_t missionId) = 0; 61 62 #ifdef SUPPORT_GRAPHICS 63 /** 64 * @brief Called when a mission has changed it's icon. 65 * 66 * @param missionId, mission Id. 67 * @param icon, mission icon. 68 */ 69 virtual void OnMissionIconUpdated(int32_t missionId, const std::shared_ptr<OHOS::Media::PixelMap> &icon) = 0; 70 #endif 71 72 /** 73 * @brief When a mission is closed, AbilityMs notifies the listener of the mission id 74 * 75 * @param missionId, mission Id. 76 */ 77 virtual void OnMissionClosed(int32_t missionId) = 0; 78 79 /** 80 * @brief When a mission's label was changed, AbilityMs notifies the listener of the mission id 81 * 82 * @param missionId, mission Id. 83 */ 84 virtual void OnMissionLabelUpdated(int32_t missionId) = 0; 85 86 enum MissionListenerCmd { 87 // ipc id for OnMissionCreated 88 ON_MISSION_CREATED = 0, 89 90 // ipc id for OnMissionDestroyed 91 ON_MISSION_DESTROYED, 92 93 // ipc id for OnMissionSnapshotChanged 94 ON_MISSION_SNAPSHOT_CHANGED, 95 96 // ipc id for OnMissionMovedToFront 97 ON_MISSION_MOVED_TO_FRONT, 98 99 // ipc id for OnMissionIconUpdated 100 ON_MISSION_ICON_UPDATED, 101 102 // ipc id for OnMissionClosed 103 ON_MISSION_CLOSED, 104 105 // ipc id for OnMissionLabelUpdated 106 ON_MISSION_LABEL_UPDATED, 107 108 // maximum of enum 109 MISSION_LINSTENER_CMD_MAX 110 }; 111 }; 112 } // namespace AAFwk 113 } // namespace OHOS 114 #endif // OHOS_ABILITY_RUNTIME_MISSION_LISTENER_INTERFACE_H 115