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 #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 #endif
150
StartRemoteAbilityByCall(const OHOS::AAFwk::Want & want,const sptr<IRemoteObject> & connect,int32_t callerUid,int32_t callerPid,uint32_t accessToken)151 int32_t MockDistributedSched::StartRemoteAbilityByCall(const OHOS::AAFwk::Want& want,
152 const sptr<IRemoteObject>& connect, int32_t callerUid, int32_t callerPid, uint32_t accessToken)
153 {
154 return ERR_NONE;
155 }
156
ReleaseRemoteAbility(const sptr<IRemoteObject> & connect,const AppExecFwk::ElementName & element)157 int32_t MockDistributedSched::ReleaseRemoteAbility(const sptr<IRemoteObject>& connect,
158 const AppExecFwk::ElementName &element)
159 {
160 return ERR_NONE;
161 }
162
StartAbilityByCallFromRemote(const OHOS::AAFwk::Want & want,const sptr<IRemoteObject> & connect,const CallerInfo & callerInfo,const AccountInfo & accountInfo)163 int32_t MockDistributedSched::StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want,
164 const sptr<IRemoteObject>& connect, const CallerInfo& callerInfo, const AccountInfo& accountInfo)
165 {
166 return ERR_NONE;
167 }
168
ReleaseAbilityFromRemote(const sptr<IRemoteObject> & connect,const AppExecFwk::ElementName & element,const CallerInfo & callerInfo)169 int32_t MockDistributedSched::ReleaseAbilityFromRemote(const sptr<IRemoteObject>& connect,
170 const AppExecFwk::ElementName &element, const CallerInfo& callerInfo)
171 {
172 return ERR_NONE;
173 }
174
GetDistributedComponentList(std::vector<std::string> & distributedComponents)175 int32_t MockDistributedSched::GetDistributedComponentList(std::vector<std::string>& distributedComponents)
176 {
177 return ERR_NONE;
178 }
179
StartRemoteFreeInstall(const OHOS::AAFwk::Want & want,int32_t callerUid,int32_t requestCode,uint32_t accessToken,const sptr<IRemoteObject> & callback)180 int32_t MockDistributedSched::StartRemoteFreeInstall(const OHOS::AAFwk::Want &want, int32_t callerUid,
181 int32_t requestCode, uint32_t accessToken, const sptr<IRemoteObject> &callback)
182 {
183 return ERR_NONE;
184 }
185
StartFreeInstallFromRemote(const IDistributedSched::FreeInstallInfo & info,int64_t taskId)186 int32_t MockDistributedSched::StartFreeInstallFromRemote(const IDistributedSched::FreeInstallInfo &info, int64_t taskId)
187 {
188 return ERR_NONE;
189 }
190
NotifyCompleteFreeInstallFromRemote(int64_t taskId,int32_t resultCode)191 int32_t MockDistributedSched::NotifyCompleteFreeInstallFromRemote(int64_t taskId, int32_t resultCode)
192 {
193 return ERR_NONE;
194 }
195
NotifyCompleteFreeInstall(const IDistributedSched::FreeInstallInfo & info,int64_t taskId,int32_t resultCode)196 int32_t MockDistributedSched::NotifyCompleteFreeInstall(
197 const IDistributedSched::FreeInstallInfo &info, int64_t taskId, int32_t resultCode)
198 {
199 return ERR_NONE;
200 }
201
202 #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
StartRemoteShareForm(const std::string & remoteDeviceId,const OHOS::AppExecFwk::FormShareInfo & formShareInfo)203 int32_t MockDistributedSched::StartRemoteShareForm(const std::string& remoteDeviceId,
204 const OHOS::AppExecFwk::FormShareInfo& formShareInfo)
205 {
206 return ERR_NONE;
207 }
208
StartShareFormFromRemote(const std::string & remoteDeviceId,const OHOS::AppExecFwk::FormShareInfo & formShareInfo)209 int32_t MockDistributedSched::StartShareFormFromRemote(
210 const std::string& remoteDeviceId, const OHOS::AppExecFwk::FormShareInfo& formShareInfo)
211 {
212 return ERR_NONE;
213 }
214 #endif
215 } // namespace DistributedSchedule
216 } // namespace OHOS