fix recent snapshot bug

Signed-off-by: jincanran <jincanran@huawei.com>
Change-Id: I767e934c72d73d16dcae81b40d0e7662161ce6fe
This commit is contained in:
jincanran
2022-03-22 20:19:01 +08:00
parent a4808fc2ca
commit 63c4f340ee
3 changed files with 19 additions and 7 deletions
+1
View File
@@ -65,6 +65,7 @@ protected:
void SetRectForFloating(const sptr<WindowNode>& node);
Rect ComputeDecoratedWindowRect(const Rect& winRect);
bool IsVertical() const;
bool IsFullScreenRecentWindowExist() const;
Rect defaultFloatingRect_ = { 0, 0, 0, 0 };
};
}
+17 -3
View File
@@ -57,10 +57,13 @@ void WindowLayoutPolicy::Reorder()
void WindowLayoutPolicy::LayoutWindowTree()
{
limitRect_ = displayRect_;
std::vector<sptr<WindowNode>> 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<WindowNode>& 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_;
@@ -86,10 +86,7 @@ void WindowLayoutPolicyCascade::LayoutWindowNode(sptr<WindowNode>& node)
void WindowLayoutPolicyCascade::LayoutWindowTree()
{
InitLimitRects();
std::vector<sptr<WindowNode>> 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<WindowNode>& node, bool isAddWindow)