mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
窗口displayId上报
Signed-off-by: donglin <donglin9@huawei.com> Change-Id: Iecf4a12c1eb6f0210f3d192b40c2bbbbf5fa8a0c
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user