diff --git a/interfaces/innerkits/wm/wm_common.h b/interfaces/innerkits/wm/wm_common.h index 8250837977..702abc9382 100644 --- a/interfaces/innerkits/wm/wm_common.h +++ b/interfaces/innerkits/wm/wm_common.h @@ -296,10 +296,9 @@ public: bool Marshalling(Parcel& parcel) const { return parcel.WriteFloat(pivotX_) && parcel.WriteFloat(pivotY_) && - parcel.WriteFloat(scaleX_) && parcel.WriteFloat(scaleY_) && parcel.WriteFloat(scaleZ_) && - parcel.WriteFloat(rotationX_) && parcel.WriteFloat(rotationY_) && - parcel.WriteFloat(rotationZ_) && parcel.WriteFloat(translateX_) && - parcel.WriteFloat(translateY_) && parcel.WriteFloat(translateZ_); + parcel.WriteFloat(scaleX_) && parcel.WriteFloat(scaleY_) && parcel.WriteFloat(scaleZ_) && + parcel.WriteFloat(rotationX_) && parcel.WriteFloat(rotationY_) && parcel.WriteFloat(rotationZ_) && + parcel.WriteFloat(translateX_) && parcel.WriteFloat(translateY_) && parcel.WriteFloat(translateZ_); } void Unmarshalling(Parcel& parcel) diff --git a/test/systemtest/wms/window_display_zoom_test.cpp b/test/systemtest/wms/window_display_zoom_test.cpp index 9b569c5ce8..c586e4cca0 100644 --- a/test/systemtest/wms/window_display_zoom_test.cpp +++ b/test/systemtest/wms/window_display_zoom_test.cpp @@ -87,17 +87,17 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom01, Function | MediumTest | Level3) Rect rect = window->GetRect(); expect.pivotX_ = (0 - rect.posX_) * 1.0 / rect.width_; expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_; - expect.scaleX_ = expect.scaleY_ = 2; + expect.scaleX_ = expect.scaleY_ = 2; // scale value ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform()); WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 2); sleep(1); - expect.scaleX_ = expect.scaleY_ = 4; + expect.scaleX_ = expect.scaleY_ = 4; // scale value ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform()); WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 0.5); sleep(1); - expect.scaleX_ = expect.scaleY_ = 2; + expect.scaleX_ = expect.scaleY_ = 2; // scale value ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform()); WindowAccessibilityController::GetInstance().SetAnchorAndScale(0, 0, 0.1); @@ -134,8 +134,8 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom02, Function | MediumTest | Level3) Rect rect = window->GetRect(); expect.pivotX_ = (0 - rect.posX_) * 1.0 / rect.width_; expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_; - expect.scaleX_ = expect.scaleY_ = 2; - expect.translateX_ = expect.translateY_ = -100; + expect.scaleX_ = expect.scaleY_ = 2; // scale value + expect.translateX_ = expect.translateY_ = -100; // translate value WindowAccessibilityController::GetInstance().SetAnchorOffset(200, 200); sleep(1); @@ -192,7 +192,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom04, Function | MediumTest | Level3) Rect rect = window->GetRect(); expect.pivotX_ = (0 - rect.posX_) * 1.0 / rect.width_; expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_; - expect.scaleX_ = expect.scaleY_ = 2; + expect.scaleX_ = expect.scaleY_ = 2; // scale value ASSERT_TRUE(expect == implPtr->GetWindowProperty()->GetZoomTransform()); ASSERT_EQ(WMError::WM_OK, window->Hide());; @@ -226,8 +226,8 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom05, Function | MediumTest | Level3) ASSERT_EQ(WMError::WM_OK, window->Show()); Transform animate; - animate.translateX_ = -100; - animate.translateZ_ = 100; + animate.translateX_ = -100; // translate x value + animate.translateZ_ = 100; // translate z value window->SetTransform(animate); sleep(1); @@ -235,7 +235,7 @@ HWTEST_F(WindowDisplayZoomTest, DisplayZoom05, Function | MediumTest | Level3) Rect rect = window->GetRect(); expect.pivotX_ = (0 - rect.posX_) * 1.0 / rect.width_; expect.pivotY_ = (0 - rect.posY_) * 1.0 / rect.height_; - expect.scaleX_ = expect.scaleY_ = 1.7; + expect.scaleX_ = expect.scaleY_ = 1.7; // scale value Transform actual = implPtr->GetWindowProperty()->GetZoomTransform(); auto isExpec = [](float a, float b) -> bool { diff --git a/wmserver/include/utils/window_manager_service_utils.h b/wmserver/include/utils/window_manager_service_utils.h index 7b4b9d8113..4bcbbceb14 100644 --- a/wmserver/include/utils/window_manager_service_utils.h +++ b/wmserver/include/utils/window_manager_service_utils.h @@ -44,9 +44,9 @@ public: static bool IsExpectedRotateLandscapeWindow(Orientation requestOrientation, DisplayOrientation currentOrientation, uint32_t flags); static bool IsExpectedRotatableWindow(Orientation requestOrientation, - DisplayOrientation currentOrientation, WindowMode mode, uint32_t flags); + DisplayOrientation currentOrientation, WindowMode mode, uint32_t flags, bool restricted = true); static bool IsExpectedRotatableWindow(Orientation requestOrientation, - DisplayOrientation currentOrientation, uint32_t flags); + DisplayOrientation currentOrientation, uint32_t flags, bool restricted = true); }; } } diff --git a/wmserver/src/starting_window.cpp b/wmserver/src/starting_window.cpp index 5a606e83c9..0727bccf78 100644 --- a/wmserver/src/starting_window.cpp +++ b/wmserver/src/starting_window.cpp @@ -89,7 +89,7 @@ sptr StartingWindow::CreateWindowNode(const sptrSetWindowType(info->GetWindowType()); auto displayInfo = DisplayGroupInfo::GetInstance().GetDisplayInfo(info->GetDisplayId()); if (!(displayInfo && WmsUtils::IsExpectedRotatableWindow(orientation, - displayInfo->GetDisplayOrientation(), property->GetWindowMode(), property->GetWindowFlags()))) { + displayInfo->GetDisplayOrientation(), property->GetWindowMode(), property->GetWindowFlags(), false))) { property->AddWindowFlag(WindowFlag::WINDOW_FLAG_NEED_AVOID); } if (info->GetShowFlagWhenLocked()) { diff --git a/wmserver/src/utils/window_manager_service_utils.cpp b/wmserver/src/utils/window_manager_service_utils.cpp index e3167d9598..30b158f16a 100644 --- a/wmserver/src/utils/window_manager_service_utils.cpp +++ b/wmserver/src/utils/window_manager_service_utils.cpp @@ -48,16 +48,16 @@ bool WmsUtils::IsExpectedRotateLandscapeWindow(Orientation requestOrientation, } bool WmsUtils::IsExpectedRotatableWindow(Orientation requestOrientation, - DisplayOrientation currentOrientation, WindowMode mode, uint32_t flags) + DisplayOrientation currentOrientation, WindowMode mode, uint32_t flags, bool restricted) { if (mode != WindowMode::WINDOW_MODE_FULLSCREEN) { return false; } - return IsExpectedRotatableWindow(requestOrientation, currentOrientation, flags); + return IsExpectedRotatableWindow(requestOrientation, currentOrientation, flags, restricted); } bool WmsUtils::IsExpectedRotatableWindow(Orientation requestOrientation, - DisplayOrientation currentOrientation, uint32_t flags) + DisplayOrientation currentOrientation, uint32_t flags, bool restricted) { if (!FIX_ORIENTATION_ENABLE) { return false; @@ -69,10 +69,13 @@ bool WmsUtils::IsExpectedRotatableWindow(Orientation requestOrientation, return false; } DisplayOrientation disOrientation = WINDOW_TO_DISPLAY_ORIENTATION_MAP.at(requestOrientation); - if (disOrientation != currentOrientation) { - return true; + if (disOrientation == currentOrientation) { + return false; } - return false; + if (restricted && (static_cast(disOrientation) - static_cast(currentOrientation)) % 2 == 0) { + return false; + } + return true; } } } \ No newline at end of file diff --git a/wmserver/src/window_root.cpp b/wmserver/src/window_root.cpp index 24890f32f8..227e271172 100644 --- a/wmserver/src/window_root.cpp +++ b/wmserver/src/window_root.cpp @@ -767,12 +767,12 @@ void WindowRoot::UpdateDisplayOrientationWhenHideWindow(sptr& node) WLOGFD("[FixOrientation] begin"); auto container = GetOrCreateWindowNodeContainer(node->GetDisplayId()); if (container == nullptr) { - WLOGFE("[FixOrientation]failed, window container could not be found"); + WLOGFE("[FixOrientation] failed, window container could not be found"); return; } auto nextRotatableWindow = container->GetNextRotatableWindow(node->GetWindowId()); if (nextRotatableWindow != nullptr) { - WLOGFD("[FixOrientation] nexi rotatable window: %{public}u", nextRotatableWindow->GetWindowId()); + WLOGFD("[FixOrientation] next rotatable window: %{public}u", nextRotatableWindow->GetWindowId()); SetDisplayOrientationFromWindow(nextRotatableWindow, false); } }