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 FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_PROVISION_INFO_MANAGER_H
17 #define FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_PROVISION_INFO_MANAGER_H
18 
19 #include <unordered_set>
20 
21 #include "app_provision_info_rdb.h"
22 #include "singleton.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 class AppProvisionInfoManager : public DelayedSingleton<AppProvisionInfoManager> {
27 public:
28     AppProvisionInfoManager();
29     ~AppProvisionInfoManager();
30     bool AddAppProvisionInfo(const std::string &bundleName, const AppProvisionInfo &appProvisionInfo);
31     bool DeleteAppProvisionInfo(const std::string &bundleName);
32     bool GetAppProvisionInfo(const std::string &bundleName, AppProvisionInfo &appProvisionInfo);
33     bool GetAllAppProvisionInfoBundleName(std::unordered_set<std::string> &bundleNames);
34 
35     bool SetSpecifiedDistributionType(const std::string &bundleName, const std::string &specifiedDistributionType);
36     bool GetSpecifiedDistributionType(const std::string &bundleName, std::string &specifiedDistributionType);
37     bool SetAdditionalInfo(const std::string &bundleName, const std::string &additionalInfo);
38     bool GetAdditionalInfo(const std::string &bundleName, std::string &additionalInfo);
39 
40 private:
41     std::shared_ptr<AppProvisionInfoManagerRdb> AppProvisionInfoManagerDb_;
42 };
43 } // AppExecFwk
44 } // OHOS
45 #endif // FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_PROVISION_INFO_MANAGER_H
46