窗口displayId上报

Signed-off-by: donglin <donglin9@huawei.com>
Change-Id: Iecf4a12c1eb6f0210f3d192b40c2bbbbf5fa8a0c
This commit is contained in:
donglin
2024-09-21 11:34:57 +00:00
parent eeb33e758c
commit 4d4f78d678
2 changed files with 15 additions and 0 deletions
@@ -227,6 +227,9 @@ void UIAbility::OnStop()
return;
}
lifecycle_->DispatchLifecycle(AppExecFwk::LifeCycle::Event::ON_STOP);
#ifdef SUPPORT_SCREEN
Rosen::DisplayManager::GetInstance().RemoveDisplayIdFromAms(token_);
#endif
TAG_LOGD(AAFwkTag::UIABILITY, "end");
}
@@ -1036,6 +1039,9 @@ void UIAbility::OnStartForSupportGraphics(const AAFwk::Want &want)
int32_t displayId = want.GetIntParam(AAFwk::Want::PARAM_RESV_DISPLAY_ID, defualtDisplayId);
TAG_LOGD(AAFwkTag::UIABILITY, "abilityName: %{public}s, displayId: %{public}d",
abilityInfo_->name.c_str(), displayId);
#ifdef SUPPORT_SCREEN
Rosen::DisplayManager::GetInstance().AddDisplayIdFromAms(displayId, token_);
#endif
auto option = GetWindowOption(want);
InitWindow(displayId, option);
@@ -2058,6 +2058,15 @@ void MainThread::HandleLaunchAbility(const std::shared_ptr<AbilityLocalRecord> &
AbilityThread::AbilityThreadMain(application, abilityRecord, mainHandler_->GetEventRunner(), stageContext);
#endif
};
#ifdef SUPPORT_SCREEN
Rosen::DisplayId defaultDisplayId = Rosen::DisplayManager::GetInstance().GetDefaultDisplayId();
Rosen::DisplayId displayId = defaultDisplayId;
if (abilityRecord->GetWant() != nullptr) {
displayId = abilityRecord->GetWant()->GetIntParam(AAFwk::Want::PARAM_RESV_DISPLAY_ID, defaultDisplayId);
}
Rosen::DisplayManager::GetInstance().AddDisplayIdFromAms(displayId, abilityRecord->GetToken());
TAG_LOGD(AAFwkTag::APPKIT, "add displayId: %{public}" PRIu64, displayId);
#endif
bool isAsyncCallback = false;
std::shared_ptr<AbilityRuntime::Context> stageContext = application_->AddAbilityStage(
abilityRecord, callback, isAsyncCallback);