• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "wakeup_controller.h"
17 
18 #include <datetime_ex.h>
19 #include <hisysevent.h>
20 #include <input_manager.h>
21 #include <ipc_skeleton.h>
22 #include <securec.h>
23 
24 #include "app_mgr_client.h"
25 #include "bundle_mgr_client.h"
26 #include "permission.h"
27 #include "power_errors.h"
28 #include "power_log.h"
29 #include "power_mgr_service.h"
30 #include "power_state_callback_stub.h"
31 #include "setting_helper.h"
32 #include "suspend_controller.h"
33 #include "system_suspend_controller.h"
34 #include "window_manager.h"
35 
36 namespace OHOS {
37 namespace PowerMgr {
38 using namespace OHOS::MMI;
39 namespace {
40 sptr<SettingObserver> g_wakeupSourcesKeyObserver = nullptr;
41 FFRTHandle g_screenTimeoutHandle;
42 }
43 
44 /** WakeupController Implement */
WakeupController(std::shared_ptr<PowerStateMachine> & stateMachine)45 WakeupController::WakeupController(std::shared_ptr<PowerStateMachine>& stateMachine)
46 {
47     stateMachine_ = stateMachine;
48 #ifdef HAS_MULTIMODALINPUT_INPUT_PART
49     std::shared_ptr<InputCallback> callback = std::make_shared<InputCallback>();
50     if (monitorId_ < 0) {
51         monitorId_ = InputManager::GetInstance()->AddMonitor(std::static_pointer_cast<IInputEventConsumer>(callback));
52     }
53 #endif
54     eventHandleMap_.emplace(WakeupDeviceType::WAKEUP_DEVICE_KEYBOARD, 0);
55     eventHandleMap_.emplace(WakeupDeviceType::WAKEUP_DEVICE_MOUSE, 0);
56     eventHandleMap_.emplace(WakeupDeviceType::WAKEUP_DEVICE_TOUCHPAD, 0);
57     eventHandleMap_.emplace(WakeupDeviceType::WAKEUP_DEVICE_PEN, 0);
58     eventHandleMap_.emplace(WakeupDeviceType::WAKEUP_DEVICE_TOUCH_SCREEN, 0);
59     eventHandleMap_.emplace(WakeupDeviceType::WAKEUP_DEVICE_SINGLE_CLICK, 0);
60 }
61 
~WakeupController()62 WakeupController::~WakeupController()
63 {
64 #ifdef HAS_MULTIMODALINPUT_INPUT_PART
65     InputManager* inputManager = InputManager::GetInstance();
66     if (monitorId_ >= 0) {
67         inputManager->RemoveMonitor(monitorId_);
68     }
69 #endif
70 
71     if (g_wakeupSourcesKeyObserver) {
72         SettingHelper::UnregisterSettingWakeupSourcesObserver(g_wakeupSourcesKeyObserver);
73     }
74     if (g_screenTimeoutHandle) {
75         FFRTUtils::CancelTask(g_screenTimeoutHandle, queue_);
76     }
77 }
78 
Init()79 void WakeupController::Init()
80 {
81     std::lock_guard lock(monitorMutex_);
82     queue_ = std::make_shared<FFRTQueue>("power_wakeup_controller");
83     if (queue_ == nullptr) {
84         POWER_HILOGE(FEATURE_WAKEUP, "wakeupQueue_ is null");
85         return;
86     }
87     std::shared_ptr<WakeupSources> sources = WakeupSourceParser::ParseSources();
88     sourceList_ = sources->GetSourceList();
89     if (sourceList_.empty()) {
90         POWER_HILOGE(FEATURE_WAKEUP, "InputManager is null");
91         return;
92     }
93 
94     for (auto source = sourceList_.begin(); source != sourceList_.end(); source++) {
95         POWER_HILOGI(FEATURE_WAKEUP, "registered type=%{public}u", (*source).GetReason());
96         std::shared_ptr<WakeupMonitor> monitor = WakeupMonitor::CreateMonitor(*source);
97         if (monitor != nullptr && monitor->Init()) {
98             POWER_HILOGI(FEATURE_WAKEUP, "register type=%{public}u", (*source).GetReason());
99             monitor->RegisterListener(std::bind(&WakeupController::ControlListener, this, std::placeholders::_1));
100             monitorMap_.emplace(monitor->GetReason(), monitor);
101         }
102     }
103     RegisterSettingsObserver();
104 
105     std::function<void(uint32_t)> callback = [&](uint32_t event) {
106         POWER_HILOGI(COMP_SVC, "NotifyDisplayActionDone: %{public}d", event);
107         FFRTUtils::CancelTask(g_screenTimeoutHandle, queue_);
108     };
109     auto stateAction = stateMachine_->GetStateAction();
110     if (stateAction != nullptr) {
111         stateAction->RegisterCallback(callback);
112         POWER_HILOGI(COMP_SVC, "NotifyDisplayActionDone callback registered");
113     }
114 }
115 
Cancel()116 void WakeupController::Cancel()
117 {
118     for (auto monitor = monitorMap_.begin(); monitor != monitorMap_.end(); monitor++) {
119         monitor->second->Cancel();
120     }
121     monitorMap_.clear();
122 }
123 
RegisterSettingsObserver()124 void WakeupController::RegisterSettingsObserver()
125 {
126     if (g_wakeupSourcesKeyObserver) {
127         POWER_HILOGE(FEATURE_POWER_STATE, "wakeup sources key observer is already registered");
128         return;
129     }
130     SettingObserver::UpdateFunc updateFunc = [&](const std::string&) {
131         std::lock_guard lock(monitorMutex_);
132         POWER_HILOGI(COMP_SVC, "start setting string update");
133         std::string jsonStr = SettingHelper::GetSettingWakeupSources();
134         std::shared_ptr<WakeupSources> sources = WakeupSourceParser::ParseSources(jsonStr);
135         std::vector<WakeupSource> updateSourceList = sources->GetSourceList();
136         if (updateSourceList.size() == 0) {
137             return;
138         }
139         sourceList_ = updateSourceList;
140         POWER_HILOGI(COMP_SVC, "start updateListener");
141         Cancel();
142         for (auto source = sourceList_.begin(); source != sourceList_.end(); source++) {
143             std::shared_ptr<WakeupMonitor> monitor = WakeupMonitor::CreateMonitor(*source);
144             if (monitor != nullptr && monitor->Init()) {
145                 monitor->RegisterListener(std::bind(&WakeupController::ControlListener, this, std::placeholders::_1));
146                 monitorMap_.emplace(monitor->GetReason(), monitor);
147             }
148         }
149     };
150     g_wakeupSourcesKeyObserver = SettingHelper::RegisterSettingWakeupSourcesObserver(updateFunc);
151     POWER_HILOGI(FEATURE_POWER_STATE, "register setting observer fin");
152 }
153 
ExecWakeupMonitorByReason(WakeupDeviceType reason)154 void WakeupController::ExecWakeupMonitorByReason(WakeupDeviceType reason)
155 {
156     std::lock_guard lock(monitorMutex_);
157     if (monitorMap_.find(reason) != monitorMap_.end()) {
158         auto monitor = monitorMap_[reason];
159         monitor->Notify();
160     }
161 }
162 
Wakeup()163 void WakeupController::Wakeup()
164 {
165     auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
166     if (pms == nullptr) {
167         POWER_HILOGE(FEATURE_WAKEUP, "get powerMgrService instance error");
168         return;
169     }
170     auto suspendController = pms->GetSuspendController();
171     if (suspendController == nullptr) {
172         POWER_HILOGE(FEATURE_WAKEUP, "get suspendController instance error");
173         return;
174     }
175     suspendController->StopSleep();
176 }
177 
ControlListener(WakeupDeviceType reason)178 void WakeupController::ControlListener(WakeupDeviceType reason)
179 {
180     std::lock_guard lock(mutex_);
181 
182     if (!Permission::IsSystem()) {
183         return;
184     }
185     auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
186     if (pms == nullptr) {
187         return;
188     }
189 
190     if (pms->IsScreenOn()) {
191         return;
192     }
193 
194     pid_t pid = IPCSkeleton::GetCallingPid();
195     auto uid = IPCSkeleton::GetCallingUid();
196     POWER_HILOGI(FEATURE_WAKEUP, "Try to wakeup device, pid=%{public}d, uid=%{public}d", pid, uid);
197 
198     if (stateMachine_->GetState() != PowerState::AWAKE) {
199         Wakeup();
200         if (IsHandleSysfreeze()) {
201             StartWakeupTimer();
202         }
203         SystemSuspendController::GetInstance().Wakeup();
204         POWER_HILOGI(FEATURE_WAKEUP, "wakeup Request: %{public}d", reason);
205 
206         if (stateMachine_->GetState() == PowerState::SLEEP) {
207             auto suspendController = pms->GetSuspendController();
208             if (suspendController != nullptr) {
209                 POWER_HILOGI(FEATURE_WAKEUP, "WakeupController::ControlListener TriggerSyncSleepCallback start.");
210                 suspendController->TriggerSyncSleepCallback(true);
211             } else {
212                 POWER_HILOGI(FEATURE_WAKEUP, "suspendController is nullptr");
213             }
214         }
215 
216 #ifdef POWER_MANAGER_WAKEUP_ACTION
217     POWER_HILOGI(FEATURE_WAKEUP, "start get wakeup action reason");
218     if ((reason == WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON) &&
219         (pms->GetWakeupActionController()->ExecuteByGetReason())) {
220             POWER_HILOGI(FEATURE_WAKEUP, "wakeup action reason avaiable");
221             return;
222     }
223 #endif
224 
225         bool ret = stateMachine_->SetState(
226             PowerState::AWAKE, stateMachine_->GetReasonByWakeType(static_cast<WakeupDeviceType>(reason)), true);
227         if (ret != true) {
228             POWER_HILOGI(FEATURE_WAKEUP, "setstate wakeup error");
229         }
230     } else {
231         POWER_HILOGI(FEATURE_WAKEUP, "state=%{public}u no transitor", stateMachine_->GetState());
232     }
233 }
234 
StartWakeupTimer()235 void WakeupController::StartWakeupTimer()
236 {
237     FFRTTask task = [this] {
238         HandleScreenOnTimeout();
239     };
240     g_screenTimeoutHandle = FFRTUtils::SubmitDelayTask(task, WakeupMonitor::POWER_KEY_PRESS_DELAY_MS, queue_);
241 }
242 
IsHandleSysfreeze()243 bool WakeupController::IsHandleSysfreeze()
244 {
245     Rosen::FocusChangeInfo focusChangeInfo;
246     Rosen::WindowManager::GetInstance().GetFocusWindowInfo(focusChangeInfo);
247     int uid = focusChangeInfo.uid_;
248     POWER_HILOGD(FEATURE_WAKEUP, "focusChangeInfo.uid_ %{public}d.", uid);
249     std::string bundleName;
250     AppExecFwk::BundleMgrClient client;
251     if (client.GetNameForUid(uid, bundleName) != ERR_OK) {
252         POWER_HILOGW(FEATURE_WAKEUP, "Failed to query bundleName from bms, uid:%{public}d.", uid);
253         return true;
254     } else {
255         POWER_HILOGD(FEATURE_WAKEUP, "bundleName of uid:%{public}d is %{public}s", uid, bundleName.c_str());
256     }
257 
258     if (bundleName.empty()) {
259         return true;
260     }
261 
262     bool ret = DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->IsAttachDebug(bundleName);
263     if (ret) {
264         POWER_HILOGI(FEATURE_WAKEUP, "sysfreeze filtration %{public}s.", bundleName.c_str());
265         return false;
266     }
267 
268     return true;
269 }
270 
HandleScreenOnTimeout()271 void WakeupController::HandleScreenOnTimeout()
272 {
273     if (IsHandleSysfreeze()) {
274         POWER_HILOGI(FEATURE_INPUT, "ScreenOnTimeout");
275     }
276 }
277 
Reset()278 void WakeupController::Reset()
279 {
280     queue_.reset();
281 }
282 
283 #ifdef HAS_MULTIMODALINPUT_INPUT_PART
284 /* InputCallback achieve */
OnInputEvent(std::shared_ptr<KeyEvent> keyEvent) const285 void InputCallback::OnInputEvent(std::shared_ptr<KeyEvent> keyEvent) const
286 {
287     auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
288     if (pms == nullptr) {
289         POWER_HILOGE(FEATURE_WAKEUP, "get powerMgrService instance error");
290         return;
291     }
292     int64_t now = static_cast<int64_t>(time(nullptr));
293     pms->RefreshActivity(now, UserActivityType::USER_ACTIVITY_TYPE_BUTTON, false);
294 
295     PowerState state = pms->GetState();
296     if (state == PowerState::AWAKE || state == PowerState::FREEZE) {
297         return;
298     }
299     std::shared_ptr<WakeupController> wakeupController = pms->GetWakeupController();
300     if (wakeupController == nullptr) {
301         POWER_HILOGE(FEATURE_WAKEUP, "wakeupController is not init");
302         return;
303     }
304 
305     int32_t keyCode = keyEvent->GetKeyCode();
306     WakeupDeviceType wakeupType = WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN;
307     if (keyCode == KeyEvent::KEYCODE_F1) {
308         wakeupType = WakeupDeviceType::WAKEUP_DEVICE_DOUBLE_CLICK;
309     }
310 
311     if (keyCode >= KeyEvent::KEYCODE_0 && keyCode <= KeyEvent::KEYCODE_NUMPAD_RIGHT_PAREN) {
312         wakeupType = WakeupDeviceType::WAKEUP_DEVICE_KEYBOARD;
313         if (wakeupController->CheckEventReciveTime(wakeupType) ||
314             keyEvent->GetKeyAction() == KeyEvent::KEY_ACTION_UP) {
315             return;
316         }
317     }
318 
319     POWER_HILOGI(FEATURE_WAKEUP, "KeyEvent wakeupType=%{public}u, keyCode=%{public}d", wakeupType, keyCode);
320     if (wakeupType != WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN) {
321         wakeupController->ExecWakeupMonitorByReason(wakeupType);
322     }
323 }
324 
OnInputEvent(std::shared_ptr<PointerEvent> pointerEvent) const325 void InputCallback::OnInputEvent(std::shared_ptr<PointerEvent> pointerEvent) const
326 {
327     auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
328     if (pms == nullptr) {
329         return;
330     }
331     int64_t now = static_cast<int64_t>(time(nullptr));
332     pms->RefreshActivity(now, UserActivityType::USER_ACTIVITY_TYPE_TOUCH, false);
333     if (!NeedHandle(pointerEvent, pms)) {
334         return;
335     }
336     std::shared_ptr<WakeupController> wakeupController = pms->GetWakeupController();
337     WakeupDeviceType wakeupType = WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN;
338     PointerEvent::PointerItem pointerItem;
339     if (!pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem)) {
340         POWER_HILOGI(FEATURE_WAKEUP, "GetPointerItem false");
341     }
342     int32_t deviceType = pointerItem.GetToolType();
343     int32_t sourceType = pointerEvent->GetSourceType();
344     if (deviceType == PointerEvent::TOOL_TYPE_PEN) {
345         wakeupType = WakeupDeviceType::WAKEUP_DEVICE_PEN;
346         if (wakeupController->CheckEventReciveTime(wakeupType)) {
347             return;
348         }
349         wakeupController->ExecWakeupMonitorByReason(wakeupType);
350         return;
351     }
352 
353     switch (sourceType) {
354         case PointerEvent::SOURCE_TYPE_MOUSE:
355             wakeupType = WakeupDeviceType::WAKEUP_DEVICE_MOUSE;
356             break;
357         case PointerEvent::SOURCE_TYPE_TOUCHPAD:
358             wakeupType = WakeupDeviceType::WAKEUP_DEVICE_TOUCHPAD;
359             break;
360         case PointerEvent::SOURCE_TYPE_TOUCHSCREEN:
361             wakeupType = WakeupDeviceType::WAKEUP_DEVICE_SINGLE_CLICK;
362             break;
363         default:
364             break;
365     }
366     if (wakeupController->CheckEventReciveTime(wakeupType)) {
367         return;
368     }
369 
370     if (wakeupType != WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN) {
371         wakeupController->ExecWakeupMonitorByReason(wakeupType);
372     }
373 }
374 
NeedHandle(std::shared_ptr<PointerEvent> & pointerEvent,sptr<PowerMgrService> & pms) const375 bool InputCallback::NeedHandle(std::shared_ptr<PointerEvent>& pointerEvent, sptr<PowerMgrService>& pms) const
376 {
377     PowerState state = pms->GetState();
378     if (state == PowerState::AWAKE || state == PowerState::FREEZE) {
379         return false;
380     }
381     if (pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_ENTER_WINDOW
382         || pointerEvent->GetPointerAction() == PointerEvent::POINTER_ACTION_LEAVE_WINDOW) {
383             return false;
384     }
385     return true;
386 }
387 
OnInputEvent(std::shared_ptr<AxisEvent> axisEvent) const388 void InputCallback::OnInputEvent(std::shared_ptr<AxisEvent> axisEvent) const
389 {
390     POWER_HILOGD(FEATURE_WAKEUP, "AxisEvent");
391     auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
392     if (pms == nullptr) {
393         return;
394     }
395     int64_t now = static_cast<int64_t>(time(nullptr));
396     pms->RefreshActivity(now, UserActivityType::USER_ACTIVITY_TYPE_ACCESSIBILITY, false);
397 }
398 #endif
399 
CheckEventReciveTime(WakeupDeviceType wakeupType)400 bool WakeupController::CheckEventReciveTime(WakeupDeviceType wakeupType)
401 {
402     // The minimum refreshactivity interval is 100ms!!
403     std::lock_guard lock(eventHandleMutex_);
404     int64_t now = GetTickCount();
405     if (eventHandleMap_.find(wakeupType) != eventHandleMap_.end()) {
406         if ((eventHandleMap_[wakeupType] + MIN_TIME_MS_BETWEEN_MULTIMODEACTIVITIES) > now) {
407             return true;
408         }
409         eventHandleMap_[wakeupType] = now;
410         return false;
411     }
412     return false;
413 }
414 
415 /* WakeupMonitor Implement */
416 
CreateMonitor(WakeupSource & source)417 std::shared_ptr<WakeupMonitor> WakeupMonitor::CreateMonitor(WakeupSource& source)
418 {
419     WakeupDeviceType reason = source.GetReason();
420     POWER_HILOGE(FEATURE_WAKEUP, "CreateMonitor reason=%{public}d", reason);
421     std::shared_ptr<WakeupMonitor> monitor = nullptr;
422     switch (reason) {
423         case WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON:
424             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<PowerkeyWakeupMonitor>(source));
425             break;
426         case WakeupDeviceType::WAKEUP_DEVICE_MOUSE:
427             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<MousekeyWakeupMonitor>(source));
428             break;
429         case WakeupDeviceType::WAKEUP_DEVICE_KEYBOARD:
430             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<KeyboardWakeupMonitor>(source));
431             break;
432         case WakeupDeviceType::WAKEUP_DEVICE_PEN:
433             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<PenWakeupMonitor>(source));
434             break;
435         case WakeupDeviceType::WAKEUP_DEVICE_TOUCHPAD:
436             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<TouchpadWakeupMonitor>(source));
437             break;
438         case WakeupDeviceType::WAKEUP_DEVICE_SINGLE_CLICK:
439             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<SingleClickWakeupMonitor>(source));
440             break;
441         case WakeupDeviceType::WAKEUP_DEVICE_DOUBLE_CLICK:
442             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<DoubleClickWakeupMonitor>(source));
443             break;
444         case WakeupDeviceType::WAKEUP_DEVICE_LID:
445             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<LidWakeupMonitor>(source));
446             break;
447         case WakeupDeviceType::WAKEUP_DEVICE_SWITCH:
448             monitor = std::static_pointer_cast<WakeupMonitor>(std::make_shared<SwitchWakeupMonitor>(source));
449             break;
450         default:
451             POWER_HILOGE(FEATURE_WAKEUP, "CreateMonitor : Invalid reason=%{public}d", reason);
452             break;
453     }
454     return monitor;
455 }
456 
457 /** PowerkeyWakeupMonitor Implement */
458 
Init()459 bool PowerkeyWakeupMonitor::Init()
460 {
461     if (powerkeyShortPressId_ >= 0) {
462         return true;
463     }
464     std::shared_ptr<OHOS::MMI::KeyOption> keyOption = std::make_shared<OHOS::MMI::KeyOption>();
465     std::set<int32_t> preKeys;
466     keyOption.reset();
467     keyOption = std::make_shared<OHOS::MMI::KeyOption>();
468     keyOption->SetPreKeys(preKeys);
469     keyOption->SetFinalKey(OHOS::MMI::KeyEvent::KEYCODE_POWER);
470     keyOption->SetFinalKeyDown(true);
471     keyOption->SetFinalKeyDownDuration(0);
472     powerkeyShortPressId_ = InputManager::GetInstance()->SubscribeKeyEvent(
473         keyOption, [this](std::shared_ptr<OHOS::MMI::KeyEvent> keyEvent) {
474             POWER_HILOGI(FEATURE_WAKEUP, "receive wakeup controller key down");
475             auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
476             if (pms == nullptr) {
477                 return;
478             }
479             pms->RefreshActivity(
480                 static_cast<int64_t>(time(nullptr)), UserActivityType::USER_ACTIVITY_TYPE_BUTTON, false);
481             std::shared_ptr<SuspendController> suspendController = pms->GetSuspendController();
482             suspendController->RecordPowerKeyDown();
483             Notify();
484         });
485 
486     POWER_HILOGI(FEATURE_WAKEUP, "powerkey register powerkeyShortPressId_=%{public}d", powerkeyShortPressId_);
487     return powerkeyShortPressId_ >= 0 ? true : false;
488 }
489 
Cancel()490 void PowerkeyWakeupMonitor::Cancel()
491 {
492     if (powerkeyShortPressId_ >= 0) {
493         POWER_HILOGI(FEATURE_WAKEUP, "UnsubscribeKeyEvent: PowerkeyWakeupMonitor");
494         InputManager::GetInstance()->UnsubscribeKeyEvent(powerkeyShortPressId_);
495     }
496 }
497 
498 /** Keyboard Implement */
499 
Init()500 bool KeyboardWakeupMonitor::Init()
501 {
502     return true;
503 }
504 
Cancel()505 void KeyboardWakeupMonitor::Cancel() {}
506 
507 /** Mouse Implement */
508 
Init()509 bool MousekeyWakeupMonitor::Init()
510 {
511     return true;
512 }
513 
Cancel()514 void MousekeyWakeupMonitor::Cancel() {}
515 
516 /** Mouse Implement */
517 
Init()518 bool TouchpadWakeupMonitor::Init()
519 {
520     return true;
521 }
522 
Cancel()523 void TouchpadWakeupMonitor::Cancel() {}
524 
525 /** Pen Implement */
526 
Init()527 bool PenWakeupMonitor::Init()
528 {
529     return true;
530 }
531 
Cancel()532 void PenWakeupMonitor::Cancel() {}
533 
534 /** SingleClickWakeupMonitor Implement */
535 
Init()536 bool SingleClickWakeupMonitor::Init()
537 {
538     return true;
539 }
540 
Cancel()541 void SingleClickWakeupMonitor::Cancel() {}
542 
543 /** DoubleClickWakeupMonitor Implement */
544 
Init()545 bool DoubleClickWakeupMonitor::Init()
546 {
547     return true;
548 }
549 
Cancel()550 void DoubleClickWakeupMonitor::Cancel() {}
551 
552 /** SwitchWakeupMonitor Implement */
553 
Init()554 bool SwitchWakeupMonitor::Init()
555 {
556     return true;
557 }
558 
Cancel()559 void SwitchWakeupMonitor::Cancel() {}
560 
561 /** LidWakeupMonitor Implement */
562 
Init()563 bool LidWakeupMonitor::Init()
564 {
565     return true;
566 }
567 
Cancel()568 void LidWakeupMonitor::Cancel() {}
569 
570 } // namespace PowerMgr
571 } // namespace OHOS
572