• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 
16 #include "mock_distributed_sched.h"
17 #include "dtbschedmgr_log.h"
18 #include "string_ex.h"
19 
20 using namespace std;
21 using namespace OHOS::AAFwk;
22 using namespace OHOS::AppExecFwk;
23 
24 namespace OHOS {
25 namespace DistributedSchedule {
StartRemoteAbility(const OHOS::AAFwk::Want & want,int32_t callerUid,int32_t requestCode,uint32_t accessToken)26 int32_t MockDistributedSched::StartRemoteAbility(const OHOS::AAFwk::Want& want,
27     int32_t callerUid, int32_t requestCode, uint32_t accessToken)
28 {
29     return 0;
30 }
31 
StartAbilityFromRemote(const OHOS::AAFwk::Want & want,const OHOS::AppExecFwk::AbilityInfo & abilityInfo,int32_t requestCode,const CallerInfo & callerInfo,const AccountInfo & accountInfo)32 int32_t MockDistributedSched::StartAbilityFromRemote(const OHOS::AAFwk::Want& want,
33     const OHOS::AppExecFwk::AbilityInfo& abilityInfo, int32_t requestCode, const CallerInfo& callerInfo,
34     const AccountInfo& accountInfo)
35 {
36     return 0;
37 }
38 
SendResultFromRemote(OHOS::AAFwk::Want & want,int32_t requestCode,const CallerInfo & callerInfo,const AccountInfo & accountInfo,int32_t resultCode)39 int32_t MockDistributedSched::SendResultFromRemote(OHOS::AAFwk::Want& want, int32_t requestCode,
40     const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t resultCode)
41 {
42     return 0;
43 }
44 
ContinueMission(const std::string & srcDeviceId,const std::string & dstDeviceId,int32_t missionId,const sptr<IRemoteObject> & callback,const OHOS::AAFwk::WantParams & wantParams)45 int32_t MockDistributedSched::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
46     int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
47 {
48     return 0;
49 }
50 
StartContinuation(const OHOS::AAFwk::Want & want,int32_t missionId,int32_t callerUid,int32_t status,uint32_t accessToken)51 int32_t MockDistributedSched::StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId,
52     int32_t callerUid, int32_t status, uint32_t accessToken)
53 {
54     return 0;
55 }
56 
NotifyCompleteContinuation(const std::u16string & devId,int32_t sessionId,bool isSuccess)57 void MockDistributedSched::NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess)
58 {
59     (void)isSuccess;
60 }
61 
NotifyContinuationResultFromRemote(int32_t sessionId,bool isSuccess)62 int32_t MockDistributedSched::NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess)
63 {
64     (void)isSuccess;
65     return 0;
66 }
67 
ConnectRemoteAbility(const OHOS::AAFwk::Want & want,const sptr<IRemoteObject> & connect,int32_t callerUid,int32_t callerPid,uint32_t accessToken)68 int32_t MockDistributedSched::ConnectRemoteAbility(const OHOS::AAFwk::Want& want, const sptr<IRemoteObject>& connect,
69     int32_t callerUid, int32_t callerPid, uint32_t accessToken)
70 {
71     return 0;
72 }
73 
DisconnectRemoteAbility(const sptr<IRemoteObject> & connect,int32_t callerUid,uint32_t accessToken)74 int32_t MockDistributedSched::DisconnectRemoteAbility(const sptr<IRemoteObject>& connect, int32_t callerUid,
75     uint32_t accessToken)
76 {
77     return 0;
78 }
79 
ConnectAbilityFromRemote(const OHOS::AAFwk::Want & want,const AppExecFwk::AbilityInfo & abilityInfo,const sptr<IRemoteObject> & connect,const CallerInfo & callerInfo,const AccountInfo & accountInfo)80 int32_t MockDistributedSched::ConnectAbilityFromRemote(const OHOS::AAFwk::Want& want,
81     const AppExecFwk::AbilityInfo& abilityInfo, const sptr<IRemoteObject>& connect,
82     const CallerInfo& callerInfo, const AccountInfo& accountInfo)
83 {
84     return 0;
85 }
86 
DisconnectAbilityFromRemote(const sptr<IRemoteObject> & connect,int32_t uid,const std::string & sourceDeviceId)87 int32_t MockDistributedSched::DisconnectAbilityFromRemote(const sptr<IRemoteObject>& connect,
88     int32_t uid, const std::string& sourceDeviceId)
89 {
90     return 0;
91 }
92 
NotifyProcessDiedFromRemote(const CallerInfo & callerInfo)93 int32_t MockDistributedSched::NotifyProcessDiedFromRemote(const CallerInfo& callerInfo)
94 {
95     return 0;
96 }
97 
98 #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
StartSyncRemoteMissions(const std::string & devId,bool fixConflict,int64_t tag)99 int32_t MockDistributedSched::StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag)
100 {
101     return ERR_NONE;
102 }
103 
RegisterMissionListener(const std::u16string & devId,const sptr<IRemoteObject> & obj)104 int32_t MockDistributedSched::RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj)
105 {
106     return ERR_NONE;
107 }
108 
UnRegisterMissionListener(const std::u16string & devId,const sptr<IRemoteObject> & obj)109 int32_t MockDistributedSched::UnRegisterMissionListener(const std::u16string& devId,
110     const sptr<IRemoteObject>& obj)
111 {
112     return ERR_NONE;
113 }
114 
GetRemoteMissionSnapshotInfo(const std::string & networkId,int32_t missionId,std::unique_ptr<MissionSnapshot> & missionSnapshot)115 int32_t MockDistributedSched::GetRemoteMissionSnapshotInfo(const std::string& networkId, int32_t missionId,
116     std::unique_ptr<MissionSnapshot>& missionSnapshot)
117 {
118     return ERR_NONE;
119 }
120 
NotifyMissionsChangedFromRemote(const std::vector<DstbMissionInfo> & missionInfos,const CallerInfo & callerInfo)121 int32_t MockDistributedSched::NotifyMissionsChangedFromRemote(const std::vector<DstbMissionInfo>& missionInfos,
122     const CallerInfo& callerInfo)
123 {
124     expectedTrue_ = false;
125     return ERR_NONE;
126 }
127 
GetMissionInfos(const std::string & deviceId,int32_t numMissions,std::vector<MissionInfo> & missionInfos)128 int32_t MockDistributedSched::GetMissionInfos(const std::string& deviceId, int32_t numMissions,
129     std::vector<MissionInfo>& missionInfos)
130 {
131     return ERR_NONE;
132 }
133 
StartSyncMissionsFromRemote(const CallerInfo & callerInfo,std::vector<DstbMissionInfo> & missionInfos)134 int32_t MockDistributedSched::StartSyncMissionsFromRemote(const CallerInfo& callerInfo,
135     std::vector<DstbMissionInfo>& missionInfos)
136 {
137     return ERR_NONE;
138 }
139 
StopSyncMissionsFromRemote(const CallerInfo & callerInfo)140 int32_t MockDistributedSched::StopSyncMissionsFromRemote(const CallerInfo& callerInfo)
141 {
142     return ERR_NONE;
143 }
144 
StopSyncRemoteMissions(const std::string & devId)145 int32_t MockDistributedSched::StopSyncRemoteMissions(const std::string& devId)
146 {
147     return ERR_NONE;
148 }
149 
SetMissionContinueState(int32_t missionId,const AAFwk::ContinueState & state)150 int32_t MockDistributedSched::SetMissionContinueState(int32_t missionId, const AAFwk::ContinueState &state)
151 {
152     return ERR_NONE;
153 }
154 #endif
155 
StartRemoteAbilityByCall(const OHOS::AAFwk::Want & want,const sptr<IRemoteObject> & connect,int32_t callerUid,int32_t callerPid,uint32_t accessToken)156 int32_t MockDistributedSched::StartRemoteAbilityByCall(const OHOS::AAFwk::Want& want,
157     const sptr<IRemoteObject>& connect, int32_t callerUid, int32_t callerPid, uint32_t accessToken)
158 {
159     return ERR_NONE;
160 }
161 
ReleaseRemoteAbility(const sptr<IRemoteObject> & connect,const AppExecFwk::ElementName & element)162 int32_t MockDistributedSched::ReleaseRemoteAbility(const sptr<IRemoteObject>& connect,
163     const AppExecFwk::ElementName &element)
164 {
165     return ERR_NONE;
166 }
167 
StartAbilityByCallFromRemote(const OHOS::AAFwk::Want & want,const sptr<IRemoteObject> & connect,const CallerInfo & callerInfo,const AccountInfo & accountInfo)168 int32_t MockDistributedSched::StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want,
169     const sptr<IRemoteObject>& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo)
170 {
171     return ERR_NONE;
172 }
173 
ReleaseAbilityFromRemote(const sptr<IRemoteObject> & connect,const AppExecFwk::ElementName & element,const CallerInfo & callerInfo)174 int32_t MockDistributedSched::ReleaseAbilityFromRemote(const sptr<IRemoteObject>& connect,
175     const AppExecFwk::ElementName &element, const CallerInfo& callerInfo)
176 {
177     return ERR_NONE;
178 }
179 
NotifyStateChangedFromRemote(int32_t abilityState,int32_t missionId,const AppExecFwk::ElementName & element)180 int32_t MockDistributedSched::NotifyStateChangedFromRemote(int32_t abilityState, int32_t missionId,
181     const AppExecFwk::ElementName& element)
182 {
183     return ERR_NONE;
184 }
185 
GetDistributedComponentList(std::vector<std::string> & distributedComponents)186 int32_t MockDistributedSched::GetDistributedComponentList(std::vector<std::string>& distributedComponents)
187 {
188     return ERR_NONE;
189 }
190 
StartRemoteFreeInstall(const OHOS::AAFwk::Want & want,int32_t callerUid,int32_t requestCode,uint32_t accessToken,const sptr<IRemoteObject> & callback)191 int32_t MockDistributedSched::StartRemoteFreeInstall(const OHOS::AAFwk::Want &want, int32_t callerUid,
192     int32_t requestCode, uint32_t accessToken, const sptr<IRemoteObject> &callback)
193 {
194     return ERR_NONE;
195 }
196 
StartFreeInstallFromRemote(const IDistributedSched::FreeInstallInfo & info,int64_t taskId)197 int32_t MockDistributedSched::StartFreeInstallFromRemote(const IDistributedSched::FreeInstallInfo &info, int64_t taskId)
198 {
199     return ERR_NONE;
200 }
201 
NotifyCompleteFreeInstallFromRemote(int64_t taskId,int32_t resultCode)202 int32_t MockDistributedSched::NotifyCompleteFreeInstallFromRemote(int64_t taskId, int32_t resultCode)
203 {
204     return ERR_NONE;
205 }
206 
NotifyCompleteFreeInstall(const IDistributedSched::FreeInstallInfo & info,int64_t taskId,int32_t resultCode)207 int32_t MockDistributedSched::NotifyCompleteFreeInstall(
208     const IDistributedSched::FreeInstallInfo &info, int64_t taskId, int32_t resultCode)
209 {
210     return ERR_NONE;
211 }
212 
213 #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
StartRemoteShareForm(const std::string & remoteDeviceId,const OHOS::AppExecFwk::FormShareInfo & formShareInfo)214 int32_t MockDistributedSched::StartRemoteShareForm(const std::string& remoteDeviceId,
215     const OHOS::AppExecFwk::FormShareInfo& formShareInfo)
216 {
217     return ERR_NONE;
218 }
219 
StartShareFormFromRemote(const std::string & remoteDeviceId,const OHOS::AppExecFwk::FormShareInfo & formShareInfo)220 int32_t MockDistributedSched::StartShareFormFromRemote(
221     const std::string& remoteDeviceId, const OHOS::AppExecFwk::FormShareInfo& formShareInfo)
222 {
223     return ERR_NONE;
224 }
225 #endif
StopRemoteExtensionAbility(const OHOS::AAFwk::Want & want,int32_t callerUid,uint32_t accessToken,int32_t extensionType)226 int32_t MockDistributedSched::StopRemoteExtensionAbility(
227     const OHOS::AAFwk::Want& want, int32_t callerUid, uint32_t accessToken, int32_t extensionType)
228 {
229     return ERR_NONE;
230 }
StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want & want,const CallerInfo & callerInfo,const AccountInfo & accountInfo,int32_t extensionType)231 int32_t MockDistributedSched::StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want,
232     const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t extensionType)
233 {
234     return ERR_NONE;
235 }
236 } // namespace DistributedSchedule
237 } // namespace OHOS