From fcb8b5388c05d7ea2ccfdff4b74a0bbb2593204a Mon Sep 17 00:00:00 2001 From: zyh990312 Date: Fri, 12 Sep 2025 18:02:12 +0800 Subject: [PATCH 1/3] QXS pcmode setLayoutFullScreen Signed-off-by: zyh990312 --- .../common/include/window_session_property.h | 3 ++ .../common/src/window_session_property.cpp | 15 +++++- .../js_scene_session.cpp | 36 +++++++++++++ .../scene_session_manager/js_scene_session.h | 2 + window_scene/session/host/include/session.h | 1 + window_scene/session/host/src/session.cpp | 9 ++++ .../session/host/src/zidl/session_proxy.cpp | 1 + .../session/host/src/zidl/session_stub.cpp | 1 + window_scene/test/unittest/session_test3.cpp | 13 +++++ .../unittest/window_session_property_test.cpp | 14 +++++ wm/include/window_scene_session_impl.h | 1 + wm/src/window_scene_session_impl.cpp | 39 ++++++++++++++ .../window_scene_session_impl_test3.cpp | 51 +++++++++++++++++++ .../window_scene_session_impl_test5.cpp | 35 +++++++++++++ 14 files changed, 220 insertions(+), 1 deletion(-) diff --git a/window_scene/common/include/window_session_property.h b/window_scene/common/include/window_session_property.h index b94b198143..e15a92c292 100755 --- a/window_scene/common/include/window_session_property.h +++ b/window_scene/common/include/window_session_property.h @@ -265,6 +265,8 @@ public: bool GetPcAppInpadSpecificSystemBarInvisible() const; void SetPcAppInpadOrientationLandscape(bool isPcAppInpadOrientationLandscape); bool GetPcAppInpadOrientationLandscape() const; + void SetMobileAppInPadLayoutFullScreen(bool isMobileAppInPadLayoutFullScreen); + bool GetMobileAppInPadLayoutFullScreen() const; /* * Window Lifecycle @@ -602,6 +604,7 @@ private: bool isPcAppInpadCompatibleMode_ = false; bool isPcAppInpadSpecificSystemBarInvisible_ = false; bool isPcAppInpadOrientationLandscape_ = false; + bool isMobileAppInPadLayoutFullScreen_ = false; sptr compatibleModeProperty_ = nullptr; diff --git a/window_scene/common/src/window_session_property.cpp b/window_scene/common/src/window_session_property.cpp index 8f3dbcef49..341f490d87 100755 --- a/window_scene/common/src/window_session_property.cpp +++ b/window_scene/common/src/window_session_property.cpp @@ -1370,7 +1370,8 @@ bool WindowSessionProperty::Marshalling(Parcel& parcel) const parcel.WriteBool(isPcAppInpadOrientationLandscape_) && parcel.WriteBool(isPcAppInpadCompatibleMode_) && parcel.WriteString(ancoRealBundleName_) && - parcel.WriteBool(isShowDecorInFreeMultiWindow_); + parcel.WriteBool(isShowDecorInFreeMultiWindow_) && + parcel.WriteBool(isMobileAppInPadLayoutFullScreen_); } WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel) @@ -1488,6 +1489,7 @@ WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel) property->SetPcAppInpadCompatibleMode(parcel.ReadBool()); property->SetAncoRealBundleName(parcel.ReadString()); property->SetIsShowDecorInFreeMultiWindow(parcel.ReadBool()); + property->SetMobileAppInPadLayoutFullScreen(parcel.ReadBool()); return property; } @@ -1601,6 +1603,7 @@ void WindowSessionProperty::CopyFrom(const sptr& property missionInfo_ = property->missionInfo_; } isShowDecorInFreeMultiWindow_ = property->isShowDecorInFreeMultiWindow_; + isMobileAppInPadLayoutFullScreen_ = property->isMobileAppInPadLayoutFullScreen_; } bool WindowSessionProperty::Write(Parcel& parcel, WSPropertyChangeAction action) @@ -2339,6 +2342,11 @@ void WindowSessionProperty::SetPcAppInpadOrientationLandscape(bool isPcAppInpadO isPcAppInpadOrientationLandscape_ = isPcAppInpadOrientationLandscape; } +void WindowSessionProperty::SetMobileAppInPadLayoutFullScreen(bool isMobileAppInPadLayoutFullScreen) +{ + isMobileAppInPadLayoutFullScreen_ = isMobileAppInPadLayoutFullScreen; +} + bool WindowSessionProperty::GetPcAppInpadCompatibleMode() const { return isPcAppInpadCompatibleMode_; @@ -2354,6 +2362,11 @@ bool WindowSessionProperty::GetPcAppInpadOrientationLandscape() const return isPcAppInpadOrientationLandscape_; } +bool WindowSessionProperty::GetMobileAppInPadLayoutFullScreen() const +{ + return isMobileAppInPadLayoutFullScreen_; +} + void WindowSessionProperty::SetAncoRealBundleName(const std::string& ancoRealBundleName) { ancoRealBundleName_ = ancoRealBundleName; diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp index a35cb8653a..a551a108e4 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp @@ -567,6 +567,8 @@ void JsSceneSession::BindNativeMethod(napi_env env, napi_value objValue, const c moduleName, JsSceneSession::SetPcAppInpadOrientationLandscape); BindNativeFunction(env, objValue, "setIsPcAppInpadCompatibleMode", moduleName, JsSceneSession::SetPcAppInpadCompatibleMode); + BindNativeFunction(env, objValue, "setMobileAppInPadLayoutFullScreen", + moduleName, JsSceneSession::SetMobileAppInPadLayoutFullScreen); } void JsSceneSession::BindNativeMethodForKeyboard(napi_env env, napi_value objValue, const char* moduleName) @@ -2854,6 +2856,13 @@ napi_value JsSceneSession::SetPcAppInpadCompatibleMode(napi_env env, napi_callba return (me != nullptr) ? me->OnSetPcAppInpadCompatibleMode(env, info) : nullptr; } +napi_value JsSceneSession::SetMobileAppInPadLayoutFullScreen(napi_env env, napi_callback_info info) +{ + TLOGD(WmsLogTag::WMS_PC, "[NAPI]"); + JsSceneSession* me = CheckParamsAndGetThis(env, info); + return (me != nullptr) ? me->OnSetMobileAppInPadLayoutFullScreen(env, info) : nullptr; +} + napi_value JsSceneSession::SetPcAppInpadSpecificSystemBarInvisible(napi_env env, napi_callback_info info) { TLOGD(WmsLogTag::WMS_PC, "[NAPI]"); @@ -6547,6 +6556,33 @@ napi_value JsSceneSession::OnSetPcAppInpadCompatibleMode(napi_env env, napi_call return NapiGetUndefined(env); } +napi_value JsSceneSession::OnSetMobileAppInPadLayoutFullScreen(napi_env env, napi_callback_info info) +{ + size_t argc = ARGC_FOUR; + napi_value argv[ARGC_FOUR] = {nullptr}; + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + if (argc < ARGC_ONE) { + TLOGE(WmsLogTag::WMS_SCB, "Argc is invalid: %{public}zu", argc); + napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), + "Input parameter is missing or invalid")); + return NapiGetUndefined(env); + } + bool isMobileAppInPadLayoutFullScreen = false; + if (!ConvertFromJsValue(env, argv[0], isMobileAppInPadLayoutFullScreen)) { + TLOGE(WmsLogTag::WMS_SCB, "Failed to convert parameter to enable"); + napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), + "Input parameter is missing or invalid")); + return NapiGetUndefined(env); + } + auto session = weakSession_.promote(); + if (session == nullptr) { + TLOGE(WmsLogTag::WMS_SCB, "session is nullptr, id:%{public}d", persistentId_); + return NapiGetUndefined(env); + } + session->SetMobileAppInPadLayoutFullScreen(isMobileAppInPadLayoutFullScreen); + return NapiGetUndefined(env); +} + napi_value JsSceneSession::OnSetPcAppInpadSpecificSystemBarInvisible(napi_env env, napi_callback_info info) { size_t argc = ARGC_FOUR; diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.h b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.h index 8eea4aa1b2..5a0752b3b0 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.h +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.h @@ -259,6 +259,7 @@ private: static napi_value SetPcAppInpadCompatibleMode(napi_env env, napi_callback_info info); static napi_value SetPcAppInpadSpecificSystemBarInvisible(napi_env env, napi_callback_info info); static napi_value SetPcAppInpadOrientationLandscape(napi_env env, napi_callback_info info); + static napi_value SetMobileAppInPadLayoutFullScreen(napi_env env, napi_callback_info info); /* * PC Window */ @@ -350,6 +351,7 @@ private: napi_value OnSetPcAppInpadCompatibleMode(napi_env env, napi_callback_info info); napi_value OnSetPcAppInpadSpecificSystemBarInvisible(napi_env env, napi_callback_info info); napi_value OnSetPcAppInpadOrientationLandscape(napi_env env, napi_callback_info info); + napi_value OnSetMobileAppInPadLayoutFullScreen(napi_env env, napi_callback_info info); /* * PC Window diff --git a/window_scene/session/host/include/session.h b/window_scene/session/host/include/session.h index f6006edb8e..e3a2403ad8 100644 --- a/window_scene/session/host/include/session.h +++ b/window_scene/session/host/include/session.h @@ -430,6 +430,7 @@ public: WSError SetPcAppInpadCompatibleMode(bool enabled); WSError SetPcAppInpadSpecificSystemBarInvisible(bool isPcAppInpadSpecificSystemBarInvisible); WSError SetPcAppInpadOrientationLandscape(bool isPcAppInpadOrientationLandscape); + WSError SetMobileAppInPadLayoutFullScreen(bool isMobileAppInPadLayoutFullScreen); bool NeedNotify() const; void SetNeedNotify(bool needNotify); WSError SetTouchable(bool touchable); diff --git a/window_scene/session/host/src/session.cpp b/window_scene/session/host/src/session.cpp index b80ead6e7d..e3b7349169 100644 --- a/window_scene/session/host/src/session.cpp +++ b/window_scene/session/host/src/session.cpp @@ -1384,6 +1384,7 @@ void Session::InitSessionPropertyWhenConnect(const sptr& property->SetPcAppInpadCompatibleMode(GetSessionProperty()->GetPcAppInpadCompatibleMode()); property->SetPcAppInpadSpecificSystemBarInvisible(GetSessionProperty()->GetPcAppInpadSpecificSystemBarInvisible()); property->SetPcAppInpadOrientationLandscape(GetSessionProperty()->GetPcAppInpadOrientationLandscape()); + property->SetMobileAppInPadLayoutFullScreen(GetSessionProperty()->GetMobileAppInPadLayoutFullScreen()) const bool isPcMode = system::GetBoolParameter("persist.sceneboard.ispcmode", false); const bool isShow = !(isScreenLockedCallback_ && isScreenLockedCallback_() && systemConfig_.IsFreeMultiWindowMode() && !isPcMode); @@ -3435,6 +3436,14 @@ WSError Session::SetPcAppInpadOrientationLandscape(bool isPcAppInpadOrientationL return WSError::WS_OK; } +WSError Session::SetMobileAppInPadLayoutFullScreen(bool isMobileAppInPadLayoutFullScreen) +{ + TLOGD(WmsLogTag::WMS_COMPAT, "isMobileAppInPadLayoutFullScreen: %{public}d", + isMobileAppInPadLayoutFullScreen); + GetSessionProperty()->SetMobileAppInPadLayoutFullScreen(isMobileAppInPadLayoutFullScreen); + return WSError::WS_OK; +} + WSError Session::PcAppInPadNormalClose() { TLOGD(WmsLogTag::WMS_COMPAT, "windowId:%{public}d", GetPersistentId()); diff --git a/window_scene/session/host/src/zidl/session_proxy.cpp b/window_scene/session/host/src/zidl/session_proxy.cpp index 8319e04bfb..8efd3ee828 100644 --- a/window_scene/session/host/src/zidl/session_proxy.cpp +++ b/window_scene/session/host/src/zidl/session_proxy.cpp @@ -335,6 +335,7 @@ WSError SessionProxy::Connect(const sptr& sessionStage, const spt property->SetPcAppInpadCompatibleMode(reply.ReadBool()); property->SetPcAppInpadSpecificSystemBarInvisible(reply.ReadBool()); property->SetPcAppInpadOrientationLandscape(reply.ReadBool()); + property->SetMobileAppInPadLayoutFullScreen(reply.ReadBool()); property->SetCompatibleModeProperty(reply.ReadParcelable()); property->SetUseControlState(reply.ReadBool()); property->SetAncoRealBundleName(reply.ReadString()); diff --git a/window_scene/session/host/src/zidl/session_stub.cpp b/window_scene/session/host/src/zidl/session_stub.cpp index 5d5b44a87b..b5b3389397 100644 --- a/window_scene/session/host/src/zidl/session_stub.cpp +++ b/window_scene/session/host/src/zidl/session_stub.cpp @@ -507,6 +507,7 @@ int SessionStub::HandleConnect(MessageParcel& data, MessageParcel& reply) reply.WriteBool(property->GetPcAppInpadCompatibleMode()); reply.WriteBool(property->GetPcAppInpadSpecificSystemBarInvisible()); reply.WriteBool(property->GetPcAppInpadOrientationLandscape()); + reply.WriteBool(property->GetMobileAppInPadLayoutFullScreen()); reply.WriteParcelable(property->GetCompatibleModeProperty()); reply.WriteBool(property->GetUseControlState()); reply.WriteString(property->GetAncoRealBundleName()); diff --git a/window_scene/test/unittest/session_test3.cpp b/window_scene/test/unittest/session_test3.cpp index aa0ec8283b..933f6a96db 100644 --- a/window_scene/test/unittest/session_test3.cpp +++ b/window_scene/test/unittest/session_test3.cpp @@ -976,6 +976,19 @@ HWTEST_F(WindowSessionTest3, SetPcAppInpadOrientationLandscape, TestSize.Level1) EXPECT_EQ(result, WSError::WS_OK); } +/** + * @tc.name: SetMobileAppInPadLayoutFullScreen + * @tc.desc: SetMobileAppInPadLayoutFullScreen Test + * @tc.type: FUNC + */ +HWTEST_F(WindowSessionTest3, SetMobileAppInPadLayoutFullScreen, TestSize.Level1) +{ + ASSERT_NE(session_, nullptr); + bool isMobileAppInPadLayoutFullScreen = false; + auto result = session_->SetMobileAppInPadLayoutFullScreen(isMobileAppInPadLayoutFullScreen); + EXPECT_EQ(result, WSError::WS_OK); +} + /** * @tc.name: SetBufferAvailable * @tc.desc: SetBufferAvailable Test diff --git a/window_scene/test/unittest/window_session_property_test.cpp b/window_scene/test/unittest/window_session_property_test.cpp index 5a46781c68..92a88aeaaa 100755 --- a/window_scene/test/unittest/window_session_property_test.cpp +++ b/window_scene/test/unittest/window_session_property_test.cpp @@ -1626,6 +1626,20 @@ HWTEST_F(WindowSessionPropertyTest, SetPcAppInpadOrientationLandscape, TestSize. ASSERT_EQ(result, isPcAppInpadOrientationLandscape); } +/** + * @tc.name: SetMobileAppInPadLayoutFullScreen + * @tc.desc: SetMobileAppInPadLayoutFullScreen + * @tc.type: FUNC + */ +HWTEST_F(WindowSessionPropertyTest, SetMobileAppInPadLayoutFullScreen, TestSize.Level1) +{ + sptr property = sptr::MakeSptr(); + bool isMobileAppInPadLayoutFullScreen = true; + property->SetMobileAppInPadLayoutFullScreen(isMobileAppInPadLayoutFullScreen); + auto result = property->GetMobileAppInPadLayoutFullScreen(); + ASSERT_EQ(result, isMobileAppInPadLayoutFullScreen); +} + /** * @tc.name: UnmarshallingFbTemplateInfoTest * @tc.desc: UnmarshallingFbTemplateInfoTest diff --git a/wm/include/window_scene_session_impl.h b/wm/include/window_scene_session_impl.h index fcc6cf0cc1..bc3967b920 100644 --- a/wm/include/window_scene_session_impl.h +++ b/wm/include/window_scene_session_impl.h @@ -441,6 +441,7 @@ private: bool titleHoverShowEnabled_ = true; bool dockHoverShowEnabled_ = true; void PreLayoutOnShow(WindowType type, const sptr& info = nullptr); + void MobileAppInPadLayoutFullScreenChange(bool statusBarEnable, bool navigationEnable); /* * Gesture Back diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 4fbfe05c91..dede6e998a 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -3118,6 +3118,9 @@ WMError WindowSceneSessionImpl::UpdateSystemBarProperties( const std::unordered_map& systemBarProperties, const std::unordered_map& systemBarPropertyFlags) { + SystemBarProperty statusProperty = GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR); + SystemBarProperty navigationIndicatorPorperty = + GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); for (auto [systemBarType, systemBarPropertyFlag] : systemBarPropertyFlags) { if (systemBarProperties.find(systemBarType) == systemBarProperties.end()) { TLOGE(WmsLogTag::WMS_IMMS, "system bar type is invalid"); @@ -3132,6 +3135,14 @@ WMError WindowSceneSessionImpl::UpdateSystemBarProperties( systemBarProperties.at(systemBarType).contentColor_ : property.contentColor_; property.enableAnimation_ = systemBarPropertyFlag.enableAnimationFlag ? systemBarProperties.at(systemBarType).enableAnimation_ : property.enableAnimation_; + if (systemBarType == WindowType::WINDOW_TYPE_STATUS_BAR) { + statusProperty.enable_ = systemBarPropertyFlag.enableFlag ? + systemBarProperties.at(systemBarType).enable_ : statusProperty.enable_; + } + if (navigationIndicatorPorperty == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) { + navigationIndicatorPorperty.enable_ = systemBarPropertyFlag.enableFlag ? + systemBarProperties.at(systemBarType).enable_ : navigationIndicatorPorperty.enable_; + } if (systemBarPropertyFlag.enableFlag) { property.settingFlag_ |= SystemBarSettingFlag::ENABLE_SETTING; @@ -3147,9 +3158,26 @@ WMError WindowSceneSessionImpl::UpdateSystemBarProperties( } } } + MobileAppInPadLayoutFullScreenChange(statusProperty.enable_, navigationIndicatorPorperty.enable_); return WMError::WM_OK; } +void WindowSceneSessionImpl::MobileAppInPadLayoutFullScreenChange(bool statusBarEnable, bool navigationEnable) +{ + TLOGI(WMError::WMS_COMPAT, "isMobileAppInPadLayoutFullScreen %{public}d", + property_->GetMobileAppInPadLayoutFullScreen()); + if(property_->GetMobileAppInPadLayoutFullScreen() && GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN) { + TLOGI(WMError::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", + statusBarEnable, navigationEnable); + if (!statusBarEnable && !navigationEnable) { + Maximize(MaximizePresentation::ENTER_IMMERSIVE); + } + if (statusBarEnable && navigationEnable) { + Maximize(MaximizePresentation::EXIT_IMMERSIVE); + } + } +} + WMError WindowSceneSessionImpl::SetSystemBarProperty(WindowType type, const SystemBarProperty& property) { return SetSpecificBarProperty(type, property); @@ -3471,6 +3499,17 @@ WMError WindowSceneSessionImpl::MaximizeFloating() TLOGW(WmsLogTag::WMS_COMPAT, "diable fullScreen in compatibleMode window ,id:%{public}d", GetPersistentId()); return WMError::WM_ERROR_INVALID_WINDOW; } + if (property_->GetMobileAppInPadLayoutFullScreen()) { + SystemBarProperty statusProperty = GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR); + SystemBarProperty navigationIndicatorPorperty = + GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); + TLOGI(WMError::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", + statusProperty.enable_, navigationIndicatorPorperty.enable_); + if (!statusProperty.enable_ && !navigationIndicatorPorperty.enable_) { + Maximize(MaximizePresentation::ENTER_IMMERSIVE); + return WMError::WM_OK; + } + } if (GetGlobalMaximizeMode() != MaximizeMode::MODE_AVOID_SYSTEM_BAR) { hostSession->OnSessionEvent(SessionEvent::EVENT_MAXIMIZE); SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN); diff --git a/wm/test/unittest/window_scene_session_impl_test3.cpp b/wm/test/unittest/window_scene_session_impl_test3.cpp index fe2e951b18..99dbb7dbf6 100644 --- a/wm/test/unittest/window_scene_session_impl_test3.cpp +++ b/wm/test/unittest/window_scene_session_impl_test3.cpp @@ -1021,6 +1021,57 @@ HWTEST_F(WindowSceneSessionImplTest3, MaximizeFloating01, TestSize.Level1) EXPECT_EQ(WMError::WM_OK, ret); } +/** + * @tc.name: MaximizeFloating + * @tc.desc: MaximizeFloating + * @tc.type: FUNC + */ +HWTEST_F(WindowSceneSessionImplTest3, MaximizeFloating, TestSize.Level1) +{ + sptr option = sptr::MakeSptr(); + option->SetWindowName("MaximizeFloating"); + sptr windowSceneSessionImpl = sptr::MakeSptr(option); + + SessionInfo sessionInfo = { "CreateTestBundle", "CreateTestModule", "CreateTestAbility" }; + sptr session = sptr::MakeSptr(sessionInfo); + windowSceneSessionImpl->property_->SetPersistentId(1); + windowSceneSessionImpl->hostSession_ = session; + windowSceneSessionImpl->state_ = WindowState::STATE_SHOWN; + windowSceneSessionImpl->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_END); + auto ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret); + windowSceneSessionImpl->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE); + windowSceneSessionImpl->SetGlobalMaximizeMode(MaximizeMode::MODE_AVOID_SYSTEM_BAR); + ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_OK, ret); + auto ret1 = windowSceneSessionImpl->GetGlobalMaximizeMode(); + EXPECT_EQ(MaximizeMode::MODE_RECOVER, ret1); + windowSceneSessionImpl->SetGlobalMaximizeMode(MaximizeMode::MODE_FULL_FILL); + ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_OK, ret); + SystemBarProperty statusProperty = + windowSceneSessionImpl->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR); + SystemBarProperty navigationIndicatorPorperty = + windowSceneSessionImpl->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); + statusProperty.enable_ = false; + navigationIndicatorPorperty.enable_ = false; + ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_OK, ret); + tatusProperty.enable_ = true; + navigationIndicatorPorperty.enable_ = true; + ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_OK, ret); + tatusProperty.enable_ = true; + navigationIndicatorPorperty.enable_ = false; + ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_OK, ret); + tatusProperty.enable_ = false; + navigationIndicatorPorperty.enable_ = true; + ret = windowSceneSessionImpl->MaximizeFloating(); + EXPECT_EQ(WMError::WM_OK, ret); + +} + /** * @tc.name: Recover * @tc.desc: Recover diff --git a/wm/test/unittest/window_scene_session_impl_test5.cpp b/wm/test/unittest/window_scene_session_impl_test5.cpp index 2316ea7300..35c5aedd21 100644 --- a/wm/test/unittest/window_scene_session_impl_test5.cpp +++ b/wm/test/unittest/window_scene_session_impl_test5.cpp @@ -995,6 +995,41 @@ HWTEST_F(WindowSceneSessionImplTest5, UpdateSystemBarProperties02, TestSize.Leve window->UpdateSystemBarProperties(systemBarProperties, systemBarPropertyFlags)); } +/** + * @tc.name: MobileAppInPadLayoutFullScreenChange + * @tc.desc: MobileAppInPadLayoutFullScreenChange test + * @tc.type: FUNC + */ +HWTEST_F(WindowSceneSessionImplTest5, MobileAppInPadLayoutFullScreenChange, TestSize.Level0) +{ + sptr option = sptr::MakeSptr(); + option->SetWindowName("MobileAppInPadLayoutFullScreenChange"); + option->SetWindowMode(WindowMode::WINDOW_MODE_PIP); + option->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE); + SessionInfo sessionInfo = {"CreateTestBundle", "CreateTestModule", "CreateTestAbility"}; + sptr session = sptr::MakeSptr(sessionInfo); + + sptr window = sptr::MakeSptr(option); + window->hostSession_ = session; + window->property_->SetPersistentId(1); + window->state_ = WindowState::STATE_CREATED; + + window->property_->SetMobileAppInPadLayoutFullScreen(true); + window->property_->SetWidnowMode(WindowMode::WINDOW_MODE_FULLSCREEN); + bool statusBarEnable = true; + bool navigationEnable = true; + window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); + bool statusBarEnable = false; + bool navigationEnable = false; + window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); + bool statusBarEnable = false; + bool navigationEnable = true; + window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); + bool statusBarEnable = true; + bool navigationEnable = false; + window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); +} + /** * @tc.name: NotifyAfterDidForeground * @tc.desc: NotifyAfterDidForeground -- Gitee From 9fe96871ed1a14dd3956b2a59ff747675ebd7bfa Mon Sep 17 00:00:00 2001 From: zyh990312 Date: Sat, 13 Sep 2025 16:43:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?review=20=E6=84=8F=E8=A7=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zyh990312 --- window_scene/session/host/src/session.cpp | 2 +- wm/src/window_scene_session_impl.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/window_scene/session/host/src/session.cpp b/window_scene/session/host/src/session.cpp index e3b7349169..bd49b1b9b7 100644 --- a/window_scene/session/host/src/session.cpp +++ b/window_scene/session/host/src/session.cpp @@ -1384,7 +1384,7 @@ void Session::InitSessionPropertyWhenConnect(const sptr& property->SetPcAppInpadCompatibleMode(GetSessionProperty()->GetPcAppInpadCompatibleMode()); property->SetPcAppInpadSpecificSystemBarInvisible(GetSessionProperty()->GetPcAppInpadSpecificSystemBarInvisible()); property->SetPcAppInpadOrientationLandscape(GetSessionProperty()->GetPcAppInpadOrientationLandscape()); - property->SetMobileAppInPadLayoutFullScreen(GetSessionProperty()->GetMobileAppInPadLayoutFullScreen()) + property->SetMobileAppInPadLayoutFullScreen(GetSessionProperty()->GetMobileAppInPadLayoutFullScreen()); const bool isPcMode = system::GetBoolParameter("persist.sceneboard.ispcmode", false); const bool isShow = !(isScreenLockedCallback_ && isScreenLockedCallback_() && systemConfig_.IsFreeMultiWindowMode() && !isPcMode); diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index dede6e998a..61756acdd6 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -3120,7 +3120,7 @@ WMError WindowSceneSessionImpl::UpdateSystemBarProperties( { SystemBarProperty statusProperty = GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR); SystemBarProperty navigationIndicatorPorperty = - GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); + GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); for (auto [systemBarType, systemBarPropertyFlag] : systemBarPropertyFlags) { if (systemBarProperties.find(systemBarType) == systemBarProperties.end()) { TLOGE(WmsLogTag::WMS_IMMS, "system bar type is invalid"); @@ -3137,11 +3137,11 @@ WMError WindowSceneSessionImpl::UpdateSystemBarProperties( systemBarProperties.at(systemBarType).enableAnimation_ : property.enableAnimation_; if (systemBarType == WindowType::WINDOW_TYPE_STATUS_BAR) { statusProperty.enable_ = systemBarPropertyFlag.enableFlag ? - systemBarProperties.at(systemBarType).enable_ : statusProperty.enable_; + systemBarProperties.at(systemBarType).enable_ : statusProperty.enable_; } - if (navigationIndicatorPorperty == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) { + if (systemBarType == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) { navigationIndicatorPorperty.enable_ = systemBarPropertyFlag.enableFlag ? - systemBarProperties.at(systemBarType).enable_ : navigationIndicatorPorperty.enable_; + systemBarProperties.at(systemBarType).enable_ : statusProperty.enable_; } if (systemBarPropertyFlag.enableFlag) { @@ -3164,10 +3164,10 @@ WMError WindowSceneSessionImpl::UpdateSystemBarProperties( void WindowSceneSessionImpl::MobileAppInPadLayoutFullScreenChange(bool statusBarEnable, bool navigationEnable) { - TLOGI(WMError::WMS_COMPAT, "isMobileAppInPadLayoutFullScreen %{public}d", + TLOGI(WmsLogTag::WMS_COMPAT, "isMobileAppInPadLayoutFullScreen %{public}d", property_->GetMobileAppInPadLayoutFullScreen()); if(property_->GetMobileAppInPadLayoutFullScreen() && GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN) { - TLOGI(WMError::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", + TLOGI(WmsLogTag::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", statusBarEnable, navigationEnable); if (!statusBarEnable && !navigationEnable) { Maximize(MaximizePresentation::ENTER_IMMERSIVE); @@ -3503,7 +3503,7 @@ WMError WindowSceneSessionImpl::MaximizeFloating() SystemBarProperty statusProperty = GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR); SystemBarProperty navigationIndicatorPorperty = GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); - TLOGI(WMError::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", + TLOGI(WmsLogTag::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", statusProperty.enable_, navigationIndicatorPorperty.enable_); if (!statusProperty.enable_ && !navigationIndicatorPorperty.enable_) { Maximize(MaximizePresentation::ENTER_IMMERSIVE); -- Gitee From db66fc3dc68331f88aba94ce1cb39af766370a01 Mon Sep 17 00:00:00 2001 From: zyh990312 Date: Sat, 13 Sep 2025 18:38:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?review=20=E6=84=8F=E8=A7=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zyh990312 --- wm/src/window_scene_session_impl.cpp | 2 +- wm/test/unittest/window_scene_session_impl_test3.cpp | 3 +-- wm/test/unittest/window_scene_session_impl_test5.cpp | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 61756acdd6..8de98cb40e 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -3166,7 +3166,7 @@ void WindowSceneSessionImpl::MobileAppInPadLayoutFullScreenChange(bool statusBar { TLOGI(WmsLogTag::WMS_COMPAT, "isMobileAppInPadLayoutFullScreen %{public}d", property_->GetMobileAppInPadLayoutFullScreen()); - if(property_->GetMobileAppInPadLayoutFullScreen() && GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN) { + if (property_->GetMobileAppInPadLayoutFullScreen() && GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN) { TLOGI(WmsLogTag::WMS_COMPAT, "statusProperty %{public}d, navigationIndicatorPorperty %{public}d", statusBarEnable, navigationEnable); if (!statusBarEnable && !navigationEnable) { diff --git a/wm/test/unittest/window_scene_session_impl_test3.cpp b/wm/test/unittest/window_scene_session_impl_test3.cpp index 99dbb7dbf6..5ff40d1b83 100644 --- a/wm/test/unittest/window_scene_session_impl_test3.cpp +++ b/wm/test/unittest/window_scene_session_impl_test3.cpp @@ -1051,7 +1051,7 @@ HWTEST_F(WindowSceneSessionImplTest3, MaximizeFloating, TestSize.Level1) EXPECT_EQ(WMError::WM_OK, ret); SystemBarProperty statusProperty = windowSceneSessionImpl->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR); - SystemBarProperty navigationIndicatorPorperty = + SystemBarProperty navigationIndicatorPorperty = windowSceneSessionImpl->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR); statusProperty.enable_ = false; navigationIndicatorPorperty.enable_ = false; @@ -1069,7 +1069,6 @@ HWTEST_F(WindowSceneSessionImplTest3, MaximizeFloating, TestSize.Level1) navigationIndicatorPorperty.enable_ = true; ret = windowSceneSessionImpl->MaximizeFloating(); EXPECT_EQ(WMError::WM_OK, ret); - } /** diff --git a/wm/test/unittest/window_scene_session_impl_test5.cpp b/wm/test/unittest/window_scene_session_impl_test5.cpp index 35c5aedd21..82556193ed 100644 --- a/wm/test/unittest/window_scene_session_impl_test5.cpp +++ b/wm/test/unittest/window_scene_session_impl_test5.cpp @@ -1018,10 +1018,14 @@ HWTEST_F(WindowSceneSessionImplTest5, MobileAppInPadLayoutFullScreenChange, Test window->property_->SetWidnowMode(WindowMode::WINDOW_MODE_FULLSCREEN); bool statusBarEnable = true; bool navigationEnable = true; + window->enableImmersiveMode_ = true; window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); + EXPECT_EQ(false, window->enableImmersiveMode_); bool statusBarEnable = false; bool navigationEnable = false; + window->enableImmersiveMode_ = false; window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); + EXPECT_EQ(true, window->enableImmersiveMode_); bool statusBarEnable = false; bool navigationEnable = true; window->MobileAppInPadLayoutFullScreenChange(statusBarEnable, navigationEnable); -- Gitee