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_H 17 #define FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_CONTROL_MANAGER_H 18 19 #include <unordered_map> 20 21 #include "app_control_manager_db_interface.h" 22 #include "singleton.h" 23 #include "want.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 class AppControlManager : public DelayedSingleton<AppControlManager> { 28 public: 29 using Want = OHOS::AAFwk::Want; 30 31 AppControlManager(); 32 ~AppControlManager(); 33 34 ErrCode AddAppInstallControlRule(const std::string &callingName, 35 const std::vector<std::string> &appIds, const std::string &controlRuleType, int32_t userId); 36 37 ErrCode DeleteAppInstallControlRule(const std::string &callingName, const std::string &controlRuleType, 38 const std::vector<std::string> &appIds, int32_t userId); 39 40 ErrCode DeleteAppInstallControlRule(const std::string &callingName, 41 const std::string &controlRuleType, int32_t userId); 42 43 ErrCode GetAppInstallControlRule(const std::string &callingName, 44 const std::string &controlRuleType, int32_t userId, std::vector<std::string> &appIds); 45 46 ErrCode AddAppRunningControlRule(const std::string &callingName, 47 const std::vector<AppRunningControlRule> &controlRules, int32_t userId); 48 ErrCode DeleteAppRunningControlRule(const std::string &callingName, 49 const std::vector<AppRunningControlRule> &controlRules, int32_t userId); 50 ErrCode DeleteAppRunningControlRule(const std::string &callingName, int32_t userId); 51 ErrCode GetAppRunningControlRule(const std::string &callingName, int32_t userId, std::vector<std::string> &appIds); 52 ErrCode GetAppRunningControlRule( 53 const std::string &bundleName, int32_t userId, AppRunningControlRuleResult &controlRule); 54 55 ErrCode SetDisposedStatus(const std::string &appId, const Want& want, int32_t userId); 56 57 ErrCode DeleteDisposedStatus(const std::string &appId, int32_t userId); 58 59 ErrCode GetDisposedStatus(const std::string &appId, Want& want, int32_t userId); 60 private: 61 std::shared_ptr<IAppControlManagerDb> appControlManagerDb_; 62 }; 63 } // AppExecFwk 64 } // OHOS 65 #endif // FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_CONTROL_MANAGER_H 66