1 /* 2 * Copyright (c) 2022-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_FILEMGMT_BACKUP_I_SERVICE_REVERSE_H 17 #define OHOS_FILEMGMT_BACKUP_I_SERVICE_REVERSE_H 18 19 #include <cstdint> 20 21 #include "i_service_reverse_ipc_interface_code.h" 22 #include "iremote_broker.h" 23 24 namespace OHOS::FileManagement::Backup { 25 class IServiceReverse : public IRemoteBroker { 26 public: 27 enum class Scenario { 28 UNDEFINED, 29 BACKUP, 30 RESTORE, 31 CLEAN, 32 }; 33 34 public: 35 virtual ~IServiceReverse() = default; 36 virtual void BackupOnBundleStarted(int32_t errCode, std::string bundleName) = 0; 37 virtual void BackupOnFileReady(std::string bundleName, std::string fileName, int fd, int32_t errCode) = 0; 38 virtual void BackupOnResultReport(std::string result, std::string bundleName) = 0; 39 virtual void BackupOnBundleFinished(int32_t errCode, std::string bundleName) = 0; 40 virtual void BackupOnAllBundlesFinished(int32_t errCode) = 0; 41 virtual void BackupOnProcessInfo(std::string bundleName, std::string processInfo) = 0; 42 43 virtual void RestoreOnBundleStarted(int32_t errCode, std::string bundleName) = 0; 44 virtual void RestoreOnFileReady(std::string bundleName, std::string fileName, int fd, int32_t errCode) = 0; 45 virtual void RestoreOnResultReport(std::string result, std::string bundleName, 46 ErrCode errCode = 0) = 0; 47 virtual void RestoreOnBundleFinished(int32_t errCode, std::string bundleName) = 0; 48 virtual void RestoreOnAllBundlesFinished(int32_t errCode) = 0; 49 virtual void RestoreOnProcessInfo(std::string bundleName, std::string processInfo) = 0; 50 51 virtual void IncrementalBackupOnBundleStarted(int32_t errCode, std::string bundleName) = 0; 52 virtual void IncrementalBackupOnFileReady(std::string bundleName, std::string fileName, int fd, int manifestFd, 53 int32_t errCode) = 0; 54 virtual void IncrementalBackupOnResultReport(std::string result, std::string bundleName) = 0; 55 virtual void IncrementalBackupOnBundleFinished(int32_t errCode, std::string bundleName) = 0; 56 virtual void IncrementalBackupOnAllBundlesFinished(int32_t errCode) = 0; 57 virtual void IncrementalBackupOnProcessInfo(std::string bundleName, std::string processInfo) = 0; 58 59 virtual void IncrementalRestoreOnBundleStarted(int32_t errCode, std::string bundleName) = 0; 60 virtual void IncrementalRestoreOnFileReady(std::string bundleName, 61 std::string fileName, 62 int fd, 63 int manifestFd, int32_t errCode) = 0; 64 virtual void IncrementalRestoreOnResultReport(std::string result, std::string bundleName, 65 ErrCode errCode = 0) = 0; 66 virtual void IncrementalRestoreOnBundleFinished(int32_t errCode, std::string bundleName) = 0; 67 virtual void IncrementalRestoreOnAllBundlesFinished(int32_t errCode) = 0; 68 virtual void IncrementalRestoreOnProcessInfo(const std::string bundleName, const std::string processInfo) = 0; 69 70 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.FileManagement.Backup.IServiceReverse") 71 }; 72 } // namespace OHOS::FileManagement::Backup 73 74 #endif // OHOS_FILEMGMT_BACKUP_I_SERVICE_REVERSE_H