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 "mock_power_mgr_client.h"
17 #include "power_errors.h"
18
19 namespace OHOS {
20 namespace PowerMgr {
PowerMgrClient()21 PowerMgrClient::PowerMgrClient()
22 {}
~PowerMgrClient()23 PowerMgrClient::~PowerMgrClient()
24 {}
25
Connect()26 ErrCode PowerMgrClient::Connect()
27 {
28 return ERR_OK;
29 }
30
ResetProxy(const wptr<IRemoteObject> & remote)31 void PowerMgrClient::ResetProxy(const wptr<IRemoteObject>& remote)
32 {}
33
OnRemoteDied(const wptr<IRemoteObject> & remote)34 void PowerMgrClient::PowerMgrDeathRecipient::OnRemoteDied(const wptr<IRemoteObject>& remote)
35 {
36 client_.ResetProxy(nullptr);
37 }
38
RebootDevice(const std::string & reason)39 PowerErrors PowerMgrClient::RebootDevice(const std::string& reason)
40 {
41 return PowerErrors::ERR_OK;
42 }
43
ShutDownDevice(const std::string & reason)44 PowerErrors PowerMgrClient::ShutDownDevice(const std::string& reason)
45 {
46 return PowerErrors::ERR_OK;
47 }
48
SuspendDevice(SuspendDeviceType reason,bool suspendImmed,const std::string & apiVersion)49 PowerErrors PowerMgrClient::SuspendDevice(
50 SuspendDeviceType reason, bool suspendImmed, const std::string& apiVersion)
51 {
52 return PowerErrors::ERR_OK;
53 }
54
WakeupDevice(WakeupDeviceType reason,const std::string & detail,const std::string & apiVersion)55 PowerErrors PowerMgrClient::WakeupDevice(
56 WakeupDeviceType reason, const std::string& detail, const std::string& apiVersion)
57 {
58 return PowerErrors::ERR_OK;
59 }
60
RefreshActivity(UserActivityType type)61 bool PowerMgrClient::RefreshActivity(UserActivityType type)
62 {
63 return true;
64 }
65
IsRunningLockTypeSupported(RunningLockType type)66 bool PowerMgrClient::IsRunningLockTypeSupported(RunningLockType type)
67 {
68 return true;
69 }
70
ForceSuspendDevice(const std::string & apiVersion)71 PowerErrors PowerMgrClient::ForceSuspendDevice(const std::string& apiVersion)
72 {
73 return PowerErrors::ERR_OK;
74 }
75
IsScreenOn(bool needPrintLog)76 bool PowerMgrClient::IsScreenOn(bool needPrintLog)
77 {
78 return true;
79 }
80
GetState()81 PowerState PowerMgrClient::GetState()
82 {
83 return PowerState::UNKNOWN;
84 }
85
CreateRunningLock(const std::string & name,RunningLockType type)86 std::shared_ptr<RunningLock> PowerMgrClient::CreateRunningLock(const std::string& name, RunningLockType type)
87 {
88 return nullptr;
89 }
90
RegisterPowerStateCallback(const sptr<IPowerStateCallback> & callback,bool isSync)91 bool PowerMgrClient::RegisterPowerStateCallback(const sptr<IPowerStateCallback>& callback, bool isSync)
92 {
93 return true;
94 }
95
UnRegisterPowerStateCallback(const sptr<IPowerStateCallback> & callback)96 bool PowerMgrClient::UnRegisterPowerStateCallback(const sptr<IPowerStateCallback>& callback)
97 {
98 return true;
99 }
100
RegisterPowerModeCallback(const sptr<IPowerModeCallback> & callback)101 bool PowerMgrClient::RegisterPowerModeCallback(const sptr<IPowerModeCallback>& callback)
102 {
103 return true;
104 }
105
UnRegisterPowerModeCallback(const sptr<IPowerModeCallback> & callback)106 bool PowerMgrClient::UnRegisterPowerModeCallback(const sptr<IPowerModeCallback>& callback)
107 {
108 return true;
109 }
110
SetDisplaySuspend(bool enable)111 bool PowerMgrClient::SetDisplaySuspend(bool enable)
112 {
113 return true;
114 }
115
SetDeviceMode(const PowerMode mode)116 PowerErrors PowerMgrClient::SetDeviceMode(const PowerMode mode)
117 {
118 return PowerErrors::ERR_OK;
119 }
120
GetDeviceMode()121 PowerMode PowerMgrClient::GetDeviceMode()
122 {
123 return PowerMode::NORMAL_MODE;
124 }
125
Dump(const std::vector<std::string> & args)126 std::string PowerMgrClient::Dump(const std::vector<std::string>& args)
127 {
128 return "ERR_OK";
129 }
130 } // namespace PowerMgr
131 } // namespace OHOS
132