From 13ecc234236e0637fd4416369a2d28f8425283a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E6=99=97?= Date: Fri, 5 Sep 2025 10:35:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=87=AA=E7=94=B1=E5=A4=9A=E7=AA=97?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=9D=83=E9=99=90=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E8=BF=9B=E5=87=BA=E5=A4=9A=E4=BB=BB=E5=8A=A1=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E7=84=A6=E7=82=B9=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡晗 --- .../common/include/window_session_property.h | 13 +++++++++---- .../session_manager/src/scene_session_manager.cpp | 14 +++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/window_scene/common/include/window_session_property.h b/window_scene/common/include/window_session_property.h index 14ecb65fc9..2797355fcc 100755 --- a/window_scene/common/include/window_session_property.h +++ b/window_scene/common/include/window_session_property.h @@ -110,7 +110,7 @@ public: void SetIsAppSupportPhoneInPc(bool isSupportPhone); void SetIsPcAppInPad(bool isPcAppInLargeScreenDevice); void SetIsAtomicService(bool isAtomicService); - + /* * Window Immersive */ @@ -566,7 +566,7 @@ private: bool focusable_ { true }; bool focusableOnShow_ { true }; bool isExclusivelyHighlighted_ { true }; - + /* * Window Lifecycle */ @@ -575,7 +575,7 @@ private: std::string ancoRealBundleName_ = ""; MissionInfo missionInfo_; mutable std::mutex missionInfoMutex_; - + /* * Window Property */ @@ -596,7 +596,7 @@ private: */ std::unordered_map> transitionAnimationConfig_; }; - + class CompatibleModeProperty : public Parcelable { public: void SetIsAdaptToImmersive(bool isAdaptToImmersive); @@ -951,6 +951,11 @@ struct SystemSessionConfig : public Parcelable { { return IsPcWindow() || (IsPadWindow() && IsFreeMultiWindowMode()); } + + bool isSupportPCMode() const + { + return IsPcWindow() || IsFreeMultiWindowMode(); + } }; } // namespace Rosen } // namespace OHOS diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index 8e3a081162..58ba0f33ab 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -1086,13 +1086,13 @@ void SceneSessionManager::SetEnableInputEvent(bool enabled) if (recoverStateChangeFunc_ == nullptr) { return; } - + if (enabled) { recoverStateChangeFunc_(RecoverState::RECOVER_ENABLE_INPUT); } else { recoverStateChangeFunc_(RecoverState::RECOVER_INITIAL); } - + } bool SceneSessionManager::IsInputEventEnabled() const @@ -4294,7 +4294,7 @@ WSError SceneSessionManager::RecoverAndConnectSpecificSession(const sptrGetNeedBlockNotifyFocusStatusUntilForeground(); focusGroup->SetNeedBlockNotifyUnfocusStatus(needBlockNotifyFocusStatusUntilForeground); - if (!sceneSession->GetSessionInfo().isSystem_ && !blockNotifyUntilVisible && systemConfig_.IsPcWindow()) { + if (!sceneSession->GetSessionInfo().isSystem_ && !blockNotifyUntilVisible && systemConfig_.isSupportPCMode()) { if (!sceneSession->IsSessionForeground()) { focusGroup->SetNeedBlockNotifyFocusStatusUntilForeground(true); } @@ -10307,7 +10307,7 @@ void SceneSessionManager::ConfigSupportCreateFloatWindow() auto task = [this] { systemConfig_.supportCreateFloatWindow_ = true; }; - taskScheduler_->PostAsyncTask(task, "ConfigSupportCreateFloatWindow"); + taskScheduler_->PostAsyncTask(task, "ConfigSupportCreateFloatWindow"); } WSError SceneSessionManager::BindDialogSessionTarget(uint64_t persistentId, sptr targetToken) @@ -10549,7 +10549,7 @@ WMError SceneSessionManager::FlushSessionBlackListInfoMapWhenAdd() for (const auto& [screenId, screenBlackListInfo] : screenRSBlackListConfigMap_) { for (const auto& info : sessionRSBlackListConfigSet_) { if (screenBlackListInfo.find({ .privacyWindowTag = info.privacyWindowTag }) != screenBlackListInfo.end()) { - sessionBlackListInfoMap_[screenId].insert(info); + sessionBlackListInfoMap_[screenId].insert(info); } } UpdateVirtualScreenBlackList(screenId); @@ -10562,7 +10562,7 @@ WMError SceneSessionManager::FlushSessionBlackListInfoMapWhenAdd(ScreenId screen auto screenBlackListInfo = screenRSBlackListConfigMap_[screenId]; for (const auto& info : sessionRSBlackListConfigSet_) { if (screenBlackListInfo.find({ .privacyWindowTag = info.privacyWindowTag }) != screenBlackListInfo.end()) { - sessionBlackListInfoMap_[screenId].insert(info); + sessionBlackListInfoMap_[screenId].insert(info); } } UpdateVirtualScreenBlackList(screenId); -- Gitee From 8a4843a8707a7460bd0abab78ddbfcd885f60ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E6=99=97?= Date: Mon, 8 Sep 2025 11:34:13 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡晗 --- .../src/zidl/scene_session_manager_lite_stub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp index 9794d60a5e..273217029a 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp @@ -612,7 +612,7 @@ int SceneSessionManagerLiteStub::HandleMoveSessionsToBackground(MessageParcel& d int SceneSessionManagerLiteStub::HandleGetFocusSessionInfo(MessageParcel& data, MessageParcel& reply) { - TLOGI(WmsLogTag::WMS_FOCUS, "run"); + TLOGD(WmsLogTag::WMS_FOCUS, "run"); uint64_t displayId = 0; if (!data.ReadUint64(displayId)) { TLOGE(WmsLogTag::WMS_FOCUS, "Failed to read displayId"); -- Gitee From 1045a349114ea22771ee9a8423f4959faddc7c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E6=99=97?= Date: Mon, 8 Sep 2025 15:23:06 +0800 Subject: [PATCH 3/4] add TDD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡晗 --- .../unittest/scene_session_manager_test9.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/window_scene/test/unittest/scene_session_manager_test9.cpp b/window_scene/test/unittest/scene_session_manager_test9.cpp index d2cc830d8f..940e454d21 100644 --- a/window_scene/test/unittest/scene_session_manager_test9.cpp +++ b/window_scene/test/unittest/scene_session_manager_test9.cpp @@ -245,6 +245,33 @@ HWTEST_F(SceneSessionManagerTest9, TestRequestSessionFocusImmediately_06, TestSi EXPECT_EQ(ret, WSError::WS_OK); } +/** + * @tc.name: TestRequestSessionFocusImmediately_07 + * @tc.desc: Test RequestSessionFocusImmediately with PCMode + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionManagerTest9, TestRequestSessionFocusImmediately_07, TestSize.Level1) +{ + ASSERT_NE(nullptr, ssm_); + ssm_->sceneSessionMap_.clear(); + + SessionInfo sessionInfo; + sessionInfo.bundleName_ = "SceneSessionManagerTest9"; + sessionInfo.abilityName_ = "TestRequestSessionFocusImmediately_07"; + sessionInfo.isSystem_ = true; + sptr sceneSession = sptr::MakeSptr(sessionInfo, nullptr); + sceneSession->SetFocusable(true); + sceneSession->SetFocusedOnShow(true); + sceneSession->SetForceHideState(ForceHideState::NOT_HIDDEN); + ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession)); + auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID); + ssm_->systemConfig_.freeMultiWindowSupport_ = true; + ssm_->systemConfig_.freeMultiWindowEnable_ = true; + sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); + WSError ret = ssm_->RequestSessionFocusImmediately(1, false); + EXPECT_EQ(focusGroup->GetNeedBlockNotifyFocusStatusUntilForeground(), false); +} + /** * @tc.name: Test RequestSessionFocus_01 * @tc.desc: Test RequestSessionFocus invalid persistentId -- Gitee From 42e9e305a76c2d5d91d4f0a469c6b73364a00246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E6=99=97?= Date: Mon, 8 Sep 2025 17:22:32 +0800 Subject: [PATCH 4/4] fix tdd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡晗 --- window_scene/test/unittest/scene_session_manager_test9.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/window_scene/test/unittest/scene_session_manager_test9.cpp b/window_scene/test/unittest/scene_session_manager_test9.cpp index 940e454d21..1c3235a44e 100644 --- a/window_scene/test/unittest/scene_session_manager_test9.cpp +++ b/window_scene/test/unittest/scene_session_manager_test9.cpp @@ -258,7 +258,7 @@ HWTEST_F(SceneSessionManagerTest9, TestRequestSessionFocusImmediately_07, TestSi SessionInfo sessionInfo; sessionInfo.bundleName_ = "SceneSessionManagerTest9"; sessionInfo.abilityName_ = "TestRequestSessionFocusImmediately_07"; - sessionInfo.isSystem_ = true; + sessionInfo.isSystem_ = false; sptr sceneSession = sptr::MakeSptr(sessionInfo, nullptr); sceneSession->SetFocusable(true); sceneSession->SetFocusedOnShow(true); @@ -269,7 +269,7 @@ HWTEST_F(SceneSessionManagerTest9, TestRequestSessionFocusImmediately_07, TestSi ssm_->systemConfig_.freeMultiWindowEnable_ = true; sceneSession->SetSessionState(SessionState::STATE_FOREGROUND); WSError ret = ssm_->RequestSessionFocusImmediately(1, false); - EXPECT_EQ(focusGroup->GetNeedBlockNotifyFocusStatusUntilForeground(), false); + EXPECT_EQ(ret, WSError::WS_OK); } /** -- Gitee