• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_I_APP_CONTROL_MGR_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_I_APP_CONTROL_MGR_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "appexecfwk_errors.h"
23 #include "app_jump_control_rule.h"
24 #include "app_running_control_rule_result.h"
25 #include "app_running_control_rule.h"
26 #include "iremote_broker.h"
27 #include "want.h"
28 
29 namespace OHOS {
30 namespace AppExecFwk {
31 enum class AppInstallControlRuleType {
32     UNSPECIFIED = 0,
33     DISALLOWED_UNINSTALL,
34     ALLOWED_INSTALL,
35     DISALLOWED_INSTALL,
36 };
37 
38 enum class AppRunControlRuleType {
39     DISALLOWED_RUN = 10,
40 };
41 
42 class IAppControlMgr : public IRemoteBroker {
43 public:
44     using Want = OHOS::AAFwk::Want;
45 
46     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.bundleManager.appControl");
47 
AddAppInstallControlRule(const std::vector<std::string> & appIds,const AppInstallControlRuleType controlRuleType,int32_t userId)48     virtual ErrCode AddAppInstallControlRule(const std::vector<std::string> &appIds,
49         const AppInstallControlRuleType controlRuleType, int32_t userId)
50     {
51         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
52     }
DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType,const std::vector<std::string> & appIds,int32_t userId)53     virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType,
54         const std::vector<std::string> &appIds, int32_t userId)
55     {
56         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
57     }
DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType,int32_t userId)58     virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType, int32_t userId)
59     {
60         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
61     }
GetAppInstallControlRule(const AppInstallControlRuleType controlRuleType,int32_t userId,std::vector<std::string> & appIds)62     virtual ErrCode GetAppInstallControlRule(
63         const AppInstallControlRuleType controlRuleType, int32_t userId, std::vector<std::string> &appIds)
64     {
65         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
66     }
AddAppRunningControlRule(const std::vector<AppRunningControlRule> & controlRules,int32_t userId)67     virtual ErrCode AddAppRunningControlRule(
68         const std::vector<AppRunningControlRule> &controlRules, int32_t userId)
69     {
70         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
71     }
DeleteAppRunningControlRule(const std::vector<AppRunningControlRule> & controlRules,int32_t userId)72     virtual ErrCode DeleteAppRunningControlRule(
73         const std::vector<AppRunningControlRule> &controlRules, int32_t userId)
74     {
75         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
76     }
DeleteAppRunningControlRule(int32_t userId)77     virtual ErrCode DeleteAppRunningControlRule(int32_t userId)
78     {
79         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
80     }
GetAppRunningControlRule(int32_t userId,std::vector<std::string> & appIds)81     virtual ErrCode GetAppRunningControlRule(int32_t userId, std::vector<std::string> &appIds)
82     {
83         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
84     }
GetAppRunningControlRule(const std::string & bundleName,int32_t userId,AppRunningControlRuleResult & controlRuleResult)85     virtual ErrCode GetAppRunningControlRule(
86         const std::string &bundleName, int32_t userId, AppRunningControlRuleResult &controlRuleResult)
87     {
88         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
89     }
ConfirmAppJumpControlRule(const std::string & callerBundleName,const std::string & targetBundleName,int32_t userId)90     virtual ErrCode ConfirmAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName,
91         int32_t userId)
92     {
93         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
94     }
AddAppJumpControlRule(const std::vector<AppJumpControlRule> & controlRules,int32_t userId)95     virtual ErrCode AddAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId)
96     {
97         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
98     }
DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> & controlRules,int32_t userId)99     virtual ErrCode DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId)
100     {
101         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
102     }
DeleteRuleByCallerBundleName(const std::string & callerBundleName,int32_t userId)103     virtual ErrCode DeleteRuleByCallerBundleName(const std::string &callerBundleName, int32_t userId)
104     {
105         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
106     }
DeleteRuleByTargetBundleName(const std::string & targetBundleName,int32_t userId)107     virtual ErrCode DeleteRuleByTargetBundleName(const std::string &targetBundleName, int32_t userId)
108     {
109         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
110     }
GetAppJumpControlRule(const std::string & callerBundleName,const std::string & targetBundleName,int32_t userId,AppJumpControlRule & controlRule)111     virtual ErrCode GetAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName,
112         int32_t userId, AppJumpControlRule &controlRule)
113     {
114         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
115     }
SetDisposedStatus(const std::string & appId,const Want & want)116     virtual ErrCode SetDisposedStatus(const std::string &appId, const Want &want)
117     {
118         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
119     }
DeleteDisposedStatus(const std::string & appId)120     virtual ErrCode DeleteDisposedStatus(const std::string &appId)
121     {
122         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
123     }
GetDisposedStatus(const std::string & appId,Want & want)124     virtual ErrCode GetDisposedStatus(const std::string &appId, Want &want)
125     {
126         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
127     }
128 };
129 } // namespace AppExecFwk
130 } // namespace OHOS
131 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_I_APP_CONTROL_MGR_H
132