• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FILEMGMT_BACKUP_BUNDLE_MGR_ADAPTER_H
17 #define OHOS_FILEMGMT_BACKUP_BUNDLE_MGR_ADAPTER_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "b_json/b_json_entity_caps.h"
23 #include "bundlemgr/bundle_mgr_interface.h"
24 
25 namespace OHOS::FileManagement::Backup {
26 class InnerReceiverImpl;
27 
28 class BundleMgrAdapter {
29 public:
30     /**
31      * @brief Get the Bundle Infos object
32      *
33      * @param userId User ID
34      * @return std::vector<BJsonEntityCaps::BundleInfo>
35      */
36     static std::vector<BJsonEntityCaps::BundleInfo> GetBundleInfos(int32_t userId);
37 
38     /**
39      * @brief Get the bundle infos object
40      *
41      * @param bundleNames bundle names
42      * @param userId User ID
43      * @return std::vector<BJsonEntityCaps::BundleInfo>
44      */
45     static std::vector<BJsonEntityCaps::BundleInfo> GetBundleInfos(
46                                     const std::vector<std::string> &bundleNames, int32_t userId);
47 
48     /**
49      * @brief Install bundle
50      *
51      * @param bundleName bundle name
52      * @param bundleFilePath bundle file path
53      * @param userId User ID
54      */
55     static ErrCode Install(wptr<InnerReceiverImpl> statusReceiver, const std::string &bundleFilePath, int32_t userId);
56 };
57 } // namespace OHOS::FileManagement::Backup
58 #endif // OHOS_FILEMGMT_BACKUP_BUNDLE_MGR_ADAPTER_H
59