From b8d421b7d94ca74303858e716ca18f09005e450f Mon Sep 17 00:00:00 2001 From: chenqinxin Date: Wed, 2 Mar 2022 17:52:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AD=E5=B1=8F=E6=97=B6=E5=AF=B9=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=89=A9=E7=90=86=E5=B1=8F=E8=B0=83=E7=94=A8=E4=B8=8B?= =?UTF-8?q?=E7=94=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenqinxin Change-Id: Id8d24fb3125cf96f55d4a3d9c9566469434a58ea --- dm/src/display_manager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dm/src/display_manager.cpp b/dm/src/display_manager.cpp index 9c3b3bddb3..43abc5d3c8 100644 --- a/dm/src/display_manager.cpp +++ b/dm/src/display_manager.cpp @@ -21,6 +21,7 @@ #include "display_manager_adapter.h" #include "display_manager_agent_default.h" #include "dm_common.h" +#include "screen_manager.h" #include "singleton_delegator.h" #include "window_manager_hilog.h" @@ -537,11 +538,10 @@ bool DisplayManager::SuspendEnd() bool DisplayManager::SetScreenPowerForAll(DisplayPowerState state, PowerStateChangeReason reason) { - // TODO: should get all screen ids WLOGFI("state:%{public}u, reason:%{public}u", state, reason); - ScreenId defaultId = GetDefaultDisplayId(); - if (defaultId == DISPLAY_ID_INVALD) { - WLOGFI("defaultId invalid!"); + auto screens = ScreenManager::GetInstance().GetAllScreens(); + if (screens.empty()) { + WLOGFW("No screen found !"); return false; } ScreenPowerStatus status; @@ -559,7 +559,11 @@ bool DisplayManager::SetScreenPowerForAll(DisplayPowerState state, PowerStateCha return false; } } - RSInterfaces::GetInstance().SetScreenPowerStatus(defaultId, status); + for (auto& screen : screens) { + if (screen != nullptr && screen->IsReal()) { + RSInterfaces::GetInstance().SetScreenPowerStatus(screen->GetId(), status); + } + } WLOGFI("SetScreenPowerStatus end"); return SingletonContainer::Get().SetScreenPowerForAll(state, reason); }