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 #include "default_device_state_action.h"
17 #include "system_suspend_controller.h"
18
19 namespace OHOS {
20 namespace PowerMgr {
21 using namespace std;
22
Suspend(int64_t callTimeMs,SuspendDeviceType type,uint32_t flags)23 void DefaultDeviceStateAction::Suspend(int64_t callTimeMs, SuspendDeviceType type, uint32_t flags)
24 {
25 (void)callTimeMs;
26 (void)type;
27 (void)flags;
28 }
29
ForceSuspend()30 void DefaultDeviceStateAction::ForceSuspend() {}
31
Wakeup(int64_t callTimeMs,WakeupDeviceType type,const string & details,const string & pkgName)32 void DefaultDeviceStateAction::Wakeup(
33 int64_t callTimeMs, WakeupDeviceType type, const string& details, const string& pkgName)
34 {
35 (void)callTimeMs;
36 (void)type;
37 (void)details;
38 (void)pkgName;
39 }
40
GetDisplayState()41 DisplayState DefaultDeviceStateAction::GetDisplayState()
42 {
43 return DisplayState::DISPLAY_UNKNOWN;
44 }
45
TryToCancelScreenOff()46 bool DefaultDeviceStateAction::TryToCancelScreenOff()
47 {
48 return false;
49 }
50
SetDisplayState(const DisplayState state,StateChangeReason reason)51 uint32_t DefaultDeviceStateAction::SetDisplayState(const DisplayState state, StateChangeReason reason)
52 {
53 (void)state;
54 (void)reason;
55 return ActionResult::SUCCESS;
56 }
57
SetCoordinated(bool coordinated)58 void DefaultDeviceStateAction::SetCoordinated(bool coordinated)
59 {
60 (void)coordinated;
61 }
62
GoToSleep(const std::function<void ()> onSuspend,const std::function<void ()> onWakeup,bool force)63 uint32_t DefaultDeviceStateAction::GoToSleep(
64 const std::function<void()> onSuspend, const std::function<void()> onWakeup, bool force)
65 {
66 SystemSuspendController::GetInstance().Suspend(onSuspend, onWakeup, force);
67 return ActionResult::SUCCESS;
68 }
69
RegisterCallback(std::function<void (uint32_t)> & callback)70 void DefaultDeviceStateAction::RegisterCallback(std::function<void(uint32_t)>& callback)
71 {
72 (void)callback;
73 }
74 } // namespace PowerMgr
75 } // namespace OHOS
76