1 /*
2 * Copyright (c) 2021-2025 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/storage_manager_proxy_mock.h"
17 #include "storage_service_errno.h"
18
19 namespace OHOS {
20 namespace StorageManager {
PrepareAddUser(int32_t userId,uint32_t flags)21 int32_t StorageManagerProxy::PrepareAddUser(int32_t userId, uint32_t flags)
22 {
23 return E_OK;
24 }
25
RemoveUser(int32_t userId,uint32_t flags)26 int32_t StorageManagerProxy::RemoveUser(int32_t userId, uint32_t flags)
27 {
28 return E_OK;
29 }
30
PrepareStartUser(int32_t userId)31 int32_t StorageManagerProxy::PrepareStartUser(int32_t userId)
32 {
33 return E_OK;
34 }
35
StopUser(int32_t userId)36 int32_t StorageManagerProxy::StopUser(int32_t userId)
37 {
38 return E_OK;
39 }
40
CompleteAddUser(int32_t userId)41 int32_t StorageManagerProxy::CompleteAddUser(int32_t userId)
42 {
43 return E_OK;
44 }
45
GenerateUserKeys(uint32_t userId,uint32_t flags)46 int32_t StorageManagerProxy::GenerateUserKeys(uint32_t userId, uint32_t flags)
47 {
48 return E_OK;
49 }
50
DeleteUserKeys(uint32_t userId)51 int32_t StorageManagerProxy::DeleteUserKeys(uint32_t userId)
52 {
53 return E_OK;
54 }
55
UpdateUserAuth(uint32_t userId,uint64_t secureUid,const std::vector<uint8_t> & token,const std::vector<uint8_t> & oldSecret,const std::vector<uint8_t> & newSecret)56 int32_t StorageManagerProxy::UpdateUserAuth(uint32_t userId, uint64_t secureUid,
57 const std::vector<uint8_t> &token,
58 const std::vector<uint8_t> &oldSecret,
59 const std::vector<uint8_t> &newSecret)
60 {
61 return E_OK;
62 }
63
UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> & authToken,const std::vector<uint8_t> & newSecret,uint64_t secureUid,uint32_t userId,const std::vector<std::vector<uint8_t>> & plainText)64 int32_t StorageManagerProxy::UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> &authToken,
65 const std::vector<uint8_t> &newSecret,
66 uint64_t secureUid,
67 uint32_t userId,
68 const std::vector<std::vector<uint8_t>> &plainText)
69 {
70 return E_OK;
71 }
72
ResetSecretWithRecoveryKey(uint32_t userId,uint32_t rkType,const std::vector<uint8_t> & key)73 int32_t StorageManagerProxy::ResetSecretWithRecoveryKey(uint32_t userId,
74 uint32_t rkType, const std::vector<uint8_t> &key)
75 {
76 return E_OK;
77 }
78
ActiveUserKey(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)79 int32_t StorageManagerProxy::ActiveUserKey(uint32_t userId,
80 const std::vector<uint8_t> &token,
81 const std::vector<uint8_t> &secret)
82 {
83 return E_OK;
84 }
85
InactiveUserKey(uint32_t userId)86 int32_t StorageManagerProxy::InactiveUserKey(uint32_t userId)
87 {
88 return E_OK;
89 }
90
LockUserScreen(uint32_t userId)91 int32_t StorageManagerProxy::LockUserScreen(uint32_t userId)
92 {
93 return E_OK;
94 }
95
UnlockUserScreen(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)96 int32_t StorageManagerProxy::UnlockUserScreen(uint32_t userId,
97 const std::vector<uint8_t> &token,
98 const std::vector<uint8_t> &secret)
99 {
100 return E_OK;
101 }
102
GetLockScreenStatus(uint32_t userId,bool & lockScreenStatus)103 int32_t StorageManagerProxy::GetLockScreenStatus(uint32_t userId, bool &lockScreenStatus)
104 {
105 return E_OK;
106 }
107
UpdateKeyContext(uint32_t userId,bool needRemoveTmpKey)108 int32_t StorageManagerProxy::UpdateKeyContext(uint32_t userId, bool needRemoveTmpKey)
109 {
110 return E_OK;
111 }
112
GenerateAppkey(uint32_t hashId,uint32_t userId,std::string & keyId,bool needReSet)113 int32_t StorageManagerProxy::GenerateAppkey(uint32_t hashId, uint32_t userId, std::string &keyId, bool needReSet)
114 {
115 return E_OK;
116 }
117
DeleteAppkey(const std::string & keyId)118 int32_t StorageManagerProxy::DeleteAppkey(const std::string& keyId)
119 {
120 return E_OK;
121 }
122
CreateRecoverKey(uint32_t userId,uint32_t userType,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)123 int32_t StorageManagerProxy::CreateRecoverKey(uint32_t userId,
124 uint32_t userType,
125 const std::vector<uint8_t> &token,
126 const std::vector<uint8_t> &secret)
127 {
128 return E_OK;
129 }
130
SetRecoverKey(const std::vector<uint8_t> & key)131 int32_t StorageManagerProxy::SetRecoverKey(const std::vector<uint8_t> &key)
132 {
133 return E_OK;
134 }
135
GetFreeSizeOfVolume(const std::string & volumeUuid,int64_t & freeSize)136 int32_t StorageManagerProxy::GetFreeSizeOfVolume(const std::string& volumeUuid, int64_t &freeSize)
137 {
138 return E_OK;
139 }
140
GetTotalSizeOfVolume(const std::string & volumeUuid,int64_t & totalSize)141 int32_t StorageManagerProxy::GetTotalSizeOfVolume(const std::string& volumeUuid, int64_t &totalSize)
142 {
143 return E_OK;
144 }
145
GetBundleStats(const std::string & pkgName,BundleStats & bundleStats,int32_t appIndex,uint32_t statFlag)146 int32_t StorageManagerProxy::GetBundleStats(const std::string& pkgName, BundleStats &bundleStats,
147 int32_t appIndex, uint32_t statFlag)
148 {
149 return E_OK;
150 }
151
NotifyVolumeCreated(const VolumeCore & vc)152 int32_t StorageManagerProxy::NotifyVolumeCreated(const VolumeCore& vc)
153 {
154 return E_OK;
155 }
156
NotifyVolumeMounted(const std::string & volumeId,const std::string & fsTypeStr,const std::string & fsUuid,const std::string & path,const std::string & description)157 int32_t StorageManagerProxy::NotifyVolumeMounted(const std::string& volumeId, const std::string &fsTypeStr,
158 const std::string& fsUuid, const std::string& path, const std::string& description)
159 {
160 return E_OK;
161 }
162
NotifyVolumeStateChanged(const std::string & volumeId,uint32_t state)163 int32_t StorageManagerProxy::NotifyVolumeStateChanged(const std::string& volumeId, uint32_t state)
164 {
165 return E_OK;
166 }
167
NotifyVolumeDamaged(const std::string & volumeId,const std::string & fsTypeStr,const std::string & fsUuid,const std::string & path,const std::string & description)168 int32_t StorageManagerProxy::NotifyVolumeDamaged(const std::string& volumeId, const std::string &fsTypeStr,
169 const std::string& fsUuid, const std::string& path, const std::string& description)
170 {
171 return E_OK;
172 }
173
Mount(const std::string & volumeId)174 int32_t StorageManagerProxy::Mount(const std::string& volumeId)
175 {
176 return E_OK;
177 }
178
TryToFix(const std::string & volumeId)179 int32_t StorageManagerProxy::TryToFix(const std::string& volumeId)
180 {
181 return E_OK;
182 }
183
Unmount(const std::string & volumeId)184 int32_t StorageManagerProxy::Unmount(const std::string& volumeId)
185 {
186 return E_OK;
187 }
188
GetAllVolumes(std::vector<VolumeExternal> & vecOfVol)189 int32_t StorageManagerProxy::GetAllVolumes(std::vector<VolumeExternal> &vecOfVol)
190 {
191 return E_OK;
192 }
193
NotifyDiskCreated(const Disk & disk)194 int32_t StorageManagerProxy::NotifyDiskCreated(const Disk& disk)
195 {
196 return E_OK;
197 }
198
NotifyDiskDestroyed(const std::string & diskId)199 int32_t StorageManagerProxy::NotifyDiskDestroyed(const std::string& diskId)
200 {
201 return E_OK;
202 }
203
Partition(const std::string & diskId,int32_t type)204 int32_t StorageManagerProxy::Partition(const std::string& diskId, int32_t type)
205 {
206 return E_OK;
207 }
208
GetAllDisks(std::vector<Disk> & vecOfDisk)209 int32_t StorageManagerProxy::GetAllDisks(std::vector<Disk> &vecOfDisk)
210 {
211 return E_OK;
212 }
213
GetSystemSize(int64_t & systemSize)214 int32_t StorageManagerProxy::GetSystemSize(int64_t &systemSize)
215 {
216 return E_OK;
217 }
218
GetTotalSize(int64_t & totalSize)219 int32_t StorageManagerProxy::GetTotalSize(int64_t &totalSize)
220 {
221 return E_OK;
222 }
223
GetFreeSize(int64_t & freeSize)224 int32_t StorageManagerProxy::GetFreeSize(int64_t &freeSize)
225 {
226 return E_OK;
227 }
228
GetUserStorageStats(StorageStats & storageStats)229 int32_t StorageManagerProxy::GetUserStorageStats(StorageStats &storageStats)
230 {
231 return E_OK;
232 }
233
GetUserStorageStats(int32_t userId,StorageStats & storageStats)234 int32_t StorageManagerProxy::GetUserStorageStats(int32_t userId, StorageStats &storageStats)
235 {
236 return E_OK;
237 }
238
GetCurrentBundleStats(BundleStats & bundleStats,uint32_t statFlag)239 int32_t StorageManagerProxy::GetCurrentBundleStats(BundleStats &bundleStats, uint32_t statFlag)
240 {
241 return E_OK;
242 }
243
GetVolumeByUuid(const std::string & fsUuid,VolumeExternal & vc)244 int32_t StorageManagerProxy::GetVolumeByUuid(const std::string& fsUuid, VolumeExternal &vc)
245 {
246 return E_OK;
247 }
248
GetVolumeById(const std::string & volumeId,VolumeExternal & vc)249 int32_t StorageManagerProxy::GetVolumeById(const std::string& volumeId, VolumeExternal &vc)
250 {
251 return E_OK;
252 }
253
SetVolumeDescription(const std::string & fsUuid,const std::string & description)254 int32_t StorageManagerProxy::SetVolumeDescription(const std::string& fsUuid, const std::string& description)
255 {
256 return E_OK;
257 }
258
Format(const std::string & volumeId,const std::string & fsType)259 int32_t StorageManagerProxy::Format(const std::string& volumeId, const std::string& fsType)
260 {
261 return E_OK;
262 }
263
GetDiskById(const std::string & diskId,Disk & disk)264 int32_t StorageManagerProxy::GetDiskById(const std::string& diskId, Disk &disk)
265 {
266 return E_OK;
267 }
268
QueryUsbIsInUse(const std::string & diskPath,bool & isInUse)269 int32_t StorageManagerProxy::QueryUsbIsInUse(const std::string &diskPath, bool &isInUse)
270 {
271 return E_OK;
272 }
273
CreateShareFile(const StorageFileRawData & uriList,uint32_t tokenId,uint32_t flag,std::vector<int32_t> & funcResult)274 int32_t StorageManagerProxy::CreateShareFile(const StorageFileRawData &uriList,
275 uint32_t tokenId,
276 uint32_t flag,
277 std::vector<int32_t> &funcResult)
278 {
279 funcResult = {1};
280 return E_OK;
281 }
282
DeleteShareFile(uint32_t tokenId,const StorageFileRawData & uriList)283 int32_t StorageManagerProxy::DeleteShareFile(uint32_t tokenId, const StorageFileRawData &uriList)
284 {
285 return E_OK;
286 }
287
SetBundleQuota(const std::string & bundleName,int32_t uid,const std::string & bundleDataDirPath,int32_t limitSizeMb)288 int32_t StorageManagerProxy::SetBundleQuota(const std::string &bundleName, int32_t uid,
289 const std::string &bundleDataDirPath, int32_t limitSizeMb)
290 {
291 return E_OK;
292 }
293
UpdateMemoryPara(int32_t size,int32_t & oldSize)294 int32_t StorageManagerProxy::UpdateMemoryPara(int32_t size, int32_t &oldSize)
295 {
296 return E_OK;
297 }
298
SendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)299 int32_t StorageManagerProxy::SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
300 MessageOption &option)
301 {
302 return E_OK;
303 }
304
GetUserStorageStatsByType(int32_t userId,StorageStats & storageStats,const std::string & type)305 int32_t StorageManagerProxy::GetUserStorageStatsByType(int32_t userId, StorageStats &storageStats,
306 const std::string &type)
307 {
308 return E_OK;
309 }
310
MountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)311 int32_t StorageManagerProxy::MountDfsDocs(int32_t userId, const std::string &relativePath,
312 const std::string &networkId, const std::string &deviceId)
313 {
314 return E_OK;
315 }
316
UMountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)317 int32_t StorageManagerProxy::UMountDfsDocs(int32_t userId, const std::string &relativePath,
318 const std::string &networkId, const std::string &deviceId)
319 {
320 return E_OK;
321 }
322
GetFileEncryptStatus(uint32_t userId,bool & isEncrypted,bool needCheckDirMount)323 int32_t StorageManagerProxy::GetFileEncryptStatus(uint32_t userId, bool &isEncrypted, bool needCheckDirMount)
324 {
325 return E_OK;
326 }
327
GetUserNeedActiveStatus(uint32_t userId,bool & needActive)328 int32_t StorageManagerProxy::GetUserNeedActiveStatus(uint32_t userId, bool &needActive)
329 {
330 return E_OK;
331 }
332
NotifyMtpMounted(const std::string & id,const std::string & path,const std::string & desc,const std::string & uuid)333 int32_t StorageManagerProxy::NotifyMtpMounted(const std::string &id, const std::string &path, const std::string &desc,
334 const std::string &uuid)
335 {
336 return E_OK;
337 }
338
NotifyMtpUnmounted(const std::string & id,const std::string & path,bool isBadRemove)339 int32_t StorageManagerProxy::NotifyMtpUnmounted(const std::string &id, const std::string &path, bool isBadRemove)
340 {
341 return E_OK;
342 }
343
MountMediaFuse(int32_t userId,int32_t & devFd)344 int32_t StorageManagerProxy::MountMediaFuse(int32_t userId, int32_t &devFd)
345 {
346 return E_OK;
347 }
348
UMountMediaFuse(int32_t userId)349 int32_t StorageManagerProxy::UMountMediaFuse(int32_t userId)
350 {
351 return E_OK;
352 }
353
MountFileMgrFuse(int32_t userId,const std::string & path,int32_t & fuseFd)354 int32_t StorageManagerProxy::MountFileMgrFuse(int32_t userId, const std::string &path, int32_t &fuseFd)
355 {
356 return E_OK;
357 }
358
UMountFileMgrFuse(int32_t userId,const std::string & path)359 int32_t StorageManagerProxy::UMountFileMgrFuse(int32_t userId, const std::string &path)
360 {
361 return E_OK;
362 }
363
IsFileOccupied(const std::string & path,const std::vector<std::string> & inputList,std::vector<std::string> & outputList,bool & isOccupy)364 int32_t StorageManagerProxy::IsFileOccupied(const std::string &path, const std::vector<std::string> &inputList,
365 std::vector<std::string> &outputList, bool &isOccupy)
366 {
367 return E_OK;
368 }
369
MountDisShareFile(int32_t userId,const std::map<std::string,std::string> & shareFiles)370 int32_t StorageManagerProxy::MountDisShareFile(int32_t userId, const std::map<std::string, std::string> &shareFiles)
371 {
372 return E_OK;
373 }
374
UMountDisShareFile(int32_t userId,const std::string & networkId)375 int32_t StorageManagerProxy::UMountDisShareFile(int32_t userId, const std::string &networkId)
376 {
377 return E_OK;
378 }
379
InactiveUserPublicDirKey(uint32_t userId)380 int32_t StorageManagerProxy::InactiveUserPublicDirKey(uint32_t userId)
381 {
382 return E_OK;
383 }
384
RegisterUeceActivationCallback(const sptr<IUeceActivationCallback> & callback)385 int32_t StorageManagerProxy::RegisterUeceActivationCallback(const sptr<IUeceActivationCallback>& callback)
386 {
387 return E_OK;
388 }
389
UnregisterUeceActivationCallback()390 int32_t StorageManagerProxy::UnregisterUeceActivationCallback()
391 {
392 return E_OK;
393 }
394 } // StorageManager
395 } // OHOS
396