fix starting window show when locked bug

Signed-off-by: qianlf <qianliangfang@huawei.com>
Change-Id: I38617df53fcb838855e56379badaf557594e3681
This commit is contained in:
qianlf
2022-05-17 21:13:39 +08:00
parent 31510cf595
commit aaaf6f4e5d
3 changed files with 25 additions and 6 deletions
+2 -1
View File
@@ -129,8 +129,9 @@ private:
static bool ReadIsWindowAnimationEnabledProperty();
void DumpScreenWindowTree();
void RaiseInputMethodWindowPriorityIfNeeded(const sptr<WindowNode>& node) const;
void ReZOrderShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node);
void RaiseShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node);
void ReZOrderShowWhenLockedWindows(const sptr<WindowNode>& node, bool up);
void ReZOrderShowWhenLockedWindows(bool up);
WMError AddWindowNodeOnWindowTree(sptr<WindowNode>& node, const sptr<WindowNode>& parentNode);
void RemoveWindowNodeFromWindowTree(sptr<WindowNode>& node);
+2 -1
View File
@@ -172,9 +172,10 @@ WMError WindowController::AddWindowNode(sptr<WindowProperty>& property)
return WMError::WM_ERROR_INVALID_OPERATION;
}
// using starting window rect if client rect is empty
if (WindowHelper::IsEmptyRect(property->GetRequestRect())) { // for tile and cascade
if (WindowHelper::IsEmptyRect(property->GetRequestRect()) && node->startingWindowShown_) { // for tile and cascade
property->SetRequestRect(node->GetRequestRect());
property->SetWindowRect(node->GetWindowRect());
property->SetDecoStatus(true);
}
node->GetWindowProperty()->CopyFrom(property);
+21 -4
View File
@@ -169,12 +169,13 @@ WMError WindowNodeContainer::AddWindowNode(sptr<WindowNode>& node, sptr<WindowNo
for (auto& displayId : node->GetShowingDisplays()) {
UpdateRSTree(node, displayId, true, node->isPlayAnimationShow_);
}
AssignZOrder();
} else {
node->isPlayAnimationShow_ = false;
node->startingWindowShown_ = false;
ReZOrderShowWhenLockedWindowIfNeeded(node);
}
AssignZOrder();
layoutPolicy_->AddWindowNode(node);
if (WindowHelper::IsAvoidAreaWindow(node->GetWindowType())) {
avoidController_->AvoidControl(node, AvoidControlType::AVOID_NODE_ADD);
@@ -1373,7 +1374,7 @@ void WindowNodeContainer::RaiseInputMethodWindowPriorityIfNeeded(const sptr<Wind
}
}
void WindowNodeContainer::ReZOrderShowWhenLockedWindows(const sptr<WindowNode>& node, bool up)
void WindowNodeContainer::ReZOrderShowWhenLockedWindows(bool up)
{
WLOGFI("Keyguard change %{public}u, re-zorder showWhenLocked window", up);
std::vector<sptr<WindowNode>> needReZOrderNodes;
@@ -1410,11 +1411,27 @@ void WindowNodeContainer::ReZOrderShowWhenLockedWindows(const sptr<WindowNode>&
}
}
void WindowNodeContainer::ReZOrderShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node)
{
if (!(node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED))) {
return;
}
auto iter = std::find_if(aboveAppWindowNode_->children_.begin(), aboveAppWindowNode_->children_.end(),
[](sptr<WindowNode> node) {
return node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD;
});
if (iter != aboveAppWindowNode_->children_.end()) {
WLOGFI("ShowWhenLocked window %{public}u re-zorder to up", node->GetWindowId());
ReZOrderShowWhenLockedWindows(true);
}
}
void WindowNodeContainer::RaiseShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node)
{
// if keyguard window show, raise show when locked windows
if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) {
ReZOrderShowWhenLockedWindows(node, true);
ReZOrderShowWhenLockedWindows(true);
return;
}
@@ -1438,7 +1455,7 @@ void WindowNodeContainer::DropShowWhenLockedWindowIfNeeded(const sptr<WindowNode
{
// if keyguard window hide, drop show when locked windows
if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) {
ReZOrderShowWhenLockedWindows(node, false);
ReZOrderShowWhenLockedWindows(false);
AssignZOrder();
}
}