1 /* 2 * Copyright (c) 2025 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 #ifndef POWERMGR_SERVICE_FUZZ_TEST_H 17 #define POWERMGR_SERVICE_FUZZ_TEST_H 18 19 #include "power_mgr_service.h" 20 #include "power_mgr_async_reply_stub.h" 21 #include "screen_off_pre_callback_stub.h" 22 #include "sync_hibernate_callback_stub.h" 23 #include "sync_sleep_callback_stub.h" 24 #include "power_state_callback_stub.h" 25 #include "power_mode_callback_stub.h" 26 #include "power_runninglock_callback_stub.h" 27 #include "shutdown/async_shutdown_callback_stub.h" 28 #include "shutdown/sync_shutdown_callback_stub.h" 29 #include "shutdown/takeover_shutdown_callback_stub.h" 30 31 namespace OHOS { 32 namespace PowerMgr { 33 class PowerRunningLockTestCallback : public PowerRunningLockCallbackStub { 34 public: PowerRunningLockTestCallback()35 PowerRunningLockTestCallback() {}; ~PowerRunningLockTestCallback()36 virtual ~PowerRunningLockTestCallback() {}; HandleRunningLockMessage(std::string message)37 virtual void HandleRunningLockMessage(std::string message) {}; 38 }; 39 40 class PowerStateTestCallback : public PowerStateCallbackStub { 41 public: PowerStateTestCallback()42 PowerStateTestCallback() {}; ~PowerStateTestCallback()43 virtual ~PowerStateTestCallback() {}; OnPowerStateChanged(PowerState state)44 virtual void OnPowerStateChanged(PowerState state) {}; 45 }; 46 47 class PowerSyncSleepTest1Callback : public IRemoteStub<ISyncSleepCallback> { 48 public: PowerSyncSleepTest1Callback()49 PowerSyncSleepTest1Callback() {}; ~PowerSyncSleepTest1Callback()50 virtual ~PowerSyncSleepTest1Callback() {}; OnSyncSleep(bool onForceSleep)51 virtual void OnSyncSleep(bool onForceSleep) {}; OnSyncWakeup(bool onForceSleep)52 virtual void OnSyncWakeup(bool onForceSleep) {}; 53 }; 54 55 class PowerSyncHibernateTest1Callback : public IRemoteStub<ISyncHibernateCallback> { 56 public: PowerSyncHibernateTest1Callback()57 PowerSyncHibernateTest1Callback() {}; ~PowerSyncHibernateTest1Callback()58 virtual ~PowerSyncHibernateTest1Callback() {}; OnSyncHibernate()59 virtual void OnSyncHibernate() {}; 60 virtual void OnSyncWakeup(bool hibernateResult = false) {}; 61 }; 62 63 class PowerModeTestCallback : public PowerModeCallbackStub { 64 public: PowerModeTestCallback()65 PowerModeTestCallback() {}; ~PowerModeTestCallback()66 virtual ~PowerModeTestCallback() {}; OnPowerModeChanged(PowerMode mode)67 virtual void OnPowerModeChanged(PowerMode mode) {}; 68 }; 69 70 class ScreenOffPreTestCallback : public IRemoteStub<IScreenOffPreCallback> { 71 public: ScreenOffPreTestCallback()72 ScreenOffPreTestCallback() {}; ~ScreenOffPreTestCallback()73 virtual ~ScreenOffPreTestCallback() {}; OnScreenStateChanged(uint32_t state)74 virtual void OnScreenStateChanged(uint32_t state) {}; 75 }; 76 77 class TakeOverShutdownCallback : public TakeOverShutdownCallbackStub { 78 public: 79 ~TakeOverShutdownCallback() override = default; 80 bool OnTakeOverShutdown(const TakeOverInfo& info) override; 81 bool OnTakeOverHibernate(const TakeOverInfo& info) override; 82 }; 83 84 class AsyncShutdownCallback : public AsyncShutdownCallbackStub { 85 public: 86 ~AsyncShutdownCallback() override = default; 87 void OnAsyncShutdown() override; 88 void OnAsyncShutdownOrReboot(bool isReboot) override; 89 }; 90 91 class SyncShutdownCallback : public SyncShutdownCallbackStub { 92 public: 93 ~SyncShutdownCallback() override = default; 94 void OnSyncShutdown() override; 95 void OnSyncShutdownOrReboot(bool isReboot) override; 96 }; 97 } // namespace PowerMgr 98 } // namespace OHOS 99 #endif // POWERMGR_SERVICE_FUZZ_TEST_H