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 #include "module_external/bms_adapter.h"
17
18 #include <gmock/gmock.h>
19 #include <gtest/gtest.h>
20 #include <refbase.h>
21
22 #include "b_json/b_json_entity_extension_config.h"
23 #include "bundle_mgr_client.h"
24 #include "module_ipc/service.h"
25 #include "module_ipc/svc_session_manager.h"
26 #include "module_sched/sched_scheduler.h"
27
28 namespace OHOS::FileManagement::Backup {
29 using namespace std;
30
GetBundleInfos(const vector<string> &bundleNames, int32_t userId)31 vector<BJsonEntityCaps::BundleInfo> BundleMgrAdapter::GetBundleInfos(const vector<string> &bundleNames, int32_t userId)
32 {
33 vector<BJsonEntityCaps::BundleInfo> bundleInfos;
34 bundleInfos.emplace_back(
35 BJsonEntityCaps::BundleInfo {"com.example.app2backup", 0, {}, {}, 0, 0, true, false,
36 "com.example.app2backup"});
37 return bundleInfos;
38 }
39
GetAppGalleryBundleName()40 string BundleMgrAdapter::GetAppGalleryBundleName()
41 {
42 return "";
43 }
44
GetBundleInfosForIncremental( const vector<BIncrementalData> &incrementalDataList, int32_t userId)45 vector<BJsonEntityCaps::BundleInfo> BundleMgrAdapter::GetBundleInfosForIncremental(
46 const vector<BIncrementalData> &incrementalDataList, int32_t userId)
47 {
48 vector<BJsonEntityCaps::BundleInfo> bundleInfos;
49 bundleInfos.emplace_back(
50 BJsonEntityCaps::BundleInfo {"com.example.app2backup", 0, {}, {}, 0, 0, true, false,
51 "com.example.app2backup"});
52 return bundleInfos;
53 }
54
GetBundleInfosForIncremental(int32_t userId, const vector<BIncrementalData> &extraIncreData)55 vector<BJsonEntityCaps::BundleInfo> BundleMgrAdapter::GetBundleInfosForIncremental(int32_t userId,
56 const vector<BIncrementalData> &extraIncreData)
57 {
58 vector<BJsonEntityCaps::BundleInfo> bundleInfos;
59 bundleInfos.emplace_back(
60 BJsonEntityCaps::BundleInfo {"com.example.app2backup", 0, {}, {}, 0, 0, true, false,
61 "com.example.app2backup"});
62 return bundleInfos;
63 }
64
65
GetFullBundleInfos(int32_t userId)66 vector<BJsonEntityCaps::BundleInfo> BundleMgrAdapter::GetFullBundleInfos(int32_t userId)
67 {
68 vector<BJsonEntityCaps::BundleInfo> bundleInfos;
69 bundleInfos.emplace_back(
70 BJsonEntityCaps::BundleInfo {"com.example.app2backup", 0, {}, {}, 0, 0, true, false,
71 "com.example.app2backup"});
72 return bundleInfos;
73 }
74
GetExtName(string bundleName, int32_t userId)75 string BundleMgrAdapter::GetExtName(string bundleName, int32_t userId)
76 {
77 return "BackupExtensionAbility";
78 }
79
IsUser0BundleName(std::string bundleName, int32_t userId)80 bool BundleMgrAdapter::IsUser0BundleName(std::string bundleName, int32_t userId)
81 {
82 return true;
83 }
84
GetBundleInfosForAppend( const vector<BIncrementalData> &incrementalDataList, int32_t userId)85 vector<BJsonEntityCaps::BundleInfo> BundleMgrAdapter::GetBundleInfosForAppend(
86 const vector<BIncrementalData> &incrementalDataList, int32_t userId)
87 {
88 vector<BJsonEntityCaps::BundleInfo> bundleInfos;
89 bundleInfos.emplace_back(
90 BJsonEntityCaps::BundleInfo {"com.example.app2backup", 0, {}, {}, 0, 0, true, false,
91 "com.example.app2backup"});
92 return bundleInfos;
93 }
94 } // namespace OHOS::FileManagement::Backup
95