check screen connection in display controller init

Signed-off-by: wangxinpeng <wangxinpeng4@huawei.com>
Change-Id: Ia480d042d4b2e90a013cab7ceb8772a9cd7d7579
This commit is contained in:
wangxinpeng
2022-02-16 15:15:41 +08:00
parent 936fa29eb2
commit 1b888890cf
3 changed files with 16 additions and 0 deletions
@@ -42,6 +42,7 @@ public:
~AbstractScreenController();
void Init();
void ScreenConnectionInDisplayInit(sptr<AbstractScreenCallback> abstractScreenCallback);
std::vector<ScreenId> GetAllScreenIds();
sptr<AbstractScreen> GetAbstractScreen(ScreenId dmsScreenId) const;
std::vector<ScreenId> GetShotScreenIds(std::vector<ScreenId>) const;
@@ -52,6 +52,7 @@ void AbstractDisplayController::Init(sptr<AbstractScreenController> abstractScre
abstractScreenCallback_->onChange_
= std::bind(&AbstractDisplayController::OnAbstractScreenChange, this, std::placeholders::_1,
std::placeholders::_2);
abstractScreenController_->ScreenConnectionInDisplayInit(abstractScreenCallback_);
abstractScreenController->RegisterAbstractScreenCallback(abstractScreenCallback_);
// TODO: Active the code after "rsDisplayNode_->SetScreenId(rsScreenId)" is provided.
@@ -234,6 +234,20 @@ void AbstractScreenController::OnRsScreenConnectionChange(ScreenId rsScreenId, S
}
}
void AbstractScreenController::ScreenConnectionInDisplayInit(sptr<AbstractScreenCallback> abstractScreenCallback)
{
std::lock_guard<std::recursive_mutex> lock(mutex_);
if (dmsScreenMap_.empty()) {
return;
}
for (auto& iter : dmsScreenMap_) {
if (iter.second != nullptr && abstractScreenCallback != nullptr) {
WLOGFI("dmsScreenId :%{public}" PRIu64"", iter.first);
abstractScreenCallback->onConnect_(iter.second);
}
}
}
void AbstractScreenController::ProcessScreenModeChanged(ScreenId rsScreenId)
{
WM_SCOPED_TRACE("dms:ProcessScreenModeChanged(%" PRIu64")", rsScreenId);