From dc5daed67af4a7cbfc0f0ebb2e4001e39b5f9b3f Mon Sep 17 00:00:00 2001 From: sunshuaiyuan Date: Thu, 21 Aug 2025 16:44:18 +0800 Subject: [PATCH] notify switching Signed-off-by: sunshuaiyuan --- .../secondary_display_fold_policy.h | 3 ++- .../secondary_display_fold_policy.cpp | 25 +++++++++++++++---- .../secondary_display_fold_policy_test.cpp | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/window_scene/screen_session_manager/include/fold_screen_controller/secondary_display_fold_policy.h b/window_scene/screen_session_manager/include/fold_screen_controller/secondary_display_fold_policy.h index f135dc9763..d86637ec9f 100644 --- a/window_scene/screen_session_manager/include/fold_screen_controller/secondary_display_fold_policy.h +++ b/window_scene/screen_session_manager/include/fold_screen_controller/secondary_display_fold_policy.h @@ -54,7 +54,8 @@ private: void SendPropertyChangeResult(sptr screenSession, ScreenId screenId, ScreenPropertyChangeReason reason, FoldDisplayMode displayMode); void SetStatusConditionalActiveRectAndTpFeature(ScreenProperty &screenProperty); - void SetStatusFullActiveRectAndTpFeature(const sptr& screenSession, ScreenProperty &screenProperty); + void SetStatusFullActiveRectAndTpFeature(const sptr& screenSession, ScreenProperty& screenProperty, + bool isNeedToSetSwitch = true); void SetStatusMainActiveRectAndTpFeature(const sptr& screenSession, ScreenProperty &screenProperty); void SetStatusGlobalFullActiveRectAndTpFeature(const sptr& screenSession, ScreenProperty &screenProperty); diff --git a/window_scene/screen_session_manager/src/fold_screen_controller/secondary_display_fold_policy.cpp b/window_scene/screen_session_manager/src/fold_screen_controller/secondary_display_fold_policy.cpp index ba1892a016..d1b555fec9 100644 --- a/window_scene/screen_session_manager/src/fold_screen_controller/secondary_display_fold_policy.cpp +++ b/window_scene/screen_session_manager/src/fold_screen_controller/secondary_display_fold_policy.cpp @@ -43,7 +43,7 @@ const int32_t GLOBAL_FULL_STATUS_WIDTH = 2; const int32_t SCREEN_HEIGHT = 3; const int32_t FULL_STATUS_OFFSET_X = 4; constexpr uint32_t HALF_DIVIDER = 2; -constexpr float MAIN_DISPLAY_ROTATION_DEGREE = 180; +constexpr float MAIN_DISPLAY_ROTATION_DEGREE = -270; constexpr float ROTATION_TRANSLATE_X = 612; constexpr float ROTATION_TRANSLATE_Y = -612; constexpr float FULL_NODE_POSITION_Z = 0.0f; @@ -501,12 +501,18 @@ void SecondaryDisplayFoldPolicy::SendPropertyChangeResult(sptr sc { std::lock_guard lock_info(displayInfoMutex_); screenProperty_ = ScreenSessionManager::GetInstance().GetPhyScreenProperty(screenId); + bool isNeedNotifyFoldProperty = true; + bool isNeedToSetSwitch = true; switch (displayMode) { case FoldDisplayMode::FULL: { if (currentDisplayMode_ == FoldDisplayMode::COORDINATION) { + if (currentFoldStatus_ == FoldStatus::EXPAND) { + isNeedToSetSwitch = false; + isNeedNotifyFoldProperty = false; + } CloseCoordinationScreen(); } - SetStatusFullActiveRectAndTpFeature(screenSession, screenProperty_); + SetStatusFullActiveRectAndTpFeature(screenSession, screenProperty_, isNeedToSetSwitch); break; } case FoldDisplayMode::MAIN: { @@ -526,6 +532,7 @@ void SecondaryDisplayFoldPolicy::SendPropertyChangeResult(sptr sc } case FoldDisplayMode::COORDINATION: { if (currentDisplayMode_ == FoldDisplayMode::FULL) { + isNeedNotifyFoldProperty = false; ChangeScreenDisplayModeToCoordination(); SetStatusConditionalActiveRectAndTpFeature(screenProperty_); } @@ -542,14 +549,20 @@ void SecondaryDisplayFoldPolicy::SendPropertyChangeResult(sptr sc if (displayMode == FoldDisplayMode::MAIN) { screenSession->SetRotationAndScreenRotationOnly(Rotation::ROTATION_0); } - screenSession->PropertyChange(oldScreenProperty, reason); + + if (isNeedNotifyFoldProperty) { + screenSession->PropertyChange(oldScreenProperty, reason); + } else { + TLOGI(WmsLogTag::DMS, "PropertyChange...set displayModeChangeStatus"); + SetSecondaryDisplayModeChangeStatus(false); + } TLOGI(WmsLogTag::DMS, "screenBounds : width_= %{public}f, height_= %{public}f", screenSession->GetScreenProperty().GetBounds().rect_.width_, screenSession->GetScreenProperty().GetBounds().rect_.height_); } void SecondaryDisplayFoldPolicy::SetStatusFullActiveRectAndTpFeature(const sptr& screenSession, - ScreenProperty &screenProperty) + ScreenProperty &screenProperty, bool isNeedToSetSwitch) { if (screenParams_.size() < FULL_STATUS_OFFSET_X + 1) { return; @@ -566,7 +579,9 @@ void SecondaryDisplayFoldPolicy::SetStatusFullActiveRectAndTpFeature(const sptr< .h = screenParams_[FULL_STATUS_WIDTH], }; if (!onBootAnimation_) { - RSInterfaces::GetInstance().NotifyScreenSwitched(); + if (isNeedToSetSwitch) { + RSInterfaces::GetInstance().NotifyScreenSwitched(); + } auto response = RSInterfaces::GetInstance().SetScreenActiveRect(0, rectCur); TLOGI(WmsLogTag::DMS, "rs response is %{public}ld", static_cast(response)); } diff --git a/window_scene/test/dms_unittest/secondary_display_fold_policy_test.cpp b/window_scene/test/dms_unittest/secondary_display_fold_policy_test.cpp index 1c8daec9dd..72411cc277 100644 --- a/window_scene/test/dms_unittest/secondary_display_fold_policy_test.cpp +++ b/window_scene/test/dms_unittest/secondary_display_fold_policy_test.cpp @@ -339,7 +339,7 @@ HWTEST_F(SecondaryDisplayFoldPolicyTest, SetStatusFullActiveRectAndTpFeature, Te ScreenProperty property = policy.screenProperty_; sptr screenSession = ScreenSessionManager::GetInstance().GetScreenSession(0); - policy.SetStatusFullActiveRectAndTpFeature(screenSession, property); + policy.SetStatusFullActiveRectAndTpFeature(screenSession, property, true); EXPECT_FALSE(policy.onBootAnimation_); } -- Gitee