diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 1778c8b74f3206a47302cc252a4d1be9d3949952..d21650fad9f1f772cceafba40cc485027ac9a8a3 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -2947,6 +2947,10 @@ WMError WindowSceneSessionImpl::SetLayoutFullScreen(bool status) TLOGE(WmsLogTag::WMS_IMMS, "fullscreen window mode not supported"); return WMError::WM_ERROR_INVALID_WINDOW; } + if (property_->IsFullScreenDisabled()) { + TLOGE(WmsLogTag::WMS_IMMS, "compatible mode disable fullscreen"); + return WMError::WM_OK; + } CHECK_HOST_SESSION_RETURN_ERROR_IF_NULL(hostSession, WMError::WM_ERROR_NULLPTR); auto event = SessionEvent::EVENT_MAXIMIZE; if (isFullScreenWaterfallMode_.load()) { @@ -3250,6 +3254,10 @@ WMError WindowSceneSessionImpl::SetFullScreen(bool status) TLOGE(WmsLogTag::WMS_IMMS, "fullscreen window not supported"); return WMError::WM_ERROR_INVALID_WINDOW; } + if (property_->IsFullScreenDisabled()) { + TLOGE(WmsLogTag::WMS_IMMS, "compatible mode disable fullscreen"); + return WMError::WM_OK; + } auto hostSession = GetHostSession(); CHECK_HOST_SESSION_RETURN_ERROR_IF_NULL(hostSession, WMError::WM_ERROR_NULLPTR); hostSession->OnSessionEvent(SessionEvent::EVENT_MAXIMIZE); diff --git a/wm/test/unittest/window_scene_session_impl_test.cpp b/wm/test/unittest/window_scene_session_impl_test.cpp index 9d6dfff5b2ad6eda6ec1b0d6a1b9058a709b409f..ee10e6b4331a17c248f2c89912e01c80152193e1 100644 --- a/wm/test/unittest/window_scene_session_impl_test.cpp +++ b/wm/test/unittest/window_scene_session_impl_test.cpp @@ -2433,6 +2433,11 @@ HWTEST_F(WindowSceneSessionImplTest, SetLayoutFullScreen01, TestSize.Level0) ASSERT_EQ(false, window->IsLayoutFullScreen()); ASSERT_EQ(WMError::WM_OK, window->SetLayoutFullScreen(true)); ASSERT_EQ(true, window->IsLayoutFullScreen()); + sptr compatibleModeProperty = sptr::MakeSptr(); + ASSERT_NE(compatibleModeProperty, nullptr); + compatibleModeProperty->SetDisableFullScreen(true); + window->property_->SetCompatibleModeProperty(compatibleModeProperty); + ASSERT_EQ(WMError::WM_OK, window->SetLayoutFullScreen(true)); window->property_->SetWindowModeSupportType(0); ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, window->SetLayoutFullScreen(false)); } @@ -2564,6 +2569,11 @@ HWTEST_F(WindowSceneSessionImplTest, SetFullScreen, TestSize.Level0) ASSERT_EQ(false, window->IsLayoutFullScreen()); ASSERT_EQ(WMError::WM_OK, window->SetFullScreen(true)); ASSERT_EQ(true, window->IsLayoutFullScreen()); + sptr compatibleModeProperty = sptr::MakeSptr(); + ASSERT_NE(compatibleModeProperty, nullptr); + compatibleModeProperty->SetDisableFullScreen(true); + window->property_->SetCompatibleModeProperty(compatibleModeProperty); + ASSERT_EQ(WMError::WM_OK, window->SetFullScreen(true)); } /**