1 /*
2  * Copyright (c) 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_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_JUMP_INTERCEPTOR_MANAGER_RDB_H
17 #define FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_JUMP_INTERCEPTOR_MANAGER_RDB_H
18 
19 #include "app_jump_interceptor_event_subscriber.h"
20 #include "app_jump_interceptor_manager_db_interface.h"
21 
22 #include "rdb_data_manager.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 class AppJumpInterceptorManagerRdb : public IAppJumpInterceptorlManagerDb,
27     public std::enable_shared_from_this<AppJumpInterceptorManagerRdb> {
28 public:
29     AppJumpInterceptorManagerRdb();
30     ~AppJumpInterceptorManagerRdb();
31 
32     virtual ErrCode ConfirmAppJumpControlRule(const std::string &callerBundleName,
33         const std::string &targetBundleName, int32_t userId) override;
34     virtual ErrCode AddAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId) override;
35     virtual ErrCode DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules,
36         int32_t userId) override;
37     virtual ErrCode DeleteRuleByCallerBundleName(const std::string &callerBundleName, int32_t userId) override;
38     virtual ErrCode DeleteRuleByTargetBundleName(const std::string &targetBundleName, int32_t userId) override;
39     virtual ErrCode GetAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName,
40         int32_t userId, AppJumpControlRule &controlRule) override;
41     virtual bool SubscribeCommonEvent() override;
42 private:
43     std::shared_ptr<RdbDataManager> rdbDataManager_;
44     sptr<AppJumpInterceptorEventSubscriber> eventSubscriber_;
45 };
46 } // namespace AppExecFwk
47 } // namespace OHOS
48 #endif // FOUNDATION_BUNDLE_FRAMEWORK_SERVICE_INCLUDE_APP_JUMP_INTERCEPTOR_MANAGER_RDB_H