• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 "power_mgr_factory.h"
17 
18 #include "device_power_action.h"
19 #ifdef HAS_DISPLAY_MANAGER_PART
20 #include "display/device_state_action.h"
21 #else
22 #include "display/default_device_state_action.h"
23 #endif
24 #include "running_lock_action.h"
25 
26 using namespace std;
27 
28 namespace OHOS {
29 namespace PowerMgr {
GetDevicePowerAction()30 unique_ptr<IDevicePowerAction> PowerMgrFactory::GetDevicePowerAction()
31 {
32     return make_unique<DevicePowerAction>();
33 }
34 
GetDeviceStateAction()35 shared_ptr<IDeviceStateAction> PowerMgrFactory::GetDeviceStateAction()
36 {
37 #ifdef HAS_DISPLAY_MANAGER_PART
38     return make_shared<DeviceStateAction>();
39 #else
40     return make_shared<DefaultDeviceStateAction>();
41 #endif
42 }
43 
GetRunningLockAction()44 unique_ptr<IRunningLockAction> PowerMgrFactory::GetRunningLockAction()
45 {
46     return make_unique<RunningLockAction>();
47 }
48 } // namespace PowerMgr
49 } // namespace OHOS
50