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_UTILS_HOOKMGR_POWER_HOOKMGR_H 17 #define POWERMGR_UTILS_HOOKMGR_POWER_HOOKMGR_H 18 19 #include <cstdint> 20 #include <string> 21 #include <hookmgr.h> 22 #include "modulemgr.h" 23 #include "iproximity_controller.h" 24 25 namespace OHOS { 26 namespace PowerMgr { 27 enum class PowerHookStage : int32_t { 28 POWER_HDI_CALLBACK_WAKEUP = 0, 29 POWER_PRE_SWITCH_ACCOUNT, 30 POWER_POST_SWITCH_ACCOUNT, 31 POWER_PRE_DO_REBOOT, 32 POWER_PRE_DO_SHUTDOWN, 33 POWER_PROXIMITY_CONTROLLER_INIT, 34 POWER_HOOK_STAGE_MAX = 1000, 35 }; 36 37 struct RebootCmdInfo { 38 std::string rebootReason; 39 std::string rebootCmd; 40 }; 41 42 struct ProximityControllerContext { 43 std::shared_ptr<IProximityController> controllerPtr {nullptr}; 44 std::function<void(uint32_t)> action {nullptr}; 45 }; 46 47 HOOK_MGR* GetPowerHookMgr(); 48 } // namespace PowerMgr 49 } // namespace OHOS 50 51 #endif // POWERMGR_UTILS_HOOKMGR_POWER_HOOKMGR_H