• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "plugin_manager.h"
17 
18 #include "devicestatus_define.h"
19 
20 namespace OHOS {
21 namespace Msdp {
22 namespace DeviceStatus {
23 namespace {
24 constexpr OHOS::HiviewDFX::HiLogLabel LABEL { LOG_CORE, MSDP_DOMAIN_ID, "PluginManager" };
25 }
26 
Init(IContext * context)27 void PluginManager::Init(IContext *context)
28 {
29     context_ = context;
30 }
31 
LoadCooperate()32 ICooperate* PluginManager::LoadCooperate()
33 {
34     CALL_DEBUG_ENTER;
35     CHKPP(context_);
36     if (cooperate_ == nullptr) {
37         cooperate_ = LoadLibrary<ICooperate>(context_, "/system/lib/libintention_cooperate.z.so");
38     }
39     return (cooperate_ != nullptr ? cooperate_->GetInstance() : nullptr);
40 }
41 
UnloadCooperate()42 void PluginManager::UnloadCooperate()
43 {
44     CALL_DEBUG_ENTER;
45     cooperate_.reset();
46 }
47 } // namespace DeviceStatus
48 } // namespace Msdp
49 } // namespace OHOS
50