diff --git a/services/native/src/power_state_machine.cpp b/services/native/src/power_state_machine.cpp index bd458572fa14cf5a6c3835724d5a54c6e3152ebc..6d5535dde1a51f9f65e77bc87c83ea8ea79b34f4 100644 --- a/services/native/src/power_state_machine.cpp +++ b/services/native/src/power_state_machine.cpp @@ -213,6 +213,11 @@ bool PowerStateMachine::CanTransitTo(PowerState from, PowerState to, StateChange } #endif } + if (reason == StateChangeReason::STATE_CHANGE_REASON_PROXIMITY && to == PowerState::INACTIVE && + !IsRunningLockEnabled(RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL)) { + POWER_HILOGI(FEATURE_POWER_STATE, "this proximity task is invalidated, directly return"); + return false; + } bool isAllowed = (!allowMapByReason_.count(reason) || (allowMapByReason_[reason].count(currentState_) && allowMapByReason_[reason][currentState_].count(to))); return isAllowed;