1 /* 2 * Copyright (c) 2024 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,int fsType,std::string fsUuid,std::string path,std::string description)115 int32_t NotifyVolumeMounted(std::string volumeId, int fsType, 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 GenerateUserKeys(uint32_t userId,uint32_t flags)186 int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) override 187 { 188 return E_OK; 189 } 190 DeleteUserKeys(uint32_t userId)191 int32_t DeleteUserKeys(uint32_t userId) override 192 { 193 return E_OK; 194 } 195 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)196 int32_t UpdateUserAuth(uint32_t userId, uint64_t secureUid, 197 const std::vector<uint8_t> &token, 198 const std::vector<uint8_t> &oldSecret, 199 const std::vector<uint8_t> &newSecret) override 200 { 201 return E_OK; 202 } 203 UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> & authToken,const std::vector<uint8_t> & newSecret,uint64_t secureUid,uint32_t userId,std::vector<std::vector<uint8_t>> & plainText)204 int32_t UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> &authToken, 205 const std::vector<uint8_t> &newSecret, 206 uint64_t secureUid, 207 uint32_t userId, 208 std::vector<std::vector<uint8_t>> &plainText) override 209 { 210 return E_OK; 211 } 212 ActiveUserKey(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)213 int32_t ActiveUserKey(uint32_t userId, 214 const std::vector<uint8_t> &token, 215 const std::vector<uint8_t> &secret) override 216 { 217 return E_OK; 218 } 219 InactiveUserKey(uint32_t userId)220 int32_t InactiveUserKey(uint32_t userId) override 221 { 222 return E_OK; 223 } 224 LockUserScreen(uint32_t userId)225 int32_t LockUserScreen(uint32_t userId) override 226 { 227 return E_OK; 228 } 229 UnlockUserScreen(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)230 int32_t UnlockUserScreen(uint32_t userId, 231 const std::vector<uint8_t> &token, 232 const std::vector<uint8_t> &secret) override 233 { 234 return E_OK; 235 } 236 GetLockScreenStatus(uint32_t userId,bool & lockScreenStatus)237 int32_t GetLockScreenStatus(uint32_t userId, bool &lockScreenStatus) override 238 { 239 return E_OK; 240 } 241 GenerateAppkey(uint32_t hashId,uint32_t userId,std::string & keyId)242 int32_t GenerateAppkey(uint32_t hashId, uint32_t userId, std::string &keyId) override 243 { 244 return E_OK; 245 } 246 DeleteAppkey(const std::string keyId)247 int32_t DeleteAppkey(const std::string keyId) override 248 { 249 return E_OK; 250 } 251 CreateRecoverKey(uint32_t userId,uint32_t userType,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)252 int32_t CreateRecoverKey(uint32_t userId, 253 uint32_t userType, 254 const std::vector<uint8_t> &token, 255 const std::vector<uint8_t> &secret) override 256 { 257 return E_OK; 258 } 259 SetRecoverKey(const std::vector<uint8_t> & key)260 int32_t SetRecoverKey(const std::vector<uint8_t> &key) override 261 { 262 return E_OK; 263 } 264 265 int32_t UpdateKeyContext(uint32_t userId, bool needRemoveTmpKey = false) override 266 { 267 return E_OK; 268 } 269 MountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)270 int32_t MountDfsDocs(int32_t userId, const std::string &relativePath, 271 const std::string &networkId, const std::string &deviceId) override 272 { 273 return E_OK; 274 } 275 UMountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)276 int32_t UMountDfsDocs(int32_t userId, const std::string &relativePath, 277 const std::string &networkId, const std::string &deviceId) override 278 { 279 return E_OK; 280 } 281 CreateShareFile(const std::vector<std::string> & uriList,uint32_t tokenId,uint32_t flag)282 std::vector<int32_t> CreateShareFile(const std::vector<std::string> &uriList, 283 uint32_t tokenId, uint32_t flag) override 284 { 285 return std::vector<int32_t>{E_OK}; 286 } 287 DeleteShareFile(uint32_t tokenId,const std::vector<std::string> & uriList)288 int32_t DeleteShareFile(uint32_t tokenId, const std::vector<std::string> &uriList) override 289 { 290 return E_OK; 291 } UpdateMemoryPara(int32_t size,int32_t & oldSize)292 int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override 293 { 294 return E_OK; 295 } GetBundleStatsForIncrease(uint32_t userId,const std::vector<std::string> & bundleNames,const std::vector<int64_t> & incrementalBackTimes,std::vector<int64_t> & pkgFileSizes,std::vector<int64_t> & incPkgFileSizes)296 int32_t GetBundleStatsForIncrease(uint32_t userId, 297 const std::vector<std::string> &bundleNames, 298 const std::vector<int64_t> &incrementalBackTimes, 299 std::vector<int64_t> &pkgFileSizes, 300 std::vector<int64_t> &incPkgFileSizes) override 301 { 302 return E_OK; 303 } 304 int32_t GetFileEncryptStatus(uint32_t userId, bool &isEncrypted, bool needCheckDirMount = false) override 305 { 306 return E_OK; 307 } NotifyMtpMounted(const std::string & id,const std::string & path,const std::string & desc,const std::string & uuid)308 int32_t NotifyMtpMounted(const std::string &id, const std::string &path, const std::string &desc, 309 const std::string &uuid) override 310 { 311 return E_OK; 312 } NotifyMtpUnmounted(const std::string & id,const std::string & path,const bool isBadRemove)313 int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path, const bool isBadRemove) override 314 { 315 return E_OK; 316 } 317 MountMediaFuse(int32_t userId,int32_t & devFd)318 int32_t MountMediaFuse(int32_t userId, int32_t &devFd) override 319 { 320 return E_OK; 321 } 322 UMountMediaFuse(int32_t userId)323 int32_t UMountMediaFuse(int32_t userId) override 324 { 325 return E_OK; 326 } 327 GetUserNeedActiveStatus(uint32_t userId,bool & needActive)328 int32_t GetUserNeedActiveStatus(uint32_t userId, bool &needActive) override 329 { 330 return E_OK; 331 } 332 MountFileMgrFuse(int32_t userId,const std::string & path,int32_t & fuseFd)333 int32_t MountFileMgrFuse(int32_t userId, const std::string &path, int32_t &fuseFd) override 334 { 335 return E_OK; 336 } 337 UMountFileMgrFuse(int32_t userId,const std::string & path)338 int32_t UMountFileMgrFuse(int32_t userId, const std::string &path) override 339 { 340 return E_OK; 341 } 342 }; 343 } // namespace StorageManager 344 } // namespace OHOS 345 346 #endif //OHOS_STORAGEMANAGERPROXYMOCK_H 347