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