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 "bundle_constants.h" 27 #include "disposed_rule.h" 28 #include "iremote_broker.h" 29 #include "want.h" 30 31 namespace OHOS { 32 namespace AppExecFwk { 33 enum class AppInstallControlRuleType : int8_t { 34 UNSPECIFIED = 0, 35 DISALLOWED_UNINSTALL, 36 ALLOWED_INSTALL, 37 DISALLOWED_INSTALL, 38 }; 39 40 enum class AppRunControlRuleType : int8_t { 41 DISALLOWED_RUN = 10, 42 }; 43 44 class IAppControlMgr : public IRemoteBroker { 45 public: 46 using Want = OHOS::AAFwk::Want; 47 48 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.bundleManager.appControl"); 49 AddAppInstallControlRule(const std::vector<std::string> & appIds,const AppInstallControlRuleType controlRuleType,int32_t userId)50 virtual ErrCode AddAppInstallControlRule(const std::vector<std::string> &appIds, 51 const AppInstallControlRuleType controlRuleType, int32_t userId) 52 { 53 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 54 } DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType,const std::vector<std::string> & appIds,int32_t userId)55 virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType, 56 const std::vector<std::string> &appIds, int32_t userId) 57 { 58 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 59 } DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType,int32_t userId)60 virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType, int32_t userId) 61 { 62 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 63 } GetAppInstallControlRule(const AppInstallControlRuleType controlRuleType,int32_t userId,std::vector<std::string> & appIds)64 virtual ErrCode GetAppInstallControlRule( 65 const AppInstallControlRuleType controlRuleType, int32_t userId, std::vector<std::string> &appIds) 66 { 67 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 68 } AddAppRunningControlRule(const std::vector<AppRunningControlRule> & controlRules,int32_t userId)69 virtual ErrCode AddAppRunningControlRule( 70 const std::vector<AppRunningControlRule> &controlRules, int32_t userId) 71 { 72 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 73 } DeleteAppRunningControlRule(const std::vector<AppRunningControlRule> & controlRules,int32_t userId)74 virtual ErrCode DeleteAppRunningControlRule( 75 const std::vector<AppRunningControlRule> &controlRules, int32_t userId) 76 { 77 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 78 } DeleteAppRunningControlRule(int32_t userId)79 virtual ErrCode DeleteAppRunningControlRule(int32_t userId) 80 { 81 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 82 } GetAppRunningControlRule(int32_t userId,std::vector<std::string> & appIds)83 virtual ErrCode GetAppRunningControlRule(int32_t userId, std::vector<std::string> &appIds) 84 { 85 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 86 } GetAppRunningControlRule(const std::string & bundleName,int32_t userId,AppRunningControlRuleResult & controlRuleResult)87 virtual ErrCode GetAppRunningControlRule( 88 const std::string &bundleName, int32_t userId, AppRunningControlRuleResult &controlRuleResult) 89 { 90 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 91 } ConfirmAppJumpControlRule(const std::string & callerBundleName,const std::string & targetBundleName,int32_t userId)92 virtual ErrCode ConfirmAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName, 93 int32_t userId) 94 { 95 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 96 } AddAppJumpControlRule(const std::vector<AppJumpControlRule> & controlRules,int32_t userId)97 virtual ErrCode AddAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId) 98 { 99 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 100 } DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> & controlRules,int32_t userId)101 virtual ErrCode DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId) 102 { 103 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 104 } DeleteRuleByCallerBundleName(const std::string & callerBundleName,int32_t userId)105 virtual ErrCode DeleteRuleByCallerBundleName(const std::string &callerBundleName, int32_t userId) 106 { 107 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 108 } DeleteRuleByTargetBundleName(const std::string & targetBundleName,int32_t userId)109 virtual ErrCode DeleteRuleByTargetBundleName(const std::string &targetBundleName, int32_t userId) 110 { 111 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 112 } GetAppJumpControlRule(const std::string & callerBundleName,const std::string & targetBundleName,int32_t userId,AppJumpControlRule & controlRule)113 virtual ErrCode GetAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName, 114 int32_t userId, AppJumpControlRule &controlRule) 115 { 116 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 117 } 118 virtual ErrCode SetDisposedStatus( 119 const std::string &appId, const Want &want, int32_t userId = Constants::UNSPECIFIED_USERID) 120 { 121 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 122 } 123 virtual ErrCode DeleteDisposedStatus(const std::string &appId, int32_t userId = Constants::UNSPECIFIED_USERID) 124 { 125 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 126 } 127 virtual ErrCode GetDisposedStatus( 128 const std::string &appId, Want &want, int32_t userId = Constants::UNSPECIFIED_USERID) 129 { 130 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 131 } 132 virtual ErrCode GetDisposedRule( 133 const std::string &appId, DisposedRule& disposedRule, int32_t userId = Constants::UNSPECIFIED_USERID) 134 { 135 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 136 } 137 virtual ErrCode SetDisposedRule( 138 const std::string &appId, DisposedRule& disposedRule, int32_t userId = Constants::UNSPECIFIED_USERID) 139 { 140 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 141 } 142 virtual ErrCode GetAbilityRunningControlRule(const std::string &bundleName, int32_t userId, 143 std::vector<DisposedRule>& disposedRules, int32_t appIndex = Constants::MAIN_APP_INDEX) 144 { 145 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 146 } 147 virtual ErrCode GetDisposedRuleForCloneApp(const std::string &appId, DisposedRule& disposedRule, 148 int32_t appIndex, int32_t userId = Constants::UNSPECIFIED_USERID) 149 { 150 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 151 } 152 virtual ErrCode SetDisposedRuleForCloneApp(const std::string &appId, DisposedRule& disposedRule, 153 int32_t appIndex, int32_t userId = Constants::UNSPECIFIED_USERID) 154 { 155 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 156 } 157 virtual ErrCode DeleteDisposedRuleForCloneApp(const std::string &appId, int32_t appIndex, 158 int32_t userId = Constants::UNSPECIFIED_USERID) 159 { 160 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 161 } 162 }; 163 } // namespace AppExecFwk 164 } // namespace OHOS 165 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_I_APP_CONTROL_MGR_H 166