fix: Screen is off when phone is disconnected

Signed-off-by: wangyantian <wangyantian@huawei.com>
This commit is contained in:
wangyantian 2024-08-27 10:31:21 +08:00
parent 431ba2aefb
commit 16fc848476
2 changed files with 10 additions and 1 deletions

View File

@ -179,6 +179,16 @@ void RunningLockMgr::InitLocksTypeProximity()
proximityController_.Enable();
} else {
POWER_HILOGI(FEATURE_RUNNING_LOCK, "[UL_POWER] RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL inactive");
auto pms = DelayedSpSingleton<PowerMgrService>::GetInstance();
if (pms == nullptr) {
return RUNNINGLOCK_FAILURE;
}
auto stateMachine = pms->GetPowerStateMachine();
if (stateMachine == nullptr) {
return RUNNINGLOCK_FAILURE;
}
PreprocessBeforeAwake();
stateMachine->SetState(PowerState::AWAKE, StateChangeReason::STATE_CHANGE_REASON_RUNNING_LOCK);
proximityController_.Disable();
proximityController_.Clear();
}

View File

@ -16,7 +16,6 @@
#include "app_manager_utils.h"
#include "power_log.h"
#include <ability_manager_proxy.h>
#include <app_mgr_interface.h>
#include <if_system_ability_manager.h>
#include <iservice_registry.h>