diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index 48d078945f38b024195959fc11ef2d021d6fba5d..f37fa7b72508b601e16c80535fe45315655889fb 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -1818,9 +1818,9 @@ WSError SceneSessionManager::CreateAndConnectSpecificSession(const sptr(type); - if (WindowHelper::IsSystemWindow(type) || WindowHelper::IsSubWindow(type)) { - info.bundleName_ = property->GetSessionInfo().bundleName_; - } + info.bundleName_ = property->GetSessionInfo().bundleName_; + info.abilityName_ = property->GetSessionInfo().abilityName_; + info.moduleName_ = property->GetSessionInfo().moduleName_; ClosePipWindowIfExist(type); sptr newSession = RequestSceneSession(info, property); diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 5450fc026e8da4fd4af55d8077bce494bcd3b328..4f4e6bb142df01a027f9c3ddaef681a4e9ccfb77 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -170,6 +170,14 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() property_->SetTokenState(true); } const WindowType& type = GetType(); + auto abilityContext = AbilityRuntime::Context::ConvertTo(context_); + if (property_ && abilityContext && abilityContext->GetAbilityInfo()) { + auto info = property_->GetSessionInfo(); + info.abilityName_ = abilityContext->GetAbilityInfo()->name; + info.moduleName_ = context_->GetHapModuleInfo()->moduleName; + info.bundleName_ = abilityContext->GetAbilityInfo()->bundleName; + property_->SetSessionInfo(info); + } if (WindowHelper::IsSubWindow(type) && (property_->GetExtensionFlag() == false)) { // sub window auto parentSession = FindParentSessionByParentId(property_->GetParentId()); if (parentSession == nullptr || parentSession->GetHostSession() == nullptr) { @@ -177,12 +185,6 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() property_->GetWindowName().c_str(), type); return WMError::WM_ERROR_NULLPTR; } - auto abilityContext = AbilityRuntime::Context::ConvertTo(context_); - if (property_ && abilityContext && abilityContext->GetAbilityInfo()) { - auto info = property_->GetSessionInfo(); - info.bundleName_ = abilityContext->GetAbilityInfo()->bundleName; - property_->SetSessionInfo(info); - } // set parent persistentId property_->SetParentPersistentId(parentSession->GetPersistentId()); // creat sub session by parent session @@ -201,13 +203,6 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() return createSystemWindowRet; } PreProcessCreate(); - auto abilityContext = AbilityRuntime::Context::ConvertTo(context_); - if (property_ && abilityContext && abilityContext->GetAbilityInfo()) { - auto info = property_->GetSessionInfo(); - info.bundleName_ = abilityContext->GetAbilityInfo()->bundleName; - property_->SetSessionInfo(info); - } - SingletonContainer::Get().CreateAndConnectSpecificSession(iSessionStage, eventChannel, surfaceNode_, property_, persistentId, session, windowSystemConfig_, token); if (windowSystemConfig_.maxFloatingWindowSize_ != UINT32_MAX) {