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