From 2bae84483566a0625f619f040870d9c28143c051 Mon Sep 17 00:00:00 2001 From: yanxuejun12 Date: Mon, 21 Jul 2025 09:33:05 +0800 Subject: [PATCH] fix: prevent repeated closing the lid Signed-off-by: yanxuejun12 --- services/native/src/power_mgr_service.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/native/src/power_mgr_service.cpp b/services/native/src/power_mgr_service.cpp index 67360457..34a01f21 100644 --- a/services/native/src/power_mgr_service.cpp +++ b/services/native/src/power_mgr_service.cpp @@ -476,12 +476,17 @@ void PowerMgrService::HallSensorCallback(SensorEvent* event) auto status = static_cast(data->status); if (status & LID_CLOSED_HALL_FLAG) { + if (isInLidMode_) { + POWER_HILOGI(FEATURE_SUSPEND, "[UL_POWER] Lid close event received again"); + return; + } POWER_HILOGI(FEATURE_SUSPEND, "[UL_POWER] Lid close event received, begin to suspend"); isInLidMode_ = true; SuspendDeviceType reason = SuspendDeviceType::SUSPEND_DEVICE_REASON_LID; suspendController->ExecSuspendMonitorByReason(reason); } else { if (!isInLidMode_) { + POWER_HILOGI(FEATURE_SUSPEND, "[UL_POWER] Lid open event received again"); return; } POWER_HILOGI(FEATURE_WAKEUP, "[UL_POWER] Lid open event received, begin to wakeup"); -- Gitee