• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_COLLABORATOR_PROXY_H
16 #define OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_COLLABORATOR_PROXY_H
17 
18 #include "iability_manager_collaborator.h"
19 #include "iremote_proxy.h"
20 
21 namespace OHOS {
22 namespace AAFwk {
23 class AbilityManagerCollaboratorProxy : public IRemoteProxy<IAbilityManagerCollaborator> {
24 public:
AbilityManagerCollaboratorProxy(const sptr<IRemoteObject> & impl)25     explicit AbilityManagerCollaboratorProxy(const sptr<IRemoteObject> &impl)
26         : IRemoteProxy<IAbilityManagerCollaborator>(impl)
27     {}
28     virtual ~AbilityManagerCollaboratorProxy() = default;
29 
30     /**
31      * @brief Notify collaborator to StartAbility.
32      * @param AbilityInfo ability info from bms
33      * @param userId userId.
34      * @param want targert info, will modify by collaborator.
35      * @param accessTokenIDEx accessToken
36      * @return 0 when notify start ability success or else failed.
37      */
38     virtual int32_t NotifyStartAbility(const AppExecFwk::AbilityInfo &abilityInfo,
39         int32_t userId, Want &want, uint64_t accessTokenIDEx) override;
40 
41     /**
42      * @brief Notify when mission is created.
43      * @param missionId missionId.
44      * @param want target info.
45      * @return 0 when notify mission created success or else failed.
46      */
47     virtual int32_t NotifyMissionCreated(int32_t missionId, const Want &want) override;
48 
49     /**
50      * @brief Notify when mission is created.
51      * @param sessionInfo sessionInfo.
52      * @return 0 when notify mission created success or else failed.
53      */
54     virtual int32_t NotifyMissionCreated(const sptr<SessionInfo> &sessionInfo) override;
55 
56     /**
57      * @brief Notify when start loading ability record.
58      * @param AbilityInfo ability info from bms.
59      * @param missionId missionId.
60      * @param want target info.
61      * @return 0 when notify load ability success or else failed.
62      */
63     virtual int32_t NotifyLoadAbility(const AppExecFwk::AbilityInfo &abilityInfo,
64         int32_t missionId, const Want &want) override;
65 
66     /**
67      * @brief Notify when start loading ability record.
68      * @param AbilityInfo ability info from bms.
69      * @param sessionInfo sessionInfo.
70      * @return 0 when notify load ability success or else failed.
71     */
72     virtual int32_t NotifyLoadAbility(
73         const AppExecFwk::AbilityInfo &abilityInfo, const sptr<SessionInfo> &sessionInfo) override;
74 
75     /**
76      * @brief Notify when notify app to background.
77      * @param missionId missionId.
78      * @return 0 when notify move mission to background success or else failed.
79      */
80     virtual int32_t NotifyMoveMissionToBackground(int32_t missionId) override;
81 
82     /**
83      * @brief Notify when notify app to foreground.
84      * @param missionId missionId.
85      * @return 0 when notify move mission to foreground success or else failed.
86      */
87     virtual int32_t NotifyMoveMissionToForeground(int32_t missionId) override;
88 
89     /**
90      * @brief Notify when notify ability is terminated, but mission is not cleared.
91      * @param missionId missionId.
92      * @return 0 when notify terminate mission success or else failed.
93      */
94     virtual int32_t NotifyTerminateMission(int32_t missionId) override;
95 
96     /**
97      * @brief Notify to broker when clear mission.
98      * @param missionId missionId.
99      * @return 0 when notify clear mission success or else failed.
100      */
101     virtual int32_t NotifyClearMission(int32_t missionId) override;
102 
103     /**
104      * @brief Notify to broker when clear mission.
105      * @param pid pid of shell process.
106      * @param type died type.
107      * @param reason addational message for died reason.
108      * @return 0 when notify remove shell process success or else failed.
109      */
110     virtual int32_t NotifyRemoveShellProcess(int32_t pid, int32_t type, const std::string &reason) override;
111 
112     /**
113      * @brief Update mission info to real element by broker.
114      * @param info info of mission.
115      */
116     virtual void UpdateMissionInfo(InnerMissionInfoDto &info) override;
117 
118     /**
119      * @brief Update mission info to real element by broker.
120      * @param sessionInfo sessionInfo.
121      */
122     virtual void UpdateMissionInfo(sptr<SessionInfo> &sessionInfo) override;
123 private:
124     static inline BrokerDelegator<AbilityManagerCollaboratorProxy> delegator_;
125 };
126 }   // namespace AAFWK
127 }   // namespace OHOS
128 #endif // OHOS_ABILITY_RUNTIME_ABILITY_MANAGER_COLLABORATOR_PROXY_H
129