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 35 int32_t PrepareAddUser(int32_t userId, uint32_t flags) override 36 { 37 return E_OK; 38 } 39 40 int32_t RemoveUser(int32_t userId, uint32_t flags) override 41 { 42 return E_OK; 43 } 44 45 int32_t PrepareStartUser(int32_t userId) override 46 { 47 return E_OK; 48 } 49 50 int32_t StopUser(int32_t userId) override 51 { 52 return E_OK; 53 } 54 55 int32_t CompleteAddUser(int32_t userId) override 56 { 57 return E_OK; 58 } 59 60 int32_t GetFreeSizeOfVolume(std::string volumeUuid, int64_t &freeSize) override 61 { 62 return E_OK; 63 } 64 65 int32_t GetTotalSizeOfVolume(std::string volumeUuid, int64_t &totalSize) override 66 { 67 return E_OK; 68 } 69 70 int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats, int32_t appIndex) override 71 { 72 return E_OK; 73 } 74 75 int32_t GetSystemSize(int64_t &systemSize) override 76 { 77 return E_OK; 78 } 79 80 int32_t GetTotalSize(int64_t &totalSize) override 81 { 82 return E_OK; 83 } 84 85 int32_t GetFreeSize(int64_t &freeSize) override 86 { 87 return E_OK; 88 } 89 90 int32_t GetUserStorageStats(StorageStats &storageStats) override 91 { 92 return E_OK; 93 } 94 95 int32_t GetUserStorageStats(int32_t userId, StorageStats &storageStats) override 96 { 97 return E_OK; 98 } 99 100 int32_t GetUserStorageStatsByType(int32_t userId, StorageStats &storageStats, std::string type) override 101 { 102 return E_OK; 103 } 104 105 int32_t GetCurrentBundleStats(BundleStats &bundleStats) override 106 { 107 return E_OK; 108 } 109 110 int32_t NotifyVolumeCreated(VolumeCore vc) override 111 { 112 return E_OK; 113 } 114 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 121 int32_t NotifyVolumeStateChanged(std::string volumeId, VolumeState state) override 122 { 123 return E_OK; 124 } 125 126 int32_t Mount(std::string volumeId) override 127 { 128 return E_OK; 129 } 130 131 int32_t Unmount(std::string volumeId) override 132 { 133 return E_OK; 134 } 135 136 int32_t GetAllVolumes(std::vector<VolumeExternal> &vecOfVol) override 137 { 138 return E_OK; 139 } 140 141 int32_t NotifyDiskCreated(Disk disk) override 142 { 143 return E_OK; 144 } 145 146 int32_t NotifyDiskDestroyed(std::string diskId) override 147 { 148 return E_OK; 149 } 150 151 int32_t Partition(std::string diskId, int32_t type) override 152 { 153 return E_OK; 154 } 155 156 int32_t GetAllDisks(std::vector<Disk> &vecOfDisk) override 157 { 158 return E_OK; 159 } 160 161 int32_t GetVolumeByUuid(std::string fsUuid, VolumeExternal &vc) override 162 { 163 return E_OK; 164 } 165 166 int32_t GetVolumeById(std::string volumeId, VolumeExternal &vc) override 167 { 168 return E_OK; 169 } 170 171 int32_t SetVolumeDescription(std::string fsUuid, std::string description) override 172 { 173 return E_OK; 174 } 175 176 int32_t Format(std::string volumeId, std::string fsType) override 177 { 178 return E_OK; 179 } 180 181 int32_t GetDiskById(std::string diskId, Disk &disk) override 182 { 183 return E_OK; 184 } 185 186 int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) override 187 { 188 return E_OK; 189 } 190 191 int32_t DeleteUserKeys(uint32_t userId) override 192 { 193 return E_OK; 194 } 195 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 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 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 220 int32_t InactiveUserKey(uint32_t userId) override 221 { 222 return E_OK; 223 } 224 225 int32_t LockUserScreen(uint32_t userId) override 226 { 227 return E_OK; 228 } 229 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 237 int32_t GetLockScreenStatus(uint32_t userId, bool &lockScreenStatus) override 238 { 239 return E_OK; 240 } 241 242 int32_t GenerateAppkey(uint32_t hashId, uint32_t userId, std::string &keyId) override 243 { 244 return E_OK; 245 } 246 247 int32_t DeleteAppkey(const std::string keyId) override 248 { 249 return E_OK; 250 } 251 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 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) override 266 { 267 return E_OK; 268 } 269 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 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 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 288 int32_t DeleteShareFile(uint32_t tokenId, const std::vector<std::string> &uriList) override 289 { 290 return E_OK; 291 } 292 int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override 293 { 294 return E_OK; 295 } 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 } 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 } 313 int32_t NotifyMtpUnmounted(const std::string &id, const std::string &path) override 314 { 315 return E_OK; 316 } 317 }; 318 } // namespace StorageManager 319 } // namespace OHOS 320 321 #endif //OHOS_STORAGEMANAGERPROXYMOCK_H 322