1 /*
2  * Copyright (C) 2023 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_MEDIA_BACKUP_RESTORE_SERVICE_H
17 #define OHOS_MEDIA_BACKUP_RESTORE_SERVICE_H
18 
19 #include <string>
20 #include <context.h>
21 
22 #include "base_restore.h"
23 
24 namespace OHOS {
25 namespace Media {
26 
27 using RestoreInfo = struct {
28     int32_t sceneCode;
29     std::string galleryAppName;
30     std::string mediaAppName;
31     std::string backupDir;
32     std::string bundleInfo;
33 };
34 
35 class BackupRestoreService {
36 public:
37     virtual ~BackupRestoreService() = default;
38     static BackupRestoreService &GetInstance(void);
39     void Init(const RestoreInfo &info);
40     void StartRestore(const std::shared_ptr<AbilityRuntime::Context> &context, const RestoreInfo &info);
41     void StartRestoreEx(const std::shared_ptr<AbilityRuntime::Context> &context, const RestoreInfo &info,
42         std::string &restoreExInfo);
43 
44     void GetBackupInfo(int32_t sceneCode, std::string &backupInfo);
45     void GetProgressInfo(std::string &progressInfo);
46     void StartBackup(int32_t sceneCode, const std::string &galleryAppName = "", const std::string &mediaAppName = "");
47 
48 private:
49     BackupRestoreService() = default;
50     std::string serviceBackupDir_;
51     std::unique_ptr<BaseRestore> restoreService_;
52 };
53 } // namespace Media
54 } // namespace OHOS
55 
56 #endif  // OHOS_MEDIA_BACKUP_RESTORE_SERVICE_H
57