1 /*
2  * Copyright (c) 2022 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_CONTROL_MANAGER_DB_INTERFACE_H
17 #define FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_CONTROL_MANAGER_DB_INTERFACE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "app_control_interface.h"
23 #include "app_running_control_rule.h"
24 
25 namespace OHOS {
26 namespace AppExecFwk {
27 class IAppControlManagerDb {
28 public:
29     using Want = OHOS::AAFwk::Want;
30 
31     IAppControlManagerDb() = default;
32     virtual ~IAppControlManagerDb() = default;
33 
34     virtual ErrCode AddAppInstallControlRule(const std::string &callingName,
35         const std::vector<std::string> &appIds, const std::string &controlRuleType, int32_t userId) = 0;
36     virtual ErrCode DeleteAppInstallControlRule(const std::string &callingName, const std::string &controlRuleType,
37         const std::vector<std::string> &appIds, int32_t userId) = 0;
38     virtual ErrCode DeleteAppInstallControlRule(const std::string &callingName,
39         const std::string &controlRuleType, int32_t userId) = 0;
40     virtual ErrCode GetAppInstallControlRule(const std::string &callingName,
41         const std::string &controlRuleType, int32_t userId, std::vector<std::string> &appIds) = 0;
42     virtual ErrCode AddAppRunningControlRule(const std::string &callingName,
43         const std::vector<AppRunningControlRule> &controlRules, int32_t userId) = 0;
44     virtual ErrCode DeleteAppRunningControlRule(const std::string &callingName,
45         const std::vector<AppRunningControlRule> &controlRules, int32_t userId) = 0;
46     virtual ErrCode DeleteAppRunningControlRule(const std::string &callingName, int32_t userId) = 0;
47     virtual ErrCode GetAppRunningControlRule(const std::string &callingName,
48         int32_t userId, std::vector<std::string> &appIds) = 0;
49     virtual ErrCode GetAppRunningControlRule(const std::string &appId,
50         int32_t userId, AppRunningControlRuleResult &controlRuleResult) = 0;
51 
52     virtual ErrCode SetDisposedStatus(const std::string &callingName,
53         const std::string &appId, const Want& want, int32_t userId) = 0;
54     virtual ErrCode DeleteDisposedStatus(const std::string &callingName,
55         const std::string &appId, int32_t userId) = 0;
56     virtual ErrCode GetDisposedStatus(const std::string &callingNmae,
57         const std::string &appId, Want& want, int32_t userId) = 0;
58     virtual ErrCode SetDisposedRule(const std::string &callingName,
59         const std::string &appId, const DisposedRule& rule, int32_t appIndex, int32_t userId) = 0;
60     virtual ErrCode GetDisposedRule(const std::string &callingName,
61         const std::string &appId, DisposedRule& rule, int32_t appIndex, int32_t userId) = 0;
62     virtual ErrCode DeleteDisposedRule(const std::string &callingName,
63         const std::string &appId, int32_t appIndex, int32_t userId) = 0;
64     virtual ErrCode GetAbilityRunningControlRule(const std::string &bundleName, int32_t appIndex, int32_t userId,
65         std::vector<DisposedRule>& disposedRules) = 0;
66     virtual ErrCode DeleteAllDisposedRuleByBundle(const std::string &appId, int32_t appIndex, int32_t userId) = 0;
67 };
68 } // namespace AppExecFwk
69 } // namespace OHOS
70 #endif // FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_CONTROL_MANAGER_DB_INTERFACE_H