diff --git a/window_scene/common/include/window_session_property.h b/window_scene/common/include/window_session_property.h index 14ecb65fc9c250013e2e32be055010d7eeb7d172..2797355fcc2aff32ff7ba36dfceceff118e790b0 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 8e3a08116276ae220d7fa76e0052cc5317678159..58ba0f33abf21678140bc645cfad637ea7c340c5 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); 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 9794d60a5e6ab3a5896dde8b8fd73feb1a86f5a5..273217029a256bc49be4b2aada708184a99515a0 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"); diff --git a/window_scene/test/unittest/scene_session_manager_test9.cpp b/window_scene/test/unittest/scene_session_manager_test9.cpp index d2cc830d8f33bf41af31f3efa405059b3357e550..1c3235a44e2307076177a25e44176ab9d2246360 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_ = false; + 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(ret, WSError::WS_OK); +} + /** * @tc.name: Test RequestSessionFocus_01 * @tc.desc: Test RequestSessionFocus invalid persistentId