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_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 "app_running_control_rule_result.h" 23 #include "app_running_control_rule.h" 24 #include "iremote_broker.h" 25 #include "want.h" 26 27 namespace OHOS { 28 namespace AppExecFwk { 29 enum class AppInstallControlRuleType { 30 UNSPECIFIED = 0, 31 DISALLOWED_UNINSTALL, 32 ALLOWED_INSTALL, 33 }; 34 35 enum class AppRunControlRuleType { 36 DISALLOWED_RUN = 10, 37 }; 38 39 class IAppControlMgr : public IRemoteBroker { 40 public: 41 using Want = OHOS::AAFwk::Want; 42 43 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.bundleManager.appControl"); 44 45 virtual ErrCode AddAppInstallControlRule(const std::vector<std::string> &appIds, 46 const AppInstallControlRuleType controlRuleType, int32_t userId) = 0; 47 virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType, 48 const std::vector<std::string> &appIds, int32_t userId) = 0; 49 virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType, int32_t userId) = 0; 50 virtual ErrCode GetAppInstallControlRule( 51 const AppInstallControlRuleType controlRuleType, int32_t userId, std::vector<std::string> &appIds) = 0; 52 53 virtual ErrCode AddAppRunningControlRule( 54 const std::vector<AppRunningControlRule> &controlRules, int32_t userId) = 0; 55 virtual ErrCode DeleteAppRunningControlRule( 56 const std::vector<AppRunningControlRule> &controlRules, int32_t userId) = 0; 57 virtual ErrCode DeleteAppRunningControlRule(int32_t userId) = 0; 58 virtual ErrCode GetAppRunningControlRule(int32_t userId, std::vector<std::string> &appIds) = 0; 59 virtual ErrCode GetAppRunningControlRule( 60 const std::string &bundleName, int32_t userId, AppRunningControlRuleResult &controlRuleResult) = 0; 61 62 virtual ErrCode SetDisposedStatus(const std::string &appId, const Want &want) = 0; 63 virtual ErrCode DeleteDisposedStatus(const std::string &appId) = 0; 64 virtual ErrCode GetDisposedStatus(const std::string &appId, Want &want) = 0; 65 66 enum Message : uint32_t { 67 ADD_APP_INSTALL_CONTROL_RULE = 0, 68 DELETE_APP_INSTALL_CONTROL_RULE, 69 CLEAN_APP_INSTALL_CONTROL_RULE, 70 GET_APP_INSTALL_CONTROL_RULE, 71 72 ADD_APP_RUNNING_CONTROL_RULE, 73 DELETE_APP_RUNNING_CONTROL_RULE, 74 CLEAN_APP_RUNNING_CONTROL_RULE, 75 GET_APP_RUNNING_CONTROL_RULE, 76 GET_APP_RUNNING_CONTROL_RULE_RESULT, 77 SET_DISPOSED_STATUS, 78 DELETE_DISPOSED_STATUS, 79 GET_DISPOSED_STATUS, 80 }; 81 }; 82 } // namespace AppExecFwk 83 } // namespace OHOS 84 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_I_APP_CONTROL_MGR_H 85