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)49 PowerErrors PowerMgrClient::SuspendDevice(SuspendDeviceType reason, bool suspendImmed)
50 {
51 return PowerErrors::ERR_OK;
52 }
53
WakeupDevice(WakeupDeviceType reason,const std::string & detail)54 PowerErrors PowerMgrClient::WakeupDevice(WakeupDeviceType reason, const std::string& detail)
55 {
56 return PowerErrors::ERR_OK;
57 }
58
RefreshActivity(UserActivityType type)59 bool PowerMgrClient::RefreshActivity(UserActivityType type)
60 {
61 return true;
62 }
63
IsRunningLockTypeSupported(RunningLockType type)64 bool PowerMgrClient::IsRunningLockTypeSupported(RunningLockType type)
65 {
66 return true;
67 }
68
ForceSuspendDevice()69 PowerErrors PowerMgrClient::ForceSuspendDevice()
70 {
71 return PowerErrors::ERR_OK;
72 }
73
IsScreenOn(bool needPrintLog)74 bool PowerMgrClient::IsScreenOn(bool needPrintLog)
75 {
76 return true;
77 }
78
GetState()79 PowerState PowerMgrClient::GetState()
80 {
81 return PowerState::UNKNOWN;
82 }
83
CreateRunningLock(const std::string & name,RunningLockType type)84 std::shared_ptr<RunningLock> PowerMgrClient::CreateRunningLock(const std::string& name, RunningLockType type)
85 {
86 return nullptr;
87 }
88
RegisterPowerStateCallback(const sptr<IPowerStateCallback> & callback,bool isSync)89 bool PowerMgrClient::RegisterPowerStateCallback(const sptr<IPowerStateCallback>& callback, bool isSync)
90 {
91 return true;
92 }
93
UnRegisterPowerStateCallback(const sptr<IPowerStateCallback> & callback)94 bool PowerMgrClient::UnRegisterPowerStateCallback(const sptr<IPowerStateCallback>& callback)
95 {
96 return true;
97 }
98
RegisterPowerModeCallback(const sptr<IPowerModeCallback> & callback)99 bool PowerMgrClient::RegisterPowerModeCallback(const sptr<IPowerModeCallback>& callback)
100 {
101 return true;
102 }
103
UnRegisterPowerModeCallback(const sptr<IPowerModeCallback> & callback)104 bool PowerMgrClient::UnRegisterPowerModeCallback(const sptr<IPowerModeCallback>& callback)
105 {
106 return true;
107 }
108
SetDisplaySuspend(bool enable)109 bool PowerMgrClient::SetDisplaySuspend(bool enable)
110 {
111 return true;
112 }
113
SetDeviceMode(const PowerMode mode)114 PowerErrors PowerMgrClient::SetDeviceMode(const PowerMode mode)
115 {
116 return PowerErrors::ERR_OK;
117 }
118
GetDeviceMode()119 PowerMode PowerMgrClient::GetDeviceMode()
120 {
121 return PowerMode::NORMAL_MODE;
122 }
123
Dump(const std::vector<std::string> & args)124 std::string PowerMgrClient::Dump(const std::vector<std::string>& args)
125 {
126 return "ERR_OK";
127 }
128 } // namespace PowerMgr
129 } // namespace OHOS
130