Lines Matching refs:node
129 WMError WindowNodeContainer::AddWindowNodeOnWindowTree(sptr<WindowNode>& node, const sptr<WindowNod… in AddWindowNodeOnWindowTree() argument
131 sptr<WindowNode> root = FindRoot(node->GetWindowType()); in AddWindowNodeOnWindowTree()
132 if (root == nullptr && !(WindowHelper::IsSystemSubWindow(node->GetWindowType()) && in AddWindowNodeOnWindowTree()
137 node->requestedVisibility_ = true; in AddWindowNodeOnWindowTree()
139 if (WindowHelper::IsSystemSubWindow(node->GetWindowType()) || in AddWindowNodeOnWindowTree()
140 node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT) { in AddWindowNodeOnWindowTree()
158 node->currentVisibility_ = parentNode->currentVisibility_; in AddWindowNodeOnWindowTree()
159 node->parent_ = parentNode; in AddWindowNodeOnWindowTree()
161 node->parent_ = root; in AddWindowNodeOnWindowTree()
162 node->currentVisibility_ = true; in AddWindowNodeOnWindowTree()
163 for (auto& child : node->children_) { in AddWindowNodeOnWindowTree()
166 if (WindowHelper::IsSystemBarWindow(node->GetWindowType())) { in AddWindowNodeOnWindowTree()
167 … displayGroupController_->sysBarNodeMaps_[node->GetDisplayId()][node->GetWindowType()] = node; in AddWindowNodeOnWindowTree()
173 WMError WindowNodeContainer::ShowStartingWindow(sptr<WindowNode>& node) in ShowStartingWindow() argument
175 if (node->currentVisibility_) { in ShowStartingWindow()
176 WLOGFE("current window is visible, windowId: %{public}u", node->GetWindowId()); in ShowStartingWindow()
180 WMError res = AddWindowNodeOnWindowTree(node, nullptr); in ShowStartingWindow()
184 UpdateWindowTree(node); in ShowStartingWindow()
185 displayGroupController_->PreProcessWindowNode(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in ShowStartingWindow()
186 StartingWindow::AddNodeOnRSTree(node, layoutPolicy_->IsMultiDisplay()); in ShowStartingWindow()
188 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in ShowStartingWindow()
189 WLOGI("ShowStartingWindow windowId: %{public}u end", node->GetWindowId()); in ShowStartingWindow()
193 WMError WindowNodeContainer::IsTileRectSatisfiedWithSizeLimits(sptr<WindowNode>& node) in IsTileRectSatisfiedWithSizeLimits() argument
196 !layoutPolicy_->IsTileRectSatisfiedWithSizeLimits(node)) { in IsTileRectSatisfiedWithSizeLimits()
198 node->GetWindowId()); in IsTileRectSatisfiedWithSizeLimits()
209 void WindowNodeContainer::LayoutWhenAddWindowNode(sptr<WindowNode>& node, bool afterAnimation) in LayoutWhenAddWindowNode() argument
212 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in LayoutWhenAddWindowNode()
216 node->GetWindowId(), static_cast<uint32_t>(node->stateMachine_.GetCurrentState())); in LayoutWhenAddWindowNode()
217 if (WindowHelper::IsMainWindow(node->GetWindowType()) && in LayoutWhenAddWindowNode()
218 RemoteAnimation::IsRemoteAnimationEnabledAndFirst(node->GetDisplayId()) && in LayoutWhenAddWindowNode()
219 node->stateMachine_.IsShowAnimationPlaying()) { in LayoutWhenAddWindowNode()
221 auto winRect = node->GetWindowRect(); in LayoutWhenAddWindowNode()
222 if (node->surfaceNode_) { in LayoutWhenAddWindowNode()
223 node->surfaceNode_->SetBounds(0, 0, winRect.width_, winRect.height_); in LayoutWhenAddWindowNode()
225 node->GetWindowId(), winRect.posX_, winRect.posY_, winRect.width_, winRect.height_); in LayoutWhenAddWindowNode()
226 … layoutPolicy_->NotifyClientAndAnimation(node, winRect, WindowSizeChangeReason::UNDEFINED); in LayoutWhenAddWindowNode()
229 …if (node->GetWindowProperty()->GetAnimationFlag() == static_cast<uint32_t>(WindowAnimation::CUSTOM… in LayoutWhenAddWindowNode()
230 WindowHelper::IsSystemWindow(node->GetWindowType())) { in LayoutWhenAddWindowNode()
231 node->SetWindowSizeChangeReason(WindowSizeChangeReason::CUSTOM_ANIMATION_SHOW); in LayoutWhenAddWindowNode()
233 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in LayoutWhenAddWindowNode()
237 WMError WindowNodeContainer::AddWindowNode(sptr<WindowNode>& node, sptr<WindowNode>& parentNode, bo… in AddWindowNode() argument
239 if (!node->startingWindowShown_) { // window except main Window in AddWindowNode()
240 WMError res = AddWindowNodeOnWindowTree(node, parentNode); in AddWindowNode()
244 UpdateWindowTree(node); in AddWindowNode()
245 displayGroupController_->PreProcessWindowNode(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in AddWindowNode()
247 for (auto& displayId : node->GetShowingDisplays()) { in AddWindowNode()
248 AddNodeOnRSTree(node, displayId, displayId, WindowUpdateType::WINDOW_UPDATE_ADDED, in AddWindowNode()
249 node->isPlayAnimationShow_); in AddWindowNode()
252 node->isPlayAnimationShow_ = false; in AddWindowNode()
253 node->startingWindowShown_ = false; in AddWindowNode()
254 AddAppSurfaceNodeOnRSTree(node); in AddWindowNode()
255 ReZOrderShowWhenLockedWindowIfNeeded(node); in AddWindowNode()
256 RaiseZOrderForAppWindow(node, parentNode); in AddWindowNode()
258 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in AddWindowNode()
263 windowPair->UpdateIfSplitRelated(node); in AddWindowNode()
264 if (node->IsSplitMode()) { in AddWindowNode()
266 RaiseSplitRelatedWindowToTop(node); in AddWindowNode()
271 MinimizeOldestMainFloatingWindow(node->GetWindowId()); in AddWindowNode()
273 LayoutWhenAddWindowNode(node, afterAnimation); in AddWindowNode()
274 NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_ADD); in AddWindowNode()
275 DumpScreenWindowTreeByWinId(node->GetWindowId()); in AddWindowNode()
276 UpdateCameraFloatWindowStatus(node, true); in AddWindowNode()
277 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in AddWindowNode()
281 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in AddWindowNode()
283 SetBelowScreenlockVisible(node, false); in AddWindowNode()
285 if (node->GetWindowType() == WindowType::WINDOW_TYPE_WALLPAPER) { in AddWindowNode()
286 RemoteAnimation::NotifyAnimationUpdateWallpaper(node); in AddWindowNode()
288 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) { in AddWindowNode()
291 WLOGI("AddWindowNode Id: %{public}u end", node->GetWindowId()); in AddWindowNode()
294 …if (node->GetWindowProperty()->GetPrivacyMode() && !node->GetWindowProperty()->GetOnlySkipSnapshot… in AddWindowNode()
297 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in AddWindowNode()
298 WindowInfoReporter::GetInstance().InsertShowReportInfo(node->abilityInfo_.bundleName_); in AddWindowNode()
303 void WindowNodeContainer::UpdateRSTreeWhenShowingDisplaysChange(sptr<WindowNode>& node, in UpdateRSTreeWhenShowingDisplaysChange() argument
311 auto curShowingDisplays = node->GetShowingDisplays(); in UpdateRSTreeWhenShowingDisplaysChange()
314 RemoveNodeFromRSTree(node, displayId, *(curShowingDisplays.begin()), in UpdateRSTreeWhenShowingDisplaysChange()
322 AddNodeOnRSTree(node, displayId, displayId, WindowUpdateType::WINDOW_UPDATE_ACTIVE); in UpdateRSTreeWhenShowingDisplaysChange()
328 WMError WindowNodeContainer::UpdateWindowNode(sptr<WindowNode>& node, WindowUpdateReason reason) in UpdateWindowNode() argument
331 auto lastShowingDisplays = node->GetShowingDisplays(); in UpdateWindowNode()
334 displayGroupController_->PreProcessWindowNode(node, WindowUpdateType::WINDOW_UPDATE_ACTIVE); in UpdateWindowNode()
335 …if (WindowHelper::IsMainWindow(node->GetWindowType()) && WindowHelper::IsSwitchCascadeReason(reaso… in UpdateWindowNode()
336 SwitchLayoutPolicy(WindowLayoutMode::CASCADE, node->GetDisplayId()); in UpdateWindowNode()
338 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ACTIVE); in UpdateWindowNode()
339 displayGroupController_->PostProcessWindowNode(node); in UpdateWindowNode()
341 UpdateRSTreeWhenShowingDisplaysChange(node, lastShowingDisplays); in UpdateWindowNode()
342 NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_UPDATE); in UpdateWindowNode()
343 WLOGD("UpdateNode Id: %{public}u end", node->GetWindowId()); in UpdateWindowNode()
347 void WindowNodeContainer::RemoveWindowNodeFromWindowTree(sptr<WindowNode>& node) in RemoveWindowNodeFromWindowTree() argument
350 auto iter = std::find(node->parent_->children_.begin(), node->parent_->children_.end(), node); in RemoveWindowNodeFromWindowTree()
351 if (iter != node->parent_->children_.end()) { in RemoveWindowNodeFromWindowTree()
352 node->parent_->children_.erase(iter); in RemoveWindowNodeFromWindowTree()
356 node->parent_ = nullptr; in RemoveWindowNodeFromWindowTree()
359 void WindowNodeContainer::RemoveFromRsTreeWhenRemoveWindowNode(sptr<WindowNode>& node, bool fromAni… in RemoveFromRsTreeWhenRemoveWindowNode() argument
361 if (fromAnimation || (RemoteAnimation::IsRemoteAnimationEnabledAndFirst(node->GetDisplayId()) && in RemoveFromRsTreeWhenRemoveWindowNode()
362 node->stateMachine_.IsHideAnimationPlaying())) { in RemoveFromRsTreeWhenRemoveWindowNode()
363 WLOGFD("not remove from rs tree id:%{public}u", node->GetWindowId()); in RemoveFromRsTreeWhenRemoveWindowNode()
367 WLOGFD("Id:%{public}u, isPlayAnimationHide_:%{public}u", node->GetWindowId(), in RemoveFromRsTreeWhenRemoveWindowNode()
368 static_cast<uint32_t>(node->isPlayAnimationHide_)); in RemoveFromRsTreeWhenRemoveWindowNode()
370 for (auto& displayId : node->GetShowingDisplays()) { in RemoveFromRsTreeWhenRemoveWindowNode()
371 RemoveNodeFromRSTree(node, displayId, displayId, WindowUpdateType::WINDOW_UPDATE_REMOVED, in RemoveFromRsTreeWhenRemoveWindowNode()
372 node->isPlayAnimationHide_); in RemoveFromRsTreeWhenRemoveWindowNode()
376 void WindowNodeContainer::SetSurfaceNodeVisible(sptr<WindowNode>& node, int32_t topPriority, bool v… in SetSurfaceNodeVisible() argument
378 if (node == nullptr) { in SetSurfaceNodeVisible()
381 if (node->parent_ != nullptr && node->currentVisibility_) { in SetSurfaceNodeVisible()
382 … if (node->priority_ < topPriority && !WindowHelper::IsShowWhenLocked(node->GetWindowFlags()) && in SetSurfaceNodeVisible()
383 !WindowHelper::IsShowWhenLocked(node->parent_->GetWindowFlags())) { in SetSurfaceNodeVisible()
384 …auto surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->surf… in SetSurfaceNodeVisible()
390 for (auto& childNode : node->children_) { in SetSurfaceNodeVisible()
395 void WindowNodeContainer::SetBelowScreenlockVisible(sptr<WindowNode>& node, bool visible) in SetBelowScreenlockVisible() argument
399 for (auto& node : rootNodes) { in SetBelowScreenlockVisible() local
400 SetSurfaceNodeVisible(node, topPriority, visible); in SetBelowScreenlockVisible()
404 WMError WindowNodeContainer::RemoveWindowNode(sptr<WindowNode>& node, bool fromAnimation) in RemoveWindowNode() argument
406 if (node == nullptr) { in RemoveWindowNode()
410 if (node->parent_ == nullptr) { in RemoveWindowNode()
413 RemoveWindowNodeFromWindowTree(node); in RemoveWindowNode()
416 node->requestedVisibility_ = false; in RemoveWindowNode()
417 node->currentVisibility_ = false; in RemoveWindowNode()
418 RemoveFromRsTreeWhenRemoveWindowNode(node, fromAnimation); in RemoveWindowNode()
419 node->isPlayAnimationHide_ = false; in RemoveWindowNode()
421 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_REMOVED); in RemoveWindowNode()
422 WindowMode lastMode = node->GetWindowMode(); in RemoveWindowNode()
423 if (HandleRemoveWindow(node) != WMError::WM_OK) { in RemoveWindowNode()
427 NotifyDockWindowStateChanged(node, true); in RemoveWindowNode()
429 NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_REMOVE); in RemoveWindowNode()
430 DumpScreenWindowTreeByWinId(node->GetWindowId()); in RemoveWindowNode()
431 UpdateCameraFloatWindowStatus(node, false); in RemoveWindowNode()
432 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in RemoveWindowNode()
434 SetBelowScreenlockVisible(node, true); in RemoveWindowNode()
436 WLOGI("Remove Id: %{public}u end", node->GetWindowId()); in RemoveWindowNode()
440 …if (node->GetWindowProperty()->GetPrivacyMode() && !node->GetWindowProperty()->GetOnlySkipSnapshot… in RemoveWindowNode()
443 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in RemoveWindowNode()
444 WindowInfoReporter::GetInstance().InsertHideReportInfo(node->abilityInfo_.bundleName_); in RemoveWindowNode()
446 HandleRemoveWindowDisplayOrientation(node, fromAnimation); in RemoveWindowNode()
450 void WindowNodeContainer::HandleRemoveWindowDisplayOrientation(sptr<WindowNode>& node, bool fromAni… in HandleRemoveWindowDisplayOrientation() argument
452 if (node->GetWindowMode() != WindowMode::WINDOW_MODE_FULLSCREEN) { in HandleRemoveWindowDisplayOrientation()
457 auto nextRotatableWindow = GetNextRotatableWindow(node->GetWindowId()); in HandleRemoveWindowDisplayOrientation()
464 if (node->stateMachine_.IsHideAnimationPlaying()) { in HandleRemoveWindowDisplayOrientation()
468 auto nextRotatableWindow = GetNextRotatableWindow(node->GetWindowId()); in HandleRemoveWindowDisplayOrientation()
488 void WindowNodeContainer::SetDisplayOrientationFromWindow(sptr<WindowNode>& node, bool withAnimatio… in SetDisplayOrientationFromWindow() argument
490 DisplayManagerServiceInner::GetInstance().SetOrientationFromWindow(node->GetDisplayId(), in SetDisplayOrientationFromWindow()
491 node->GetRequestedOrientation(), withAnimation); in SetDisplayOrientationFromWindow()
511 for (const auto& node : windowNodes) { in UpdatePrivateWindowCount() local
512 …if (node->GetWindowProperty()->GetPrivacyMode() && !node->GetWindowProperty()->GetOnlySkipSnapshot… in UpdatePrivateWindowCount()
598 for (auto& node : tempWindows) { in ResetAllMainFloatingWindowZOrder() local
599 UpdateWindowTree(node); in ResetAllMainFloatingWindowZOrder()
603 WMError WindowNodeContainer::HandleRemoveWindow(sptr<WindowNode>& node) in HandleRemoveWindow() argument
606 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in HandleRemoveWindow()
611 windowPair->HandleRemoveWindow(node); in HandleRemoveWindow()
613 auto type = node->GetWindowType(); in HandleRemoveWindow()
622 WMError WindowNodeContainer::DestroyWindowNode(sptr<WindowNode>& node, std::vector<uint32_t>& windo… in DestroyWindowNode() argument
624 WMError ret = RemoveWindowNode(node); in DestroyWindowNode()
629 StartingWindow::ReleaseStartWinSurfaceNode(node); in DestroyWindowNode()
630 node->surfaceNode_ = nullptr; in DestroyWindowNode()
631 windowIds.push_back(node->GetWindowId()); in DestroyWindowNode()
632 for (auto& child : node->children_) { // destroy sub window if exists in DestroyWindowNode()
643 node->children_.swap(emptyVector); in DestroyWindowNode()
644 if (node->GetWindowType() == WindowType::WINDOW_TYPE_WALLPAPER) { in DestroyWindowNode()
647 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in DestroyWindowNode()
648 WindowInfoReporter::GetInstance().InsertDestroyReportInfo(node->abilityInfo_.bundleName_); in DestroyWindowNode()
651 UpdateAvoidAreaListener(node, false); in DestroyWindowNode()
652 WLOGI("DestroyNode Id: %{public}u end", node->GetWindowId()); in DestroyWindowNode()
656 void WindowNodeContainer::UpdateSizeChangeReason(sptr<WindowNode>& node, WindowSizeChangeReason rea… in UpdateSizeChangeReason() argument
658 if (!node->GetWindowToken()) { in UpdateSizeChangeReason()
662 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { in UpdateSizeChangeReason()
671 layoutPolicy_->NotifyClientAndAnimation(node, node->GetWindowRect(), reason); in UpdateSizeChangeReason()
673 "reason: %{public}u", node->GetWindowId(), reason); in UpdateSizeChangeReason()
677 void WindowNodeContainer::UpdateWindowTree(sptr<WindowNode>& node) in UpdateWindowTree() argument
680 node->priority_ = zorderPolicy_->GetWindowPriority(node->GetWindowType()); in UpdateWindowTree()
681 RaiseInputMethodWindowPriorityIfNeeded(node); in UpdateWindowTree()
682 RaiseShowWhenLockedWindowIfNeeded(node); in UpdateWindowTree()
683 ResetMainFloatingWindowPriorityIfNeeded(node); in UpdateWindowTree()
684 auto parentNode = node->parent_; in UpdateWindowTree()
686 WLOGI("Current window node has no parent: %{public}u", node->GetWindowId()); in UpdateWindowTree()
689 auto iter = std::find(parentNode->children_.begin(), parentNode->children_.end(), node); in UpdateWindowTree()
691 WLOGI("node %{public}u already on window tree, not update!", node->GetWindowId()); in UpdateWindowTree()
697 …if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE && splitWindowCnt == SPLIT_WINDOWS… in UpdateWindowTree()
704 if ((*child)->priority_ > node->priority_) { in UpdateWindowTree()
709 parentNode->children_.insert(position, node); in UpdateWindowTree()
712 bool WindowNodeContainer::AddAppSurfaceNodeOnRSTree(sptr<WindowNode>& node) in AddAppSurfaceNodeOnRSTree() argument
719 …HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "AddAppSurfaceNodeOnRSTree(%u)", node->GetWindowId()… in AddAppSurfaceNodeOnRSTree()
720 if (!WindowHelper::IsMainWindow(node->GetWindowType())) { in AddAppSurfaceNodeOnRSTree()
721 WLOGFE("id:%{public}u not main app window but has start window", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
724 if (!node->leashWinSurfaceNode_ || !node->surfaceNode_) { in AddAppSurfaceNodeOnRSTree()
725 …%{public}u leashWinSurfaceNode or surfaceNode is null but has start window!", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
728 WLOGI("AddAppSurfaceNodeOnRSTree Id: %{public}d", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
729 if (!node->currentVisibility_) { in AddAppSurfaceNodeOnRSTree()
730 WLOGI("id: %{public}d is invisible, no need update RS tree", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
733 node->leashWinSurfaceNode_->AddChild(node->surfaceNode_, -1); in AddAppSurfaceNodeOnRSTree()
765 bool WindowNodeContainer::AddNodeOnRSTree(sptr<WindowNode>& node, DisplayId displayId, DisplayId pa… in AddNodeOnRSTree() argument
769 …if (node->GetWindowProperty()->GetAnimationFlag() == static_cast<uint32_t>(WindowAnimation::CUSTOM… in AddNodeOnRSTree()
770 node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT) { in AddNodeOnRSTree()
777 node->GetWindowId(), displayId, parentDisplayId, isMultiDisplay, animationPlayed); in AddNodeOnRSTree()
779 if (!node->currentVisibility_) { in AddNodeOnRSTree()
780 WLOGI("id: %{public}d invisible, no need update RS tree", node->GetWindowId()); in AddNodeOnRSTree()
784 if (IsWindowFollowParent(node->GetWindowType())) { in AddNodeOnRSTree()
785 auto& parentNode = node->parent_; in AddNodeOnRSTree()
787 node->surfaceNode_ != nullptr) { in AddNodeOnRSTree()
788 …node->surfaceNode_->SetTranslateX(node->GetWindowRect().posX_ - parentNode->GetWindowRect().posX_); in AddNodeOnRSTree()
789 …node->surfaceNode_->SetTranslateY(node->GetWindowRect().posY_ - parentNode->GetWindowRect().posY_); in AddNodeOnRSTree()
790 node->surfaceNode_->SetVisible(true); in AddNodeOnRSTree()
791 parentNode->surfaceNode_->AddChild(node->surfaceNode_, -1); in AddNodeOnRSTree()
797 …auto& surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->sur… in AddNodeOnRSTree()
799 for (auto& child : node->children_) { in AddNodeOnRSTree()
813 node->GetWindowGravity(windowGravity, percent); in AddNodeOnRSTree()
814 if (node->EnableDefaultAnimation(animationPlayed)) { in AddNodeOnRSTree()
816 StartTraceArgs(HITRACE_TAG_WINDOW_MANAGER, "Animate(%u)", node->GetWindowId()); in AddNodeOnRSTree()
820 } else if (node->GetWindowType() == WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT && in AddNodeOnRSTree()
833 bool WindowNodeContainer::RemoveNodeFromRSTree(sptr<WindowNode>& node, DisplayId displayId, Display… in RemoveNodeFromRSTree() argument
837 …if (node->GetWindowProperty()->GetAnimationFlag() == static_cast<uint32_t>(WindowAnimation::CUSTOM… in RemoveNodeFromRSTree()
838 node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT) { in RemoveNodeFromRSTree()
845 node->GetWindowId(), displayId, isMultiDisplay, parentDisplayId, animationPlayed); in RemoveNodeFromRSTree()
847 if (IsWindowFollowParent(node->GetWindowType())) { in RemoveNodeFromRSTree()
848 const auto& parentNode = node->parent_; in RemoveNodeFromRSTree()
850 node->surfaceNode_ != nullptr) { in RemoveNodeFromRSTree()
851 node->surfaceNode_->SetVisible(false); in RemoveNodeFromRSTree()
852 parentNode->surfaceNode_->RemoveChild(node->surfaceNode_); in RemoveNodeFromRSTree()
858 …auto& surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->sur… in RemoveNodeFromRSTree()
860 for (auto& child : node->children_) { in RemoveNodeFromRSTree()
874 node->GetWindowGravity(windowGravity, percent); in RemoveNodeFromRSTree()
875 if (node->EnableDefaultAnimation(animationPlayed)) { in RemoveNodeFromRSTree()
877 StartTraceArgs(HITRACE_TAG_WINDOW_MANAGER, "Animate(%u)", node->GetWindowId()); in RemoveNodeFromRSTree()
878 if (node->surfaceNode_) { in RemoveNodeFromRSTree()
879 node->surfaceNode_->SetFreeze(true); in RemoveNodeFromRSTree()
881 wptr<WindowNode> weakNode(node); in RemoveNodeFromRSTree()
890 } else if (node->GetWindowType() == WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT && in RemoveNodeFromRSTree()
907 for (auto& node : belowAppWindowNode_->children_) { in Destroy() local
908 DestroyWindowNode(node, removedIds_); in Destroy()
910 for (auto& node : appWindowNode_->children_) { in Destroy() local
911 DestroyWindowNode(node, removedIds_); in Destroy()
913 for (auto& node : aboveAppWindowNode_->children_) { in Destroy() local
914 DestroyWindowNode(node, removedIds_); in Destroy()
939 for (auto& node : rootNode->children_) { in FindWindowNodeById() local
940 if (node->GetWindowId() == id) { in FindWindowNodeById()
941 return node; in FindWindowNodeById()
943 for (auto& subNode : node->children_) { in FindWindowNodeById()
955 auto node = FindWindowNodeById(id); in UpdateFocusStatus() local
956 if (node == nullptr) { in UpdateFocusStatus()
961 focusedPid_ = node->GetCallingPid(); in UpdateFocusStatus()
963 node->isFocused_ = focused; in UpdateFocusStatus()
965 WindowSystemEffect::SetWindowShadow(node); in UpdateFocusStatus()
966 if (node->GetCallingPid() == 0) { in UpdateFocusStatus()
971 if (focused && node->GetWindowProperty() != nullptr) { in UpdateFocusStatus()
972 AbilityInfo info = node->GetWindowProperty()->GetAbilityInfo(); in UpdateFocusStatus()
975 …node->GetWindowProperty()->GetWindowName().c_str(), info.bundleName_.c_str(), info.abilityName_.c_… in UpdateFocusStatus()
976 node->GetCallingPid(), node->GetCallingUid()); in UpdateFocusStatus()
978 if (node->surfaceNode_ == nullptr) { in UpdateFocusStatus()
981 focusNodeId = node->surfaceNode_->GetId(); in UpdateFocusStatus()
984 …{ node->GetCallingPid(), node->GetCallingUid(), info.bundleName_, info.abilityName_, focusNodeId }; in UpdateFocusStatus()
987 if (node->GetWindowToken()) { in UpdateFocusStatus()
988 node->GetWindowToken()->UpdateFocusStatus(focused); in UpdateFocusStatus()
990 if (node->abilityToken_ == nullptr) { in UpdateFocusStatus()
993 …sptr<FocusChangeInfo> focusChangeInfo = new FocusChangeInfo(node->GetWindowId(), node->GetDisplayI… in UpdateFocusStatus()
994 node->GetCallingPid(), node->GetCallingUid(), node->GetWindowType(), node->abilityToken_); in UpdateFocusStatus()
1001 auto node = FindWindowNodeById(id); in UpdateActiveStatus() local
1002 if (node == nullptr) { in UpdateActiveStatus()
1007 activePid_ = node->GetCallingPid(); in UpdateActiveStatus()
1009 if (node->GetWindowToken()) { in UpdateActiveStatus()
1010 node->GetWindowToken()->UpdateActiveStatus(isActive); in UpdateActiveStatus()
1016 auto node = FindWindowNodeById(id); in UpdateBrightness() local
1017 if (node == nullptr) { in UpdateBrightness()
1023 if (!WindowHelper::IsAppWindow(node->GetWindowType())) { in UpdateBrightness()
1027 WLOGI("Brightness: [%{public}f, %{public}f]", GetDisplayBrightness(), node->GetBrightness()); in UpdateBrightness()
1028 … if (std::fabs(node->GetBrightness() - UNDEFINED_BRIGHTNESS) < std::numeric_limits<float>::min()) { in UpdateBrightness()
1029 if (GetDisplayBrightness() != node->GetBrightness()) { in UpdateBrightness()
1036 if (GetDisplayBrightness() != node->GetBrightness()) { in UpdateBrightness()
1037 … WLOGI("adjust brightness with value: %{public}u", ToOverrideBrightness(node->GetBrightness())); in UpdateBrightness()
1039 ToOverrideBrightness(node->GetBrightness())); in UpdateBrightness()
1040 SetDisplayBrightness(node->GetBrightness()); in UpdateBrightness()
1042 SetBrightnessWindow(node->GetWindowId()); in UpdateBrightness()
1049 WindowNodeOperationFunc func = [this](sptr<WindowNode> node) { in AssignZOrder() argument
1050 if (!node->leashWinSurfaceNode_ && !node->surfaceNode_ && !node->startingWinSurfaceNode_) { in AssignZOrder()
1052 WLOGFE("Id: %{public}u has no surface nodes", node->GetWindowId()); in AssignZOrder()
1055 if (node->leashWinSurfaceNode_ != nullptr) { in AssignZOrder()
1057 node->leashWinSurfaceNode_->SetPositionZ(zOrder_); in AssignZOrder()
1060 if (node->surfaceNode_ != nullptr) { in AssignZOrder()
1062 node->surfaceNode_->SetPositionZ(zOrder_); in AssignZOrder()
1063 node->zOrder_ = zOrder_; in AssignZOrder()
1066 if (node->startingWinSurfaceNode_ != nullptr) { in AssignZOrder()
1068 node->startingWinSurfaceNode_->SetPositionZ(zOrder_); in AssignZOrder()
1171 void WindowNodeContainer::HandleKeepScreenOn(const sptr<WindowNode>& node, bool requireLock) in HandleKeepScreenOn() argument
1173 if (requireLock && node->keepScreenLock_ == nullptr) { in HandleKeepScreenOn()
1176 …node->keepScreenLock_ = PowerMgr::PowerMgrClient::GetInstance().CreateRunningLock(node->GetWindowN… in HandleKeepScreenOn()
1181 if (node->keepScreenLock_ == nullptr) { in HandleKeepScreenOn()
1184 WLOGI("keep screen on: [%{public}s, %{public}d]", node->GetWindowName().c_str(), requireLock); in HandleKeepScreenOn()
1186 node->GetWindowName().c_str(), requireLock); in HandleKeepScreenOn()
1191 res = node->keepScreenLock_->Lock(); in HandleKeepScreenOn()
1193 res = node->keepScreenLock_->UnLock(); in HandleKeepScreenOn()
1202 bool WindowNodeContainer::IsAboveSystemBarNode(sptr<WindowNode> node) const in IsAboveSystemBarNode()
1204 int32_t curPriority = zorderPolicy_->GetWindowPriority(node->GetWindowType()); in IsAboveSystemBarNode()
1212 bool WindowNodeContainer::IsSplitImmersiveNode(sptr<WindowNode> node) const in IsSplitImmersiveNode()
1214 auto type = node->GetWindowType(); in IsSplitImmersiveNode()
1215 return node->IsSplitMode() || type == WindowType::WINDOW_TYPE_DOCK_SLICE; in IsSplitImmersiveNode()
1231 for (const auto& node : rootNodes) { in GetExpectImmersiveProperty() local
1232 for (auto iter = node->children_.rbegin(); iter < node->children_.rend(); ++iter) { in GetExpectImmersiveProperty()
1270 void WindowNodeContainer::NotifyIfAvoidAreaChanged(const sptr<WindowNode>& node, in NotifyIfAvoidAreaChanged() argument
1273 auto checkFunc = [this](sptr<WindowNode> node) { in NotifyIfAvoidAreaChanged() argument
1274 return CheckWindowNodeWhetherInWindowTree(node); in NotifyIfAvoidAreaChanged()
1276 avoidController_->ProcessWindowChange(node, avoidType, checkFunc); in NotifyIfAvoidAreaChanged()
1277 if (WindowHelper::IsSystemBarWindow(node->GetWindowType())) { in NotifyIfAvoidAreaChanged()
1278 NotifyIfSystemBarRegionChanged(node->GetDisplayId()); in NotifyIfAvoidAreaChanged()
1280 NotifyIfSystemBarTintChanged(node->GetDisplayId()); in NotifyIfAvoidAreaChanged()
1283 NotifyIfKeyboardRegionChanged(node, avoidType); in NotifyIfAvoidAreaChanged()
1294 auto checkFunc = [this](sptr<WindowNode> node) { in ProcessWindowAvoidAreaChangeWhenDisplayChange() argument
1295 return CheckWindowNodeWhetherInWindowTree(node); in ProcessWindowAvoidAreaChangeWhenDisplayChange()
1297 …wNodeOperationFunc func = [avoidController = avoidController_, &checkFunc](sptr<WindowNode> node) { in ProcessWindowAvoidAreaChangeWhenDisplayChange() argument
1298 avoidController->ProcessWindowChange(node, AvoidControlType::AVOID_NODE_UPDATE, checkFunc); in ProcessWindowAvoidAreaChangeWhenDisplayChange()
1370 void WindowNodeContainer::NotifyIfKeyboardRegionChanged(const sptr<WindowNode>& node, in NotifyIfKeyboardRegionChanged() argument
1375 node->GetWindowGravity(windowGravity, percent); in NotifyIfKeyboardRegionChanged()
1376 if (node->GetWindowType() != WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT || in NotifyIfKeyboardRegionChanged()
1378 WLOGFD("windowType: %{public}u", node->GetWindowType()); in NotifyIfKeyboardRegionChanged()
1382 auto callingWindow = FindWindowNodeById(node->GetCallingWindow()); in NotifyIfKeyboardRegionChanged()
1384 WLOGD("callingWindow: %{public}u does not be set", node->GetCallingWindow()); in NotifyIfKeyboardRegionChanged()
1395 const Rect keyRect = node->GetWindowRect(); in NotifyIfKeyboardRegionChanged()
1450 void WindowNodeContainer::NotifyDockWindowStateChanged(sptr<WindowNode>& node, bool isEnable) in NotifyDockWindowStateChanged() argument
1456 if (windowNode->GetWindowId() == node->GetWindowId()) { in NotifyDockWindowStateChanged()
1471 …WindowManagerAgentController::GetInstance().UpdateSystemBarRegionTints(node->GetDisplayId(), tints… in NotifyDockWindowStateChanged()
1507 auto node = *(rootNode->children_.rbegin()); in IsTopWindow() local
1508 if (node == nullptr) { in IsTopWindow()
1513 for (auto iter = node->children_.rbegin(); iter < node->children_.rend(); iter++) { in IsTopWindow()
1520 return node->GetWindowId() == windowId; in IsTopWindow()
1549 [windowId](sptr<WindowNode> node) { in RaiseWindowToTop() argument
1550 return node->GetWindowId() == windowId; in RaiseWindowToTop()
1554 sptr<WindowNode> node = *iter; in RaiseWindowToTop() local
1556 UpdateWindowTree(node); in RaiseWindowToTop()
1557 WLOGD("raise window to top %{public}u", node->GetWindowId()); in RaiseWindowToTop()
1563 for (auto& node : belowAppWindowNode_->children_) { in TraverseContainer() local
1564 TraverseWindowNode(node, windowNodes); in TraverseContainer()
1566 for (auto& node : appWindowNode_->children_) { in TraverseContainer() local
1567 TraverseWindowNode(node, windowNodes); in TraverseContainer()
1569 for (auto& node : aboveAppWindowNode_->children_) { in TraverseContainer() local
1570 TraverseWindowNode(node, windowNodes); in TraverseContainer()
1575 void WindowNodeContainer::TraverseWindowNode(sptr<WindowNode>& node, std::vector<sptr<WindowNode>>&… in TraverseWindowNode() argument
1577 if (node == nullptr) { in TraverseWindowNode()
1580 auto iter = node->children_.begin(); in TraverseWindowNode()
1581 for (; iter < node->children_.end(); ++iter) { in TraverseWindowNode()
1588 windowNodes.emplace_back(node); in TraverseWindowNode()
1589 for (; iter < node->children_.end(); ++iter) { in TraverseWindowNode()
1594 AvoidArea WindowNodeContainer::GetAvoidAreaByType(const sptr<WindowNode>& node, AvoidAreaType avoid… in GetAvoidAreaByType() argument
1596 if (CheckWindowNodeWhetherInWindowTree(node)) { in GetAvoidAreaByType()
1597 return avoidController_->GetAvoidAreaByType(node, avoidAreaType); in GetAvoidAreaByType()
1602 bool WindowNodeContainer::CheckWindowNodeWhetherInWindowTree(const sptr<WindowNode>& node) const in CheckWindowNodeWhetherInWindowTree()
1605 WindowNodeOperationFunc func = [&node, &isInWindowTree](sptr<WindowNode> windowNode) { in CheckWindowNodeWhetherInWindowTree()
1606 if (node->GetWindowId() == windowNode->GetWindowId()) { in CheckWindowNodeWhetherInWindowTree()
1621 WindowNodeOperationFunc func = [&zOrder, &winid](sptr<WindowNode> node) { in DumpScreenWindowTreeByWinId() argument
1622 Rect rect = node->GetWindowRect(); in DumpScreenWindowTreeByWinId()
1623 uint32_t windowId = node->GetWindowId(); in DumpScreenWindowTreeByWinId()
1624 const std::string& windowName = node->GetWindowName().size() < WINDOW_NAME_MAX_LENGTH ? in DumpScreenWindowTreeByWinId()
1625 node->GetWindowName() : node->GetWindowName().substr(0, WINDOW_NAME_MAX_LENGTH); in DumpScreenWindowTreeByWinId()
1629 … windowName.c_str(), node->GetWindowId(), node->GetWindowType(), node->GetWindowMode(), in DumpScreenWindowTreeByWinId()
1634 … windowName.c_str(), node->GetWindowId(), node->GetWindowType(), node->GetWindowMode(), in DumpScreenWindowTreeByWinId()
1648 WindowNodeOperationFunc func = [&zOrder](sptr<WindowNode> node) { in DumpScreenWindowTree() argument
1649 Rect rect = node->GetWindowRect(); in DumpScreenWindowTree()
1650 const std::string& windowName = node->GetWindowName().size() < WINDOW_NAME_MAX_LENGTH ? in DumpScreenWindowTree()
1651 node->GetWindowName() : node->GetWindowName().substr(0, WINDOW_NAME_MAX_LENGTH); in DumpScreenWindowTree()
1654 …windowName.c_str(), node->GetDisplayId(), node->GetWindowId(), node->GetWindowType(), node->GetWin… in DumpScreenWindowTree()
1655 … node->GetWindowFlags(), --zOrder, static_cast<uint32_t>(node->GetRequestedOrientation()), in DumpScreenWindowTree()
1656 node->firstFrameAvailable_, rect.posX_, rect.posY_, rect.width_, rect.height_); in DumpScreenWindowTree()
1685 for (auto& node : rootNodes) { in TraverseAndUpdateWindowState() local
1686 UpdateWindowState(node, topPriority, state); in TraverseAndUpdateWindowState()
1690 void WindowNodeContainer::UpdateWindowState(sptr<WindowNode> node, int32_t topPriority, WindowState… in UpdateWindowState() argument
1692 if (node == nullptr) { in UpdateWindowState()
1695 if (node->parent_ != nullptr && node->currentVisibility_) { in UpdateWindowState()
1696 … if (node->priority_ < topPriority && !WindowHelper::IsShowWhenLocked(node->GetWindowFlags()) && in UpdateWindowState()
1697 !WindowHelper::IsShowWhenLocked(node->parent_->GetWindowFlags())) { in UpdateWindowState()
1698 if (node->GetWindowToken()) { in UpdateWindowState()
1699 node->GetWindowToken()->UpdateWindowState(state); in UpdateWindowState()
1701 HandleKeepScreenOn(node, state); in UpdateWindowState()
1704 for (auto& childNode : node->children_) { in UpdateWindowState()
1709 void WindowNodeContainer::HandleKeepScreenOn(const sptr<WindowNode>& node, WindowState state) in HandleKeepScreenOn() argument
1711 if (node == nullptr) { in HandleKeepScreenOn()
1716 HandleKeepScreenOn(node, false); in HandleKeepScreenOn()
1718 HandleKeepScreenOn(node, node->IsKeepScreenOn()); in HandleKeepScreenOn()
1734 void WindowNodeContainer::RaiseSplitRelatedWindowToTop(sptr<WindowNode>& node) in RaiseSplitRelatedWindowToTop() argument
1736 if (node == nullptr) { in RaiseSplitRelatedWindowToTop()
1739 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in RaiseSplitRelatedWindowToTop()
1744 std::vector<sptr<WindowNode>> orderedPair = windowPair->GetOrderedPair(node); in RaiseSplitRelatedWindowToTop()
1750 WMError WindowNodeContainer::RaiseZOrderForAppWindow(sptr<WindowNode>& node, sptr<WindowNode>& pare… in RaiseZOrderForAppWindow() argument
1752 if (node == nullptr) { in RaiseZOrderForAppWindow()
1755 …if (IsTopWindow(node->GetWindowId(), appWindowNode_) || IsTopWindow(node->GetWindowId(), aboveAppW… in RaiseZOrderForAppWindow()
1756 WLOGE("Window %{public}u is already at top", node->GetWindowId()); in RaiseZOrderForAppWindow()
1760 if (WindowHelper::IsSubWindow(node->GetWindowType()) || in RaiseZOrderForAppWindow()
1761 (node->GetWindowType() == WindowType::WINDOW_TYPE_DIALOG)) { in RaiseZOrderForAppWindow()
1766 RaiseWindowToTop(node->GetWindowId(), parentNode->children_); // raise itself in RaiseZOrderForAppWindow()
1772 } else if (WindowHelper::IsMainWindow(node->GetWindowType())) { in RaiseZOrderForAppWindow()
1773 if (node->IsSplitMode()) { in RaiseZOrderForAppWindow()
1774 RaiseSplitRelatedWindowToTop(node); in RaiseZOrderForAppWindow()
1777 if (node->parent_ == nullptr) { in RaiseZOrderForAppWindow()
1781 RaiseWindowToTop(node->GetWindowId(), node->parent_->children_); in RaiseZOrderForAppWindow()
1789 DumpScreenWindowTreeByWinId(node->GetWindowId()); in RaiseZOrderForAppWindow()
1798 sptr<WindowNode> node) { in GetNextFocusableWindow() argument
1799 …if (previousFocusedWindowFound && node->GetWindowProperty()->GetFocusable() && node->currentVisibi… in GetNextFocusableWindow()
1800 nextFocusableWindow = node; in GetNextFocusableWindow()
1803 if (node->GetWindowId() == windowId) { in GetNextFocusableWindow()
1816 sptr<WindowNode> node) { in GetNextRotatableWindow() argument
1817 if (windowId != node->GetWindowId() && in GetNextRotatableWindow()
1818 WindowHelper::IsRotatableWindow(node->GetWindowType(), node->GetWindowMode())) { in GetNextRotatableWindow()
1819 nextRotatableWindow = node; in GetNextRotatableWindow()
1837 for (auto& node : appWindowNode_->children_) { in GetNextActiveWindow() local
1838 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { in GetNextActiveWindow()
1841 return node; in GetNextActiveWindow()
1843 for (auto& node : belowAppWindowNode_->children_) { in GetNextActiveWindow() local
1844 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) { in GetNextActiveWindow()
1845 return node; in GetNextActiveWindow()
1851 …to iter = std::find_if(windowNodes.begin(), windowNodes.end(), [windowId](sptr<WindowNode>& node) { in GetNextActiveWindow() argument
1852 return node->GetWindowId() == windowId; in GetNextActiveWindow()
1923 WindowNodeOperationFunc findDeskTopFunc = [this, &deskTop](sptr<WindowNode> node) { in GetDeskTopWindow() argument
1924 if (node->GetWindowProperty()->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) { in GetDeskTopWindow()
1925 deskTop = node; in GetDeskTopWindow()
1938 for (const auto& node : windowNodes) { in HasPrivateWindow() local
1939 if (node->isVisible_ && node->GetWindowProperty()->GetPrivacyMode() && in HasPrivateWindow()
1940 !node->GetWindowProperty()->GetOnlySkipSnapshot()) { in HasPrivateWindow()
1941 WLOGI("window name %{public}s", node->GetWindowName().c_str()); in HasPrivateWindow()
1951 for (auto& node : appWindowNode_->children_) { in HasMainFullScreenWindowShown() local
1952 TraverseWindowNode(node, windowNodes); in HasMainFullScreenWindowShown()
1954 for (const auto& node : windowNodes) { in HasMainFullScreenWindowShown() local
1955 if (node->currentVisibility_ && in HasMainFullScreenWindowShown()
1956 WindowHelper::IsMainFullScreenWindow(node->GetWindowType(), node->GetWindowMode())) { in HasMainFullScreenWindowShown()
2012 for (auto node : aboveAppWindowNode_->children_) { in ToggleShownStateForAllAppWindows() local
2013 if (node->GetWindowType() == WindowType::WINDOW_TYPE_LAUNCHER_RECENT && in ToggleShownStateForAllAppWindows()
2014 node->GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN && restore) { in ToggleShownStateForAllAppWindows()
2141 WMError WindowNodeContainer::MinimizeStructuredAppWindowsExceptSelf(const sptr<WindowNode>& node) in MinimizeStructuredAppWindowsExceptSelf() argument
2143 std::vector<uint32_t> exceptionalIds = { node->GetWindowId() }; in MinimizeStructuredAppWindowsExceptSelf()
2182 void WindowNodeContainer::UpdateModeSupportInfoWhenKeyguardChange(const sptr<WindowNode>& node, boo… in UpdateModeSupportInfoWhenKeyguardChange() argument
2184 if (!WindowHelper::IsWindowModeSupported(node->GetWindowProperty()->GetRequestModeSupportInfo(), in UpdateModeSupportInfoWhenKeyguardChange()
2186 WLOGFD("window doesn't support split mode, winId: %{public}d", node->GetWindowId()); in UpdateModeSupportInfoWhenKeyguardChange()
2191 …modeSupportInfo = node->GetModeSupportInfo() & (~WindowModeSupport::WINDOW_MODE_SUPPORT_SPLIT_PRIM… in UpdateModeSupportInfoWhenKeyguardChange()
2193 …modeSupportInfo = node->GetModeSupportInfo() | WindowModeSupport::WINDOW_MODE_SUPPORT_SPLIT_PRIMAR… in UpdateModeSupportInfoWhenKeyguardChange()
2195 node->SetModeSupportInfo(modeSupportInfo); in UpdateModeSupportInfoWhenKeyguardChange()
2196 if (node->GetWindowToken() != nullptr) { in UpdateModeSupportInfoWhenKeyguardChange()
2197 node->GetWindowToken()->UpdateWindowModeSupportInfo(modeSupportInfo); in UpdateModeSupportInfoWhenKeyguardChange()
2201 void WindowNodeContainer::RaiseInputMethodWindowPriorityIfNeeded(const sptr<WindowNode>& node) const in RaiseInputMethodWindowPriorityIfNeeded()
2203 if (node->GetWindowType() != WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT) { in RaiseInputMethodWindowPriorityIfNeeded()
2208 node->priority_ = zorderPolicy_->GetWindowPriority( in RaiseInputMethodWindowPriorityIfNeeded()
2214 auto callingWindowId = node->GetCallingWindow(); in RaiseInputMethodWindowPriorityIfNeeded()
2221 node->priority_ = (inputMethodPriority < callingWindowPriority) ? in RaiseInputMethodWindowPriorityIfNeeded()
2223 WLOGFD("Reset input method float window priority to %{public}d.", node->priority_); in RaiseInputMethodWindowPriorityIfNeeded()
2229 node->priority_ = zorderPolicy_->GetWindowPriority(WindowType::WINDOW_TYPE_PANEL) + 1; in RaiseInputMethodWindowPriorityIfNeeded()
2290 void WindowNodeContainer::ReZOrderShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node) in ReZOrderShowWhenLockedWindowIfNeeded() argument
2292 … if (!(node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED)) || in ReZOrderShowWhenLockedWindowIfNeeded()
2298 WLOGI("ShowWhenLocked window %{public}u re-zorder to up", node->GetWindowId()); in ReZOrderShowWhenLockedWindowIfNeeded()
2301 void WindowNodeContainer::RaiseShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node) in RaiseShowWhenLockedWindowIfNeeded() argument
2304 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in RaiseShowWhenLockedWindowIfNeeded()
2310 … if (!(node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED)) || in RaiseShowWhenLockedWindowIfNeeded()
2315 node->priority_ = zorderPolicy_->GetWindowPriority(WindowType::WINDOW_TYPE_KEYGUARD) + 1; in RaiseShowWhenLockedWindowIfNeeded()
2316 node->parent_ = aboveAppWindowNode_; in RaiseShowWhenLockedWindowIfNeeded()
2317 if (WindowHelper::IsSplitWindowMode(node->GetWindowMode())) { in RaiseShowWhenLockedWindowIfNeeded()
2318 node->GetWindowProperty()->ResumeLastWindowMode(); in RaiseShowWhenLockedWindowIfNeeded()
2320 WindowSystemEffect::SetWindowEffect(node); in RaiseShowWhenLockedWindowIfNeeded()
2321 if (node->GetWindowToken() != nullptr) { in RaiseShowWhenLockedWindowIfNeeded()
2322 node->GetWindowToken()->UpdateWindowMode(node->GetWindowMode()); in RaiseShowWhenLockedWindowIfNeeded()
2325 WLOGI("ShowWhenLocked window %{public}u raise itself", node->GetWindowId()); in RaiseShowWhenLockedWindowIfNeeded()
2328 void WindowNodeContainer::DropShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node) in DropShowWhenLockedWindowIfNeeded() argument
2331 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in DropShowWhenLockedWindowIfNeeded()
2344 for (const auto& node : rootNodes) { in TraverseWindowTree() local
2346 for (auto iter = node->children_.rbegin(); iter != node->children_.rend(); ++iter) { in TraverseWindowTree()
2352 for (auto iter = node->children_.begin(); iter != node->children_.end(); ++iter) { in TraverseWindowTree()
2361 bool WindowNodeContainer::TraverseFromTopToBottom(sptr<WindowNode> node, const WindowNodeOperationF… in TraverseFromTopToBottom() argument
2363 if (node == nullptr) { in TraverseFromTopToBottom()
2366 auto iterBegin = node->children_.rbegin(); in TraverseFromTopToBottom()
2367 for (; iterBegin != node->children_.rend(); ++iterBegin) { in TraverseFromTopToBottom()
2375 if (func(node)) { in TraverseFromTopToBottom()
2378 for (; iterBegin != node->children_.rend(); ++iterBegin) { in TraverseFromTopToBottom()
2386 bool WindowNodeContainer::TraverseFromBottomToTop(sptr<WindowNode> node, const WindowNodeOperationF… in TraverseFromBottomToTop() argument
2388 if (node == nullptr) { in TraverseFromBottomToTop()
2391 auto iterBegin = node->children_.begin(); in TraverseFromBottomToTop()
2392 for (; iterBegin != node->children_.end(); ++iterBegin) { in TraverseFromBottomToTop()
2400 if (func(node)) { in TraverseFromBottomToTop()
2403 for (; iterBegin != node->children_.end(); ++iterBegin) { in TraverseFromBottomToTop()
2416 void WindowNodeContainer::UpdateSizeChangeReason(sptr<WindowNode>& node, WindowMode srcMode, Window… in UpdateSizeChangeReason() argument
2419 node->SetWindowSizeChangeReason(WindowSizeChangeReason::RECOVER); in UpdateSizeChangeReason()
2421 node->SetWindowSizeChangeReason(WindowSizeChangeReason::MAXIMIZE); in UpdateSizeChangeReason()
2423 node->SetRequestRect(node->GetWindowRect()); in UpdateSizeChangeReason()
2426 node->SetWindowSizeChangeReason(WindowSizeChangeReason::FULL_TO_SPLIT); in UpdateSizeChangeReason()
2428 node->SetWindowSizeChangeReason(WindowSizeChangeReason::SPLIT_TO_FULL); in UpdateSizeChangeReason()
2430 node->SetWindowSizeChangeReason(WindowSizeChangeReason::RESIZE); in UpdateSizeChangeReason()
2434 WMError WindowNodeContainer::SetWindowMode(sptr<WindowNode>& node, WindowMode dstMode) in SetWindowMode() argument
2436 if (node == nullptr) { in SetWindowMode()
2440 WindowMode srcMode = node->GetWindowMode(); in SetWindowMode()
2442 … (node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED))) { in SetWindowMode()
2446 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in SetWindowMode()
2454 if (node->IsSplitMode() && (status == WindowPairStatus::SINGLE_PRIMARY || in SetWindowMode()
2459 UpdateSizeChangeReason(node, srcMode, dstMode); in SetWindowMode()
2460 node->SetWindowMode(dstMode); in SetWindowMode()
2461 windowPair->UpdateIfSplitRelated(node); in SetWindowMode()
2463 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in SetWindowMode()
2464 if (WindowHelper::IsFloatingWindow(node->GetWindowMode())) { in SetWindowMode()
2465 NotifyDockWindowStateChanged(node, true); in SetWindowMode()
2467 NotifyDockWindowStateChanged(node, false); in SetWindowMode()
2471 if (node->GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN && in SetWindowMode()
2472 WindowHelper::IsAppWindow(node->GetWindowType())) { in SetWindowMode()
2474 res = MinimizeStructuredAppWindowsExceptSelf(node); in SetWindowMode()
2480 WindowSystemEffect::SetWindowEffect(node); in SetWindowMode()
2483 ResetWindowZOrderPriorityWhenSetMode(node, dstMode, srcMode); in SetWindowMode()
2484 MinimizeOldestMainFloatingWindow(node->GetWindowId()); in SetWindowMode()
2486 if (node->GetWindowToken() != nullptr) { in SetWindowMode()
2487 node->GetWindowToken()->UpdateWindowMode(node->GetWindowMode()); in SetWindowMode()
2489 res = UpdateWindowNode(node, WindowUpdateReason::UPDATE_MODE); in SetWindowMode()
2497 void WindowNodeContainer::ResetWindowZOrderPriorityWhenSetMode(sptr<WindowNode>& node, in ResetWindowZOrderPriorityWhenSetMode() argument
2505 if (WindowHelper::IsMainFloatingWindow(node->GetWindowType(), srcMode)) { in ResetWindowZOrderPriorityWhenSetMode()
2506 auto basePriority = zorderPolicy_->GetWindowPriority(node->GetWindowType()); in ResetWindowZOrderPriorityWhenSetMode()
2508 … (node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED))) { in ResetWindowZOrderPriorityWhenSetMode()
2511 node->priority_ = basePriority; in ResetWindowZOrderPriorityWhenSetMode()
2514 if (!WindowHelper::IsMainFloatingWindow(node->GetWindowType(), srcMode) && in ResetWindowZOrderPriorityWhenSetMode()
2515 !WindowHelper::IsMainFloatingWindow(node->GetWindowType(), dstMode) && in ResetWindowZOrderPriorityWhenSetMode()
2522 ResetAllMainFloatingWindowZOrder(node->parent_); in ResetWindowZOrderPriorityWhenSetMode()
2523 if (node->parent_ != nullptr && node->GetWindowId() == focusedWindow_ && in ResetWindowZOrderPriorityWhenSetMode()
2524 WindowHelper::IsMainFloatingWindow(node->GetWindowType(), dstMode)) { in ResetWindowZOrderPriorityWhenSetMode()
2526 RaiseWindowToTop(node->GetWindowId(), node->parent_->children_); in ResetWindowZOrderPriorityWhenSetMode()
2547 void WindowNodeContainer::UpdateCameraFloatWindowStatus(const sptr<WindowNode>& node, bool isShowin… in UpdateCameraFloatWindowStatus() argument
2549 if (node->GetWindowType() == WindowType::WINDOW_TYPE_FLOAT_CAMERA) { in UpdateCameraFloatWindowStatus()
2550 …WindowManagerAgentController::GetInstance().UpdateCameraFloatWindowStatus(node->GetAccessTokenId()… in UpdateCameraFloatWindowStatus()