• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
SetInternalScreenDisplayPower(DisplayState state,StateChangeReason reason)58 void DefaultDeviceStateAction::SetInternalScreenDisplayPower(DisplayState state, StateChangeReason reason)
59 {
60     (void)state;
61     (void)reason;
62 }
63 
SetInternalScreenBrightness()64 void DefaultDeviceStateAction::SetInternalScreenBrightness()
65 {
66     return;
67 }
68 
SetCoordinated(bool coordinated)69 void DefaultDeviceStateAction::SetCoordinated(bool coordinated)
70 {
71     (void)coordinated;
72 }
73 
GoToSleep(const std::function<void ()> onSuspend,const std::function<void ()> onWakeup,bool force)74 uint32_t DefaultDeviceStateAction::GoToSleep(
75     const std::function<void()> onSuspend, const std::function<void()> onWakeup, bool force)
76 {
77     SystemSuspendController::GetInstance().Suspend(onSuspend, onWakeup, force);
78     return ActionResult::SUCCESS;
79 }
80 
RegisterCallback(std::function<void (uint32_t)> & callback)81 void DefaultDeviceStateAction::RegisterCallback(std::function<void(uint32_t)>& callback)
82 {
83     (void)callback;
84 }
85 } // namespace PowerMgr
86 } // namespace OHOS
87