diff --git a/wmserver/include/window_layout_policy.h b/wmserver/include/window_layout_policy.h index 78f22433..84fc44f3 100644 --- a/wmserver/include/window_layout_policy.h +++ b/wmserver/include/window_layout_policy.h @@ -65,6 +65,7 @@ protected: void SetRectForFloating(const sptr& node); Rect ComputeDecoratedWindowRect(const Rect& winRect); bool IsVertical() const; + bool IsFullScreenRecentWindowExist() const; Rect defaultFloatingRect_ = { 0, 0, 0, 0 }; }; } diff --git a/wmserver/src/window_layout_policy.cpp b/wmserver/src/window_layout_policy.cpp index 440a03fe..576a3a30 100644 --- a/wmserver/src/window_layout_policy.cpp +++ b/wmserver/src/window_layout_policy.cpp @@ -57,10 +57,13 @@ void WindowLayoutPolicy::Reorder() void WindowLayoutPolicy::LayoutWindowTree() { limitRect_ = displayRect_; - std::vector> rootNodes = { aboveAppWindowNode_, appWindowNode_, belowAppWindowNode_ }; - for (auto& node : rootNodes) { // ensure that the avoid area windows are traversed first - LayoutWindowNode(node); + LayoutWindowNode(aboveAppWindowNode_); // ensure that the avoid area windows are traversed first + if (IsFullScreenRecentWindowExist()) { + WLOGFI("recent window on top, early exit layout tree"); + return; } + LayoutWindowNode(appWindowNode_); + LayoutWindowNode(belowAppWindowNode_); } void WindowLayoutPolicy::LayoutWindowNode(sptr& node) @@ -382,6 +385,17 @@ float WindowLayoutPolicy::GetVirtualPixelRatio() const return virtualPixelRatio; } +bool WindowLayoutPolicy::IsFullScreenRecentWindowExist() const +{ + for (auto& childNode : aboveAppWindowNode_->children_) { + if (childNode->GetWindowType() == WindowType::WINDOW_TYPE_LAUNCHER_RECENT && + childNode->GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN) { + return true; + } + } + return false; +} + Rect WindowLayoutPolicy::GetDisplayLimitRect() const { return limitRect_; diff --git a/wmserver/src/window_layout_policy_cascade.cpp b/wmserver/src/window_layout_policy_cascade.cpp index d5ed92da..5c5665ba 100644 --- a/wmserver/src/window_layout_policy_cascade.cpp +++ b/wmserver/src/window_layout_policy_cascade.cpp @@ -86,10 +86,7 @@ void WindowLayoutPolicyCascade::LayoutWindowNode(sptr& node) void WindowLayoutPolicyCascade::LayoutWindowTree() { InitLimitRects(); - std::vector> rootNodes = { aboveAppWindowNode_, appWindowNode_, belowAppWindowNode_ }; - for (auto& node : rootNodes) { // ensure that the avoid area windows are traversed first - LayoutWindowNode(node); - } + WindowLayoutPolicy::LayoutWindowTree(); } void WindowLayoutPolicyCascade::UpdateWindowNode(sptr& node, bool isAddWindow)