//否则,则解析VENDOR_POWER_MODE_CONFIG_PATH
if (!StartXMlParse(VENDOR_POWER_MODE_CONFIG_PATH)) {
POWER_HILOGI(FEATURE_POWER_MODE, "No vendor power_mode_config.xml, start to parse system config");
// 若VENDOR_POWER_MODE_CONFIG_PATH失败,解析SYSTEM_POWER_MODE_CONFIG_PATH
StartXMlParse(SYSTEM_POWER_MODE_CONFIG_PATH);
}
}
```
展开power_mode_config.xml配置文件,解读息屏休眠相关参数:proxy id、switch id 101、102。不同的产品可对这些参数按需进行配置。
```c++
DisplayState ScreenController::SetOnState()
{
DISPLAY_HILOGI(COMP_SVC, "Set the dispaly state is ON after overriding display on delay");
state_ = DisplayState::DISPLAY_ON;
return state_;
}
----------------------------------------------------------------------------------------------------------------
DisplayState ScreenController::SetDelayOffState()
{
DISPLAY_HILOGI(COMP_SVC, "Set the dispaly state is DELAY OFF when overriding display off delay");
state_ = DisplayState::DISPLAY_DELAY_OFF;
return state_;
}
```
```c++
void ScreenController::OnStateChanged(DisplayState state, uint32_t reason)
{
auto pms = DelayedSpSingleton<DisplayPowerMgrService>::GetInstance();
if (pms == nullptr) {
DISPLAY_HILOGW(FEAT_STATE, "pms is nullptr");
return;
}
// 进行功耗设置
bool ret = action_->SetDisplayPower(state, stateChangeReason_);
if (state == DisplayState::DISPLAY_ON) {
// Restore the brightness before screen off
uint32_t screenOnBrightness = GetScreenOnBrightness();
UpdateBrightness(screenOnBrightness);
}