bug fix new

Signed-off-by: haoxinpeng <haoxinpeng1@huawei.com>
This commit is contained in:
c30063259 2024-11-18 22:02:11 +08:00
parent d026dc6d78
commit 1e75f997e0
4 changed files with 13 additions and 16 deletions

View File

@ -756,7 +756,7 @@ private:
WSError StartOrMinimizeUIAbilityBySCB(const sptr<SceneSession>& sceneSession, bool isUserActive);
/*
* Specific Window
* Window Recover
*/
bool IsWindowSupportCacheForRecovering(const sptr<SceneSession>& sceneSession,
const sptr<WindowSessionProperty>& property);

View File

@ -2859,9 +2859,7 @@ void SceneSessionManager::CacheSpecificSessionForRecovering(
if (WindowHelper::IsSubWindow(windowType)) {
recoverSubSessionCacheMap_[parentId].emplace_back(sceneSession);
}
if (WindowHelper::IsDialogWindow(windowType)) {
} else if (WindowHelper::IsDialogWindow(windowType)) {
recoverDialogSessionCacheMap_[parentId].emplace_back(sceneSession);
}
}
@ -2886,9 +2884,9 @@ bool SceneSessionManager::IsWindowSupportCacheForRecovering(
auto parentId = property->GetParentPersistentId();
if ((WindowHelper::IsSubWindow(windowType) &&
createSubSessionFuncMap_.find(parentId) != createSubSessionFuncMap_.end()) ||
createSubSessionFuncMap_.find(parentId) != createSubSessionFuncMap_.end()) ||
(WindowHelper::IsDialogWindow(windowType) &&
bindDialogTargetFuncMap_.find(parentId) != bindDialogTargetFuncMap_.end())) {
bindDialogTargetFuncMap_.find(parentId) != bindDialogTargetFuncMap_.end())) {
return false;
}
@ -2949,8 +2947,7 @@ WSError SceneSessionManager::RecoverAndReconnectSceneSession(const sptr<ISession
return WSError::WS_ERROR_NULLPTR;
}
SessionInfo sessionInfo = RecoverSessionInfo(property);
sptr<SceneSession> sceneSession = nullptr;
sceneSession = RequestSceneSession(sessionInfo, nullptr);
sptr<SceneSession> sceneSession = RequestSceneSession(sessionInfo, nullptr);
if (sceneSession == nullptr) {
TLOGE(WmsLogTag::WMS_RECOVER, "Request sceneSession failed");
return WSError::WS_ERROR_NULLPTR;
@ -3015,12 +3012,11 @@ void SceneSessionManager::RegisterBindDialogTargetListener(const sptr<SceneSessi
{
int32_t persistentId = session->GetPersistentId();
TLOGI(WmsLogTag::WMS_DIALOG, "Id: %{public}d", persistentId);
auto task = [this, session, persistentId, func = std::move(func)]() {
taskScheduler_->PostTask([this, session, persistentId, func = std::move(func)] {
session->RegisterBindDialogSessionCallback(func);
bindDialogTargetFuncMap_[persistentId] = std::move(func);
RecoverCachedDialogSession(persistentId);
};
taskScheduler_->PostTask(task, __func__);
}, __func__);
}
void SceneSessionManager::NotifyCreateSpecificSession(sptr<SceneSession> newSession,

View File

@ -2196,12 +2196,12 @@ HWTEST_F(SceneSessionManagerTest2, NotifyCreateToastSession, Function | SmallTes
*/
HWTEST_F(SceneSessionManagerTest2, RecoverCachedDialogSession, Function | SmallTest | Level3)
{
sptr<WindowSessionProperty> property;
ASSERT_NE(ssm_, nullptr);
ssm_->recoveringFinished_ = false;
SessionInfo info;
info.abilityName_ = "test1";
info.bundleName_ = "test2";
sptr<WindowSessionProperty> property;
sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(info, property);
ASSERT_NE(sceneSession, nullptr);

View File

@ -441,8 +441,8 @@ WMError WindowSceneSessionImpl::CreateSystemWindow(WindowType type)
WMError WindowSceneSessionImpl::RecoverAndConnectSpecificSession()
{
TLOGI(WmsLogTag::WMS_RECOVER, "windowName = %{public}s, windowMode = %{public}u, windowType = %{public}u, "
"persistentId = %{public}d, windowState = %{public}d, requestWindowState = %{public}d, parentId = %{public}d",
TLOGI(WmsLogTag::WMS_RECOVER, "windowName=%{public}s, windowMode=%{public}u, windowType=%{public}u, "
"persistentId=%{public}d, windowState=%{public}d, requestWindowState=%{public}d, parentId=%{public}d",
GetWindowName().c_str(), property_->GetWindowMode(), property_->GetWindowType(), GetPersistentId(), state_,
requestState_, property_->GetParentId());
@ -473,6 +473,7 @@ WMError WindowSceneSessionImpl::RecoverAndConnectSpecificSession()
iSessionStage, eventChannel, surfaceNode_, property_, session, token);
property_->SetWindowState(state_);
if (session == nullptr) {
TLOGE(WmsLogTag::WMS_RECOVER, "Recover failed, session is nullptr");
return WMError::WM_ERROR_NULLPTR;
@ -490,8 +491,8 @@ WMError WindowSceneSessionImpl::RecoverAndConnectSpecificSession()
WMError WindowSceneSessionImpl::RecoverAndReconnectSceneSession()
{
TLOGI(WmsLogTag::WMS_RECOVER, "windowName = %{public}s, windowMode = %{public}u, windowType = %{public}u, "
"persistentId = %{public}d, windowState = %{public}d, requestWindowState = %{public}d", GetWindowName().c_str(),
TLOGI(WmsLogTag::WMS_RECOVER, "windowName=%{public}s, windowMode=%{public}u, windowType=%{public}u, "
"persistentId=%{public}d, windowState=%{public}d, requestWindowState=%{public}d", GetWindowName().c_str(),
property_->GetWindowMode(), property_->GetWindowType(), GetPersistentId(), state_, requestState_);
if (isFocused_) {