mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 15:00:12 +00:00
修复独立恢复子窗和模态窗无法跟随主窗恢复问题
Signed-off-by: haoxinpeng <haoxinpeng1@huawei.com>
This commit is contained in:
parent
7156922fc8
commit
d3f4ee50bd
@ -448,6 +448,7 @@ JsSceneSession::~JsSceneSession()
|
||||
}
|
||||
session->UnregisterSessionChangeListeners();
|
||||
SceneSessionManager::GetInstance().UnregisterCreateSubSessionListener(session->GetPersistentId());
|
||||
SceneSessionManager::GetInstance().UnregisterBindDialogTargetListener(session->GetPersistentId());
|
||||
}
|
||||
|
||||
void JsSceneSession::ProcessPendingSceneSessionActivationRegister()
|
||||
@ -1029,7 +1030,8 @@ void JsSceneSession::ProcessBindDialogTargetRegister()
|
||||
TLOGE(WmsLogTag::WMS_DIALOG, "session is nullptr, id:%{public}d", persistentId_);
|
||||
return;
|
||||
}
|
||||
session->RegisterBindDialogSessionCallback(std::move(onBindDialogTarget));
|
||||
session->RegisterBindDialogSessionCallback(onBindDialogTarget);
|
||||
SceneSessionManager::GetInstance().RegisterBindDialogTargetListener(session->GetPersistentId(), onBindDialogTarget);
|
||||
TLOGD(WmsLogTag::WMS_DIALOG, "success");
|
||||
}
|
||||
|
||||
|
@ -370,6 +370,8 @@ public:
|
||||
WSError UpdateTitleInTargetPos(int32_t persistentId, bool isShow, int32_t height);
|
||||
void RegisterCreateSubSessionListener(int32_t persistentId, const NotifyCreateSubSessionFunc& func);
|
||||
void UnregisterCreateSubSessionListener(int32_t persistentId);
|
||||
void RegisterBindDialogTargetListener(int32_t persistentId, const NotifyBindDialogSessionFunc& func);
|
||||
void UnregisterBindDialogTargetListener(int32_t persistentId);
|
||||
|
||||
/*
|
||||
* Window Immersive
|
||||
@ -763,6 +765,8 @@ private:
|
||||
NotifyCreateKeyboardSessionFunc createKeyboardSessionFunc_;
|
||||
std::map<int32_t, NotifyCreateSubSessionFunc> createSubSessionFuncMap_;
|
||||
std::map<int32_t, std::vector<sptr<SceneSession>>> recoverSubSessionCacheMap_;
|
||||
std::map<int32_t, NotifyBindDialogSessionFunc> bindDialogTargetFuncMap_;
|
||||
std::map<int32_t, std::vector<sptr<SceneSession>>> recoverDialogSessionCacheMap_;
|
||||
bool recoveringFinished_ = false;
|
||||
NotifyRecoverSceneSessionFunc recoverSceneSessionFunc_;
|
||||
ProcessStatusBarEnabledChangeFunc statusBarEnabledChangeFunc_;
|
||||
@ -914,8 +918,10 @@ private:
|
||||
bool isFromInnerkits);
|
||||
void NotifyCreateSubSession(int32_t persistentId, sptr<SceneSession> session, uint32_t windowFlags = 0);
|
||||
void NotifyCreateToastSession(int32_t persistentId, sptr<SceneSession> session);
|
||||
void CacheSubSessionForRecovering(sptr<SceneSession> sceneSession, const sptr<WindowSessionProperty>& property);
|
||||
void CacheSpecificSessionForRecovering(sptr<SceneSession> sceneSession,
|
||||
const sptr<WindowSessionProperty>& property);
|
||||
void RecoverCachedSubSession(int32_t persistentId);
|
||||
void RecoverCachedDialogSession(int32_t persistentId);
|
||||
void NotifySessionUnfocusedToClient(int32_t persistentId);
|
||||
void NotifyCreateSpecificSession(sptr<SceneSession> session,
|
||||
sptr<WindowSessionProperty> property, const WindowType& type);
|
||||
@ -931,6 +937,8 @@ private:
|
||||
void HideNonSecureFloatingWindows();
|
||||
void HideNonSecureSubWindows(const sptr<SceneSession>& sceneSession);
|
||||
WSError HandleSecureSessionShouldHide(const sptr<SceneSession>& sceneSession);
|
||||
bool IsWindowSupportCacheForRecovering(sptr<SceneSession> sceneSession,
|
||||
const sptr<WindowSessionProperty>& property);
|
||||
|
||||
/*
|
||||
* Window Snapshot
|
||||
|
@ -2653,7 +2653,7 @@ WSError SceneSessionManager::CheckSessionPropertyOnRecovery(const sptr<WindowSes
|
||||
return WSError::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
} else {
|
||||
if (!IsNeedRecover(property->GetPersistentId())) {
|
||||
if (property->GetPersistentId() > 0 && !IsNeedRecover(property->GetPersistentId())) {
|
||||
TLOGE(WmsLogTag::WMS_RECOVER, "no need to recover.");
|
||||
return WSError::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
@ -2703,7 +2703,7 @@ WSError SceneSessionManager::RecoverAndConnectSpecificSession(const sptr<ISessio
|
||||
return errCode;
|
||||
}
|
||||
NotifyCreateSpecificSession(sceneSession, property, property->GetWindowType());
|
||||
CacheSubSessionForRecovering(sceneSession, property);
|
||||
CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
NotifySessionUnfocusedToClient(persistentId);
|
||||
AddClientDeathRecipient(sessionStage, sceneSession);
|
||||
session = sceneSession;
|
||||
@ -2718,41 +2718,66 @@ void SceneSessionManager::NotifyRecoveringFinished()
|
||||
TLOGI(WmsLogTag::WMS_RECOVER, "RecoverFinished clear recoverSubSessionCacheMap");
|
||||
recoveringFinished_ = true;
|
||||
recoverSubSessionCacheMap_.clear();
|
||||
recoverDialogSessionCacheMap_.clear();
|
||||
}, "NotifyRecoveringFinished");
|
||||
}
|
||||
|
||||
void SceneSessionManager::CacheSubSessionForRecovering(
|
||||
void SceneSessionManager::CacheSpecificSessionForRecovering(
|
||||
sptr<SceneSession> sceneSession, const sptr<WindowSessionProperty>& property)
|
||||
{
|
||||
if (recoveringFinished_) {
|
||||
TLOGW(WmsLogTag::WMS_RECOVER, "recovering is finished");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sceneSession == nullptr || property == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_RECOVER, "sceneSession or property is nullptr");
|
||||
if (!IsWindowSupportCacheForRecovering(sceneSession, property)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto windowType = property->GetWindowType();
|
||||
if (!SessionHelper::IsSubWindow(windowType)) {
|
||||
return;
|
||||
auto parentId = property->GetParentPersistentId();
|
||||
TLOGI(WmsLogTag::WMS_RECOVER, "Cache specificsession persistentId = %{public}" PRId32 ", parent persistentId = "
|
||||
"%{public}" PRId32 ", window type = %{public}" PRId32 , sceneSession->GetPersistentId(), parentId, windowType);
|
||||
|
||||
if (WindowHelper::IsSubWindow(windowType)) {
|
||||
if (recoverSubSessionCacheMap_.find(parentId) == recoverSubSessionCacheMap_.end()) {
|
||||
recoverSubSessionCacheMap_[parentId] = std::vector{sceneSession};
|
||||
} else {
|
||||
recoverSubSessionCacheMap_[parentId].emplace_back(sceneSession);
|
||||
}
|
||||
}
|
||||
|
||||
auto persistentId = property->GetParentPersistentId();
|
||||
if (createSubSessionFuncMap_.find(persistentId) != createSubSessionFuncMap_.end()) {
|
||||
return;
|
||||
if (WindowHelper::IsDialogWindow(windowType)) {
|
||||
if (recoverDialogSessionCacheMap_.find(parentId) == recoverDialogSessionCacheMap_.end()) {
|
||||
recoverDialogSessionCacheMap_[parentId] = std::vector{sceneSession};
|
||||
} else {
|
||||
recoverDialogSessionCacheMap_[parentId].emplace_back(sceneSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SceneSessionManager::IsWindowSupportCacheForRecovering(
|
||||
sptr<SceneSession> sceneSession, const sptr<WindowSessionProperty>& property)
|
||||
{
|
||||
if (recoveringFinished_) {
|
||||
TLOGW(WmsLogTag::WMS_RECOVER, "recovering is finished");
|
||||
return false;
|
||||
}
|
||||
|
||||
TLOGI(WmsLogTag::WMS_RECOVER,
|
||||
"Cache subsession persistentId = %{public}" PRId32 ", parent persistentId = %{public}" PRId32,
|
||||
sceneSession->GetPersistentId(), persistentId);
|
||||
|
||||
if (recoverSubSessionCacheMap_.find(persistentId) == recoverSubSessionCacheMap_.end()) {
|
||||
recoverSubSessionCacheMap_[persistentId] = std::vector{ sceneSession };
|
||||
} else {
|
||||
recoverSubSessionCacheMap_[persistentId].emplace_back(sceneSession);
|
||||
if (sceneSession == nullptr || property == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_RECOVER, "sceneSession or property is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto windowType = property->GetWindowType();
|
||||
if (!WindowHelper::IsSubWindow(windowType) && !WindowHelper::IsDialogWindow(windowType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto parentId = property->GetParentPersistentId();
|
||||
if ((WindowHelper::IsSubWindow(windowType) &&
|
||||
createSubSessionFuncMap_.find(parentId) != createSubSessionFuncMap_.end()) ||
|
||||
(WindowHelper::IsDialogWindow(windowType) &&
|
||||
bindDialogTargetFuncMap_.find(parentId) != bindDialogTargetFuncMap_.end())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SceneSessionManager::RecoverCachedSubSession(int32_t persistentId)
|
||||
@ -2769,6 +2794,20 @@ void SceneSessionManager::RecoverCachedSubSession(int32_t persistentId)
|
||||
recoverSubSessionCacheMap_.erase(iter);
|
||||
}
|
||||
|
||||
void SceneSessionManager::RecoverCachedDialogSession(int32_t persistentId)
|
||||
{
|
||||
auto iter = recoverDialogSessionCacheMap_.find(persistentId);
|
||||
if (iter == recoverDialogSessionCacheMap_.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TLOGI(WmsLogTag::WMS_RECOVER, "Id=%{public}d", persistentId);
|
||||
for (auto& sceneSession : iter->second) {
|
||||
UpdateParentSessionForDialog(sceneSession, sceneSession->GetSessionProperty());
|
||||
}
|
||||
recoverDialogSessionCacheMap_.erase(iter);
|
||||
}
|
||||
|
||||
void SceneSessionManager::NotifySessionUnfocusedToClient(int32_t persistentId)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_RECOVER, "Id=%{public}d", persistentId);
|
||||
@ -2796,11 +2835,7 @@ WSError SceneSessionManager::RecoverAndReconnectSceneSession(const sptr<ISession
|
||||
}
|
||||
SessionInfo sessionInfo = RecoverSessionInfo(property);
|
||||
sptr<SceneSession> sceneSession = nullptr;
|
||||
if (SessionHelper::IsMainWindow(property->GetWindowType())) {
|
||||
sceneSession = RequestSceneSession(sessionInfo, nullptr);
|
||||
} else {
|
||||
sceneSession = RequestSceneSession(sessionInfo, property);
|
||||
}
|
||||
sceneSession = RequestSceneSession(sessionInfo, nullptr);
|
||||
if (sceneSession == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_RECOVER, "Request sceneSession failed");
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
@ -2860,6 +2895,18 @@ void SceneSessionManager::RegisterCreateSubSessionListener(int32_t persistentId,
|
||||
taskScheduler_->PostSyncTask(task, "RegisterCreateSubSessionListener");
|
||||
}
|
||||
|
||||
void SceneSessionManager::RegisterBindDialogTargetListener(int32_t persistentId,
|
||||
const NotifyBindDialogSessionFunc& func)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_DIALOG, "RegisterBindDialogTargetListener, id: %{public}d", persistentId);
|
||||
auto task = [this, persistentId, func]() {
|
||||
bindDialogTargetFuncMap_[persistentId] = func;
|
||||
RecoverCachedDialogSession(persistentId);
|
||||
return WMError::WM_OK;
|
||||
};
|
||||
taskScheduler_->PostTask(task, "RegisterBindDialogTargetListener");
|
||||
}
|
||||
|
||||
void SceneSessionManager::NotifyCreateSpecificSession(sptr<SceneSession> newSession,
|
||||
sptr<WindowSessionProperty> property, const WindowType& type)
|
||||
{
|
||||
@ -3000,6 +3047,21 @@ void SceneSessionManager::UnregisterCreateSubSessionListener(int32_t persistentI
|
||||
taskScheduler_->PostSyncTask(task);
|
||||
}
|
||||
|
||||
void SceneSessionManager::UnregisterBindDialogTargetListener(int32_t persistentId)
|
||||
{
|
||||
TLOGI(WmsLogTag::WMS_DIALOG, "UnregisterBindDialogTargetListener, id: %{public}d", persistentId);
|
||||
auto task = [this, persistentId]() {
|
||||
auto iter = bindDialogTargetFuncMap_.find(persistentId);
|
||||
if (iter != bindDialogTargetFuncMap_.end()) {
|
||||
bindDialogTargetFuncMap_.erase(persistentId);
|
||||
} else {
|
||||
TLOGW(WmsLogTag::WMS_DIALOG, "Can't find BindDialogTargetListener, id: %{public}d", persistentId);
|
||||
}
|
||||
return WMError::WM_OK;
|
||||
};
|
||||
taskScheduler_->PostSyncTask(task);
|
||||
}
|
||||
|
||||
void SceneSessionManager::SetStatusBarEnabledChangeListener(const ProcessStatusBarEnabledChangeFunc& func)
|
||||
{
|
||||
WLOGFD("SetStatusBarEnabledChangeListener");
|
||||
|
@ -352,11 +352,11 @@ HWTEST_F(SceneSessionManagerSupplementTest, RecoverAndConnectSpecificSession, Fu
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CacheSubSessionForRecovering
|
||||
* @tc.desc: CacheSubSessionForRecovering
|
||||
* @tc.name: CacheSpecificSessionForRecovering
|
||||
* @tc.desc: CacheSpecificSessionForRecovering
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerSupplementTest, CacheSubSessionForRecovering, Function | SmallTest | Level3)
|
||||
HWTEST_F(SceneSessionManagerSupplementTest, CacheSpecificSessionForRecovering, Function | SmallTest | Level3)
|
||||
{
|
||||
sptr<SceneSession> sceneSession;
|
||||
SessionInfo info;
|
||||
@ -364,28 +364,28 @@ HWTEST_F(SceneSessionManagerSupplementTest, CacheSubSessionForRecovering, Functi
|
||||
info.abilityName_ = "test2";
|
||||
sptr<WindowSessionProperty> property;
|
||||
ssm_->recoveringFinished_ = false;
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
sceneSession = new (std::nothrow) SceneSession(info, nullptr);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
property = new WindowSessionProperty();
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
property->SetWindowType(WindowType::APP_SUB_WINDOW_END);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
property->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||
property->SetParentPersistentId(1);
|
||||
NotifyCreateSubSessionFunc func;
|
||||
ssm_->createSubSessionFuncMap_.insert({1, func});
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
ssm_->createSubSessionFuncMap_.clear();
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 1);
|
||||
ssm_->RecoverCachedSubSession(1);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_.size(), 0);
|
||||
@ -670,6 +670,23 @@ HWTEST_F(SceneSessionManagerSupplementTest, IsSessionVisible, Function | SmallTe
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RegisterBindDialogTargetListener
|
||||
* @tc.desc: RegisterBindDialogTargetListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerSupplementTest, RegisterBindDialogTargetListener, Function | SmallTest | Level3)
|
||||
{
|
||||
int ret = 0;
|
||||
NotifyBindDialogSessionFunc func1;
|
||||
ssm_->RegisterBindDialogTargetListener(1, func1);
|
||||
ssm_->UnregisterBindDialogTargetListener(1);
|
||||
ssm_->bindDialogTargetFuncMap_.insert({ 1, func1 });
|
||||
ssm_->bindDialogTargetFuncMap_.erase(1);
|
||||
ssm_->bindDialogTargetFuncMap_.insert({ 1, func1 });
|
||||
ssm_->bindDialogTargetFuncMap_.clear();
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -2121,11 +2121,11 @@ HWTEST_F(SceneSessionManagerTest2, RecoverAndConnectSpecificSession02, Function
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CacheSubSessionForRecovering
|
||||
* @tc.desc: CacheSubSessionForRecovering
|
||||
* @tc.name: CacheSpecificSessionForRecovering
|
||||
* @tc.desc: CacheSpecificSessionForRecovering
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SceneSessionManagerTest2, CacheSubSessionForRecovering, Function | SmallTest | Level3)
|
||||
HWTEST_F(SceneSessionManagerTest2, CacheSpecificSessionForRecovering, Function | SmallTest | Level3)
|
||||
{
|
||||
sptr<WindowSessionProperty> property;
|
||||
ASSERT_NE(ssm_, nullptr);
|
||||
@ -2135,22 +2135,22 @@ HWTEST_F(SceneSessionManagerTest2, CacheSubSessionForRecovering, Function | Smal
|
||||
info.bundleName_ = "test2";
|
||||
sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(info, property);
|
||||
ASSERT_NE(sceneSession, nullptr);
|
||||
ssm_->CacheSubSessionForRecovering(nullptr, property);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(nullptr, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
|
||||
property = new (std::nothrow) WindowSessionProperty();
|
||||
ASSERT_NE(property, nullptr);
|
||||
ssm_->CacheSubSessionForRecovering(nullptr, property);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(nullptr, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
property->SetWindowType(WindowType::APP_WINDOW_BASE);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
property->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
int32_t parentPersistentId = 1;
|
||||
property->SetParentPersistentId(parentPersistentId);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_[parentPersistentId].size(), 1);
|
||||
ssm_->CacheSubSessionForRecovering(sceneSession, property);
|
||||
ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_[parentPersistentId].size(), 2);
|
||||
ssm_->RecoverCachedSubSession(parentPersistentId);
|
||||
ASSERT_EQ(ssm_->recoverSubSessionCacheMap_[parentPersistentId].size(), 0);
|
||||
@ -2188,6 +2188,33 @@ HWTEST_F(SceneSessionManagerTest2, NotifyCreateToastSession, Function | SmallTes
|
||||
sptr<SceneSession> session = new (std::nothrow) SceneSession(Info, nullptr);
|
||||
ssm_->NotifyCreateToastSession(persistentId, session);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: RecoverCachedDialogSession
|
||||
* @tc.desc: RecoverCachedDialogSession
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
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<SceneSession> sceneSession = ssm_->CreateSceneSession(info, property);
|
||||
ASSERT_NE(sceneSession, nullptr);
|
||||
|
||||
int32_t parentPersistentId = 1;
|
||||
ssm_->RecoverCachedDialogSession(parentPersistentId);
|
||||
ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 0);
|
||||
ssm_->recoverDialogSessionCacheMap_[parentPersistentId].emplace_back(sceneSession);
|
||||
ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 1);
|
||||
ssm_->recoverDialogSessionCacheMap_[parentPersistentId].emplace_back(sceneSession);
|
||||
ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 2);
|
||||
ssm_->RecoverCachedDialogSession(parentPersistentId);
|
||||
ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 0);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -441,12 +441,12 @@ WMError WindowSceneSessionImpl::CreateSystemWindow(WindowType type)
|
||||
|
||||
WMError WindowSceneSessionImpl::RecoverAndConnectSpecificSession()
|
||||
{
|
||||
auto persistentId = property_->GetPersistentId();
|
||||
TLOGI(WmsLogTag::WMS_RECOVER, "windowName = %{public}s, windowMode = %{public}u, "
|
||||
"windowType = %{public}u, persistentId = %{public}d, windowState = %{public}d", GetWindowName().c_str(),
|
||||
property_->GetWindowMode(), property_->GetWindowType(), persistentId, state_);
|
||||
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());
|
||||
|
||||
property_->SetWindowState(state_);
|
||||
property_->SetWindowState(requestState_);
|
||||
|
||||
sptr<ISessionStage> iSessionStage(this);
|
||||
sptr<IWindowEventChannel> eventChannel = sptr<WindowEventChannel>::MakeSptr(iSessionStage);
|
||||
@ -472,6 +472,7 @@ WMError WindowSceneSessionImpl::RecoverAndConnectSpecificSession()
|
||||
SingletonContainer::Get<WindowAdapter>().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;
|
||||
@ -489,6 +490,10 @@ 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(),
|
||||
property_->GetWindowMode(), property_->GetWindowType(), GetPersistentId(), state_, requestState_);
|
||||
|
||||
if (isFocused_) {
|
||||
UpdateFocus(false);
|
||||
}
|
||||
@ -507,11 +512,6 @@ WMError WindowSceneSessionImpl::RecoverAndReconnectSceneSession()
|
||||
TLOGE(WmsLogTag::WMS_RECOVER, "want is nullptr!");
|
||||
}
|
||||
property_->SetWindowState(state_);
|
||||
TLOGI(WmsLogTag::WMS_RECOVER,
|
||||
"bundle=%{public}s, module=%{public}s, ability=%{public}s, appIndex=%{public}d, type=%{public}u, "
|
||||
"Id=%{public}d, windowState=%{public}d",
|
||||
info.bundleName_.c_str(), info.moduleName_.c_str(), info.abilityName_.c_str(), info.appIndex_, info.windowType_,
|
||||
GetPersistentId(), state_);
|
||||
sptr<ISessionStage> iSessionStage(this);
|
||||
sptr<IWindowEventChannel> iWindowEventChannel = sptr<WindowEventChannel>::MakeSptr(iSessionStage);
|
||||
sptr<IRemoteObject> token = context_ ? context_->GetToken() : nullptr;
|
||||
@ -1514,9 +1514,9 @@ WMError WindowSceneSessionImpl::MoveWindowToGlobal(int32_t x, int32_t y)
|
||||
requestRect.width_, requestRect.height_, windowRect.posX_, windowRect.posY_,
|
||||
windowRect.width_, windowRect.height_, newRect.posX_, newRect.posY_,
|
||||
newRect.width_, newRect.height_);
|
||||
|
||||
|
||||
property_->SetRequestRect(newRect);
|
||||
|
||||
|
||||
WSRect wsRect = { newRect.posX_, newRect.posY_, newRect.width_, newRect.height_ };
|
||||
auto hostSession = GetHostSession();
|
||||
CHECK_HOST_SESSION_RETURN_ERROR_IF_NULL(hostSession, WMError::WM_ERROR_INVALID_WINDOW);
|
||||
|
Loading…
Reference in New Issue
Block a user