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
SetDisplayState(const DisplayState state,StateChangeReason reason)46 uint32_t DefaultDeviceStateAction::SetDisplayState(const DisplayState state, StateChangeReason reason)
47 {
48 (void)state;
49 (void)reason;
50 return ActionResult::SUCCESS;
51 }
52
SetCoordinated(bool coordinated)53 void DefaultDeviceStateAction::SetCoordinated(bool coordinated)
54 {
55 (void)coordinated;
56 }
57
GoToSleep(const std::function<void ()> onSuspend,const std::function<void ()> onWakeup,bool force)58 uint32_t DefaultDeviceStateAction::GoToSleep(
59 const std::function<void()> onSuspend, const std::function<void()> onWakeup, bool force)
60 {
61 SystemSuspendController::GetInstance().Suspend(onSuspend, onWakeup, force);
62 return ActionResult::SUCCESS;
63 }
64
RegisterCallback(std::function<void (uint32_t)> & callback)65 void DefaultDeviceStateAction::RegisterCallback(std::function<void(uint32_t)>& callback)
66 {
67 (void)callback;
68 }
69 } // namespace PowerMgr
70 } // namespace OHOS
71