Lines Matching refs:node

136 WMError WindowNodeContainer::AddWindowNodeOnWindowTree(sptr<WindowNode>& node, const sptr<WindowNod…  in AddWindowNodeOnWindowTree()  argument
138 sptr<WindowNode> root = FindRoot(node->GetWindowType()); in AddWindowNodeOnWindowTree()
139 if (root == nullptr && !(WindowHelper::IsSystemSubWindow(node->GetWindowType()) && in AddWindowNodeOnWindowTree()
144 node->requestedVisibility_ = true; in AddWindowNodeOnWindowTree()
146 if (WindowHelper::IsSystemSubWindow(node->GetWindowType()) || in AddWindowNodeOnWindowTree()
147 node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT) { in AddWindowNodeOnWindowTree()
165 node->currentVisibility_ = parentNode->currentVisibility_; in AddWindowNodeOnWindowTree()
166 node->parent_ = parentNode; in AddWindowNodeOnWindowTree()
168 node->parent_ = root; in AddWindowNodeOnWindowTree()
169 node->currentVisibility_ = true; in AddWindowNodeOnWindowTree()
170 for (auto& child : node->children_) { in AddWindowNodeOnWindowTree()
173 if (WindowHelper::IsSystemBarWindow(node->GetWindowType())) { in AddWindowNodeOnWindowTree()
174 … displayGroupController_->sysBarNodeMaps_[node->GetDisplayId()][node->GetWindowType()] = node; in AddWindowNodeOnWindowTree()
180 WMError WindowNodeContainer::ShowStartingWindow(sptr<WindowNode>& node) in ShowStartingWindow() argument
182 if (node->currentVisibility_) { in ShowStartingWindow()
183 WLOGFE("current window is visible, windowId: %{public}u", node->GetWindowId()); in ShowStartingWindow()
187 WMError res = AddWindowNodeOnWindowTree(node, nullptr); in ShowStartingWindow()
191 UpdateWindowTree(node); in ShowStartingWindow()
192 displayGroupController_->PreProcessWindowNode(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in ShowStartingWindow()
193 StartingWindow::AddNodeOnRSTree(node, layoutPolicy_->IsMultiDisplay()); in ShowStartingWindow()
195 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in ShowStartingWindow()
196 WLOGI("ShowStartingWindow windowId: %{public}u end", node->GetWindowId()); in ShowStartingWindow()
200 WMError WindowNodeContainer::IsTileRectSatisfiedWithSizeLimits(sptr<WindowNode>& node) in IsTileRectSatisfiedWithSizeLimits() argument
203 !layoutPolicy_->IsTileRectSatisfiedWithSizeLimits(node)) { in IsTileRectSatisfiedWithSizeLimits()
205 node->GetWindowId()); in IsTileRectSatisfiedWithSizeLimits()
216 void WindowNodeContainer::LayoutWhenAddWindowNode(sptr<WindowNode>& node, bool afterAnimation) in LayoutWhenAddWindowNode() argument
219 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in LayoutWhenAddWindowNode()
223 node->GetWindowId(), static_cast<uint32_t>(node->stateMachine_.GetCurrentState())); in LayoutWhenAddWindowNode()
224 if (WindowHelper::IsMainWindow(node->GetWindowType()) && in LayoutWhenAddWindowNode()
225 RemoteAnimation::IsRemoteAnimationEnabledAndFirst(node->GetDisplayId()) && in LayoutWhenAddWindowNode()
226 node->stateMachine_.IsShowAnimationPlaying()) { in LayoutWhenAddWindowNode()
228 auto winRect = node->GetWindowRect(); in LayoutWhenAddWindowNode()
229 if (node->surfaceNode_) { in LayoutWhenAddWindowNode()
230 node->surfaceNode_->SetBounds(0, 0, winRect.width_, winRect.height_); in LayoutWhenAddWindowNode()
232 node->GetWindowId(), winRect.posX_, winRect.posY_, winRect.width_, winRect.height_); in LayoutWhenAddWindowNode()
233 … layoutPolicy_->NotifyClientAndAnimation(node, winRect, WindowSizeChangeReason::UNDEFINED); in LayoutWhenAddWindowNode()
236 …if (node->GetWindowProperty()->GetAnimationFlag() == static_cast<uint32_t>(WindowAnimation::CUSTOM… in LayoutWhenAddWindowNode()
237 WindowHelper::IsSystemWindow(node->GetWindowType())) { in LayoutWhenAddWindowNode()
238 node->SetWindowSizeChangeReason(WindowSizeChangeReason::CUSTOM_ANIMATION_SHOW); in LayoutWhenAddWindowNode()
240 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in LayoutWhenAddWindowNode()
244 WMError WindowNodeContainer::AddWindowNode(sptr<WindowNode>& node, sptr<WindowNode>& parentNode, bo… in AddWindowNode() argument
246 if (!node->startingWindowShown_) { // window except main Window in AddWindowNode()
247 WMError res = AddWindowNodeOnWindowTree(node, parentNode); in AddWindowNode()
251 UpdateWindowTree(node); in AddWindowNode()
252 displayGroupController_->PreProcessWindowNode(node, WindowUpdateType::WINDOW_UPDATE_ADDED); in AddWindowNode()
254 for (auto& displayId : node->GetShowingDisplays()) { in AddWindowNode()
255 AddNodeOnRSTree(node, displayId, displayId, WindowUpdateType::WINDOW_UPDATE_ADDED, in AddWindowNode()
256 node->isPlayAnimationShow_); in AddWindowNode()
259 node->isPlayAnimationShow_ = false; in AddWindowNode()
260 node->startingWindowShown_ = false; in AddWindowNode()
261 AddAppSurfaceNodeOnRSTree(node); in AddWindowNode()
262 ReZOrderShowWhenLockedWindowIfNeeded(node); in AddWindowNode()
263 RaiseZOrderForAppWindow(node, parentNode); in AddWindowNode()
265 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in AddWindowNode()
270 windowPair->UpdateIfSplitRelated(node); in AddWindowNode()
271 if (node->IsSplitMode()) { in AddWindowNode()
273 RaiseSplitRelatedWindowToTop(node); in AddWindowNode()
278 MinimizeOldestMainFloatingWindow(node->GetWindowId()); in AddWindowNode()
280 LayoutWhenAddWindowNode(node, afterAnimation); in AddWindowNode()
281 NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_ADD); in AddWindowNode()
282 DumpScreenWindowTreeByWinId(node->GetWindowId()); in AddWindowNode()
283 UpdateCameraFloatWindowStatus(node, true); in AddWindowNode()
284 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in AddWindowNode()
288 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in AddWindowNode()
290 SetBelowScreenlockVisible(node, false); in AddWindowNode()
292 if (node->GetWindowType() == WindowType::WINDOW_TYPE_WALLPAPER) { in AddWindowNode()
293 RemoteAnimation::NotifyAnimationUpdateWallpaper(node); in AddWindowNode()
295 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) { in AddWindowNode()
298 WLOGI("AddWindowNode Id: %{public}u end", node->GetWindowId()); in AddWindowNode()
301 if (node->GetWindowProperty()->GetPrivacyMode()) { in AddWindowNode()
304 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in AddWindowNode()
305 WindowInfoReporter::GetInstance().InsertShowReportInfo(node->abilityInfo_.bundleName_); in AddWindowNode()
310 void WindowNodeContainer::UpdateRSTreeWhenShowingDisplaysChange(sptr<WindowNode>& node, in UpdateRSTreeWhenShowingDisplaysChange() argument
318 auto curShowingDisplays = node->GetShowingDisplays(); in UpdateRSTreeWhenShowingDisplaysChange()
321 RemoveNodeFromRSTree(node, displayId, *(curShowingDisplays.begin()), in UpdateRSTreeWhenShowingDisplaysChange()
329 AddNodeOnRSTree(node, displayId, displayId, WindowUpdateType::WINDOW_UPDATE_ACTIVE); in UpdateRSTreeWhenShowingDisplaysChange()
335 WMError WindowNodeContainer::UpdateWindowNode(sptr<WindowNode>& node, WindowUpdateReason reason) in UpdateWindowNode() argument
338 auto lastShowingDisplays = node->GetShowingDisplays(); in UpdateWindowNode()
341 displayGroupController_->PreProcessWindowNode(node, WindowUpdateType::WINDOW_UPDATE_ACTIVE); in UpdateWindowNode()
342 …if (WindowHelper::IsMainWindow(node->GetWindowType()) && WindowHelper::IsSwitchCascadeReason(reaso… in UpdateWindowNode()
343 SwitchLayoutPolicy(WindowLayoutMode::CASCADE, node->GetDisplayId()); in UpdateWindowNode()
345 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_ACTIVE); in UpdateWindowNode()
346 displayGroupController_->PostProcessWindowNode(node); in UpdateWindowNode()
348 UpdateRSTreeWhenShowingDisplaysChange(node, lastShowingDisplays); in UpdateWindowNode()
349 NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_UPDATE); in UpdateWindowNode()
350 WLOGD("UpdateNode Id: %{public}u end", node->GetWindowId()); in UpdateWindowNode()
354 void WindowNodeContainer::RemoveWindowNodeFromWindowTree(sptr<WindowNode>& node) in RemoveWindowNodeFromWindowTree() argument
357 auto iter = std::find(node->parent_->children_.begin(), node->parent_->children_.end(), node); in RemoveWindowNodeFromWindowTree()
358 if (iter != node->parent_->children_.end()) { in RemoveWindowNodeFromWindowTree()
359 node->parent_->children_.erase(iter); in RemoveWindowNodeFromWindowTree()
363 node->parent_ = nullptr; in RemoveWindowNodeFromWindowTree()
366 void WindowNodeContainer::RemoveFromRsTreeWhenRemoveWindowNode(sptr<WindowNode>& node, bool fromAni… in RemoveFromRsTreeWhenRemoveWindowNode() argument
368 if (fromAnimation || (RemoteAnimation::IsRemoteAnimationEnabledAndFirst(node->GetDisplayId()) && in RemoveFromRsTreeWhenRemoveWindowNode()
369 node->stateMachine_.IsHideAnimationPlaying())) { in RemoveFromRsTreeWhenRemoveWindowNode()
370 WLOGFD("not remove from rs tree id:%{public}u", node->GetWindowId()); in RemoveFromRsTreeWhenRemoveWindowNode()
374 WLOGFD("Id:%{public}u, isPlayAnimationHide_:%{public}u", node->GetWindowId(), in RemoveFromRsTreeWhenRemoveWindowNode()
375 static_cast<uint32_t>(node->isPlayAnimationHide_)); in RemoveFromRsTreeWhenRemoveWindowNode()
377 for (auto& displayId : node->GetShowingDisplays()) { in RemoveFromRsTreeWhenRemoveWindowNode()
378 RemoveNodeFromRSTree(node, displayId, displayId, WindowUpdateType::WINDOW_UPDATE_REMOVED, in RemoveFromRsTreeWhenRemoveWindowNode()
379 node->isPlayAnimationHide_); in RemoveFromRsTreeWhenRemoveWindowNode()
383 void WindowNodeContainer::SetSurfaceNodeVisible(sptr<WindowNode>& node, int32_t topPriority, bool v… in SetSurfaceNodeVisible() argument
385 if (node == nullptr) { in SetSurfaceNodeVisible()
388 if (node->parent_ != nullptr && node->currentVisibility_) { in SetSurfaceNodeVisible()
389 … if (node->priority_ < topPriority && !WindowHelper::IsShowWhenLocked(node->GetWindowFlags()) && in SetSurfaceNodeVisible()
390 !WindowHelper::IsShowWhenLocked(node->parent_->GetWindowFlags())) { in SetSurfaceNodeVisible()
391 …auto surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->surf… in SetSurfaceNodeVisible()
397 for (auto& childNode : node->children_) { in SetSurfaceNodeVisible()
402 void WindowNodeContainer::SetBelowScreenlockVisible(sptr<WindowNode>& node, bool visible) in SetBelowScreenlockVisible() argument
406 for (auto& node : rootNodes) { in SetBelowScreenlockVisible() local
407 SetSurfaceNodeVisible(node, topPriority, visible); in SetBelowScreenlockVisible()
411 WMError WindowNodeContainer::RemoveWindowNode(sptr<WindowNode>& node, bool fromAnimation) in RemoveWindowNode() argument
413 if (node == nullptr) { in RemoveWindowNode()
417 if (node->parent_ == nullptr) { in RemoveWindowNode()
420 RemoveWindowNodeFromWindowTree(node); in RemoveWindowNode()
423 node->requestedVisibility_ = false; in RemoveWindowNode()
424 node->currentVisibility_ = false; in RemoveWindowNode()
425 RemoveFromRsTreeWhenRemoveWindowNode(node, fromAnimation); in RemoveWindowNode()
426 node->isPlayAnimationHide_ = false; in RemoveWindowNode()
428 layoutPolicy_->PerformWindowLayout(node, WindowUpdateType::WINDOW_UPDATE_REMOVED); in RemoveWindowNode()
429 WindowMode lastMode = node->GetWindowMode(); in RemoveWindowNode()
430 if (HandleRemoveWindow(node) != WMError::WM_OK) { in RemoveWindowNode()
434 NotifyDockWindowStateChanged(node, true); in RemoveWindowNode()
436 NotifyIfAvoidAreaChanged(node, AvoidControlType::AVOID_NODE_REMOVE); in RemoveWindowNode()
437 DumpScreenWindowTreeByWinId(node->GetWindowId()); in RemoveWindowNode()
438 UpdateCameraFloatWindowStatus(node, false); in RemoveWindowNode()
439 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in RemoveWindowNode()
441 SetBelowScreenlockVisible(node, true); in RemoveWindowNode()
443 WLOGI("Remove Id: %{public}u end", node->GetWindowId()); in RemoveWindowNode()
447 if (node->GetWindowProperty()->GetPrivacyMode()) { in RemoveWindowNode()
450 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in RemoveWindowNode()
451 WindowInfoReporter::GetInstance().InsertHideReportInfo(node->abilityInfo_.bundleName_); in RemoveWindowNode()
453 HandleRemoveWindowDisplayOrientation(node, fromAnimation); in RemoveWindowNode()
457 void WindowNodeContainer::HandleRemoveWindowDisplayOrientation(sptr<WindowNode>& node, bool fromAni… in HandleRemoveWindowDisplayOrientation() argument
459 if (node->GetWindowMode() != WindowMode::WINDOW_MODE_FULLSCREEN) { in HandleRemoveWindowDisplayOrientation()
464 auto nextRotatableWindow = GetNextRotatableWindow(node->GetWindowId()); in HandleRemoveWindowDisplayOrientation()
471 if (node->stateMachine_.IsHideAnimationPlaying()) { in HandleRemoveWindowDisplayOrientation()
475 auto nextRotatableWindow = GetNextRotatableWindow(node->GetWindowId()); in HandleRemoveWindowDisplayOrientation()
495 void WindowNodeContainer::SetDisplayOrientationFromWindow(sptr<WindowNode>& node, bool withAnimatio… in SetDisplayOrientationFromWindow() argument
497 DisplayManagerServiceInner::GetInstance().SetOrientationFromWindow(node->GetDisplayId(), in SetDisplayOrientationFromWindow()
498 node->GetRequestedOrientation(), withAnimation); in SetDisplayOrientationFromWindow()
518 for (const auto& node : windowNodes) { in UpdatePrivateWindowCount() local
519 if (node->GetWindowProperty()->GetPrivacyMode()) { in UpdatePrivateWindowCount()
605 for (auto& node : tempWindows) { in ResetAllMainFloatingWindowZOrder() local
606 UpdateWindowTree(node); in ResetAllMainFloatingWindowZOrder()
610 WMError WindowNodeContainer::HandleRemoveWindow(sptr<WindowNode>& node) in HandleRemoveWindow() argument
613 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in HandleRemoveWindow()
618 windowPair->HandleRemoveWindow(node); in HandleRemoveWindow()
620 auto type = node->GetWindowType(); in HandleRemoveWindow()
629 WMError WindowNodeContainer::DestroyWindowNode(sptr<WindowNode>& node, std::vector<uint32_t>& windo… in DestroyWindowNode() argument
631 WMError ret = RemoveWindowNode(node); in DestroyWindowNode()
636 StartingWindow::ReleaseStartWinSurfaceNode(node); in DestroyWindowNode()
637 node->surfaceNode_ = nullptr; in DestroyWindowNode()
638 windowIds.push_back(node->GetWindowId()); in DestroyWindowNode()
639 for (auto& child : node->children_) { // destroy sub window if exists in DestroyWindowNode()
650 node->children_.swap(emptyVector); in DestroyWindowNode()
651 if (node->GetWindowType() == WindowType::WINDOW_TYPE_WALLPAPER) { in DestroyWindowNode()
654 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in DestroyWindowNode()
655 WindowInfoReporter::GetInstance().InsertDestroyReportInfo(node->abilityInfo_.bundleName_); in DestroyWindowNode()
658 UpdateAvoidAreaListener(node, false); in DestroyWindowNode()
659 WLOGI("DestroyNode Id: %{public}u end", node->GetWindowId()); in DestroyWindowNode()
663 void WindowNodeContainer::UpdateSizeChangeReason(sptr<WindowNode>& node, WindowSizeChangeReason rea… in UpdateSizeChangeReason() argument
665 if (!node->GetWindowToken()) { in UpdateSizeChangeReason()
669 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { in UpdateSizeChangeReason()
678 layoutPolicy_->NotifyClientAndAnimation(node, node->GetWindowRect(), reason); in UpdateSizeChangeReason()
680 "reason: %{public}u", node->GetWindowId(), reason); in UpdateSizeChangeReason()
684 void WindowNodeContainer::UpdateWindowTree(sptr<WindowNode>& node) in UpdateWindowTree() argument
687 node->priority_ = zorderPolicy_->GetWindowPriority(node->GetWindowType()); in UpdateWindowTree()
688 RaiseInputMethodWindowPriorityIfNeeded(node); in UpdateWindowTree()
689 RaiseShowWhenLockedWindowIfNeeded(node); in UpdateWindowTree()
690 ResetMainFloatingWindowPriorityIfNeeded(node); in UpdateWindowTree()
691 auto parentNode = node->parent_; in UpdateWindowTree()
693 WLOGI("Current window node has no parent: %{public}u", node->GetWindowId()); in UpdateWindowTree()
696 auto iter = std::find(parentNode->children_.begin(), parentNode->children_.end(), node); in UpdateWindowTree()
698 WLOGI("node %{public}u already on window tree, not update!", node->GetWindowId()); in UpdateWindowTree()
704 …if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE && splitWindowCnt == SPLIT_WINDOWS… in UpdateWindowTree()
711 if ((*child)->priority_ > node->priority_) { in UpdateWindowTree()
716 parentNode->children_.insert(position, node); in UpdateWindowTree()
719 bool WindowNodeContainer::AddAppSurfaceNodeOnRSTree(sptr<WindowNode>& node) in AddAppSurfaceNodeOnRSTree() argument
726 …HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "AddAppSurfaceNodeOnRSTree(%u)", node->GetWindowId()… in AddAppSurfaceNodeOnRSTree()
727 if (!WindowHelper::IsMainWindow(node->GetWindowType())) { in AddAppSurfaceNodeOnRSTree()
728 WLOGFE("id:%{public}u not main app window but has start window", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
731 if (!node->leashWinSurfaceNode_ || !node->surfaceNode_) { in AddAppSurfaceNodeOnRSTree()
732 …%{public}u leashWinSurfaceNode or surfaceNode is null but has start window!", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
735 WLOGI("AddAppSurfaceNodeOnRSTree Id: %{public}d", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
736 if (!node->currentVisibility_) { in AddAppSurfaceNodeOnRSTree()
737 WLOGI("id: %{public}d is invisible, no need update RS tree", node->GetWindowId()); in AddAppSurfaceNodeOnRSTree()
740 node->leashWinSurfaceNode_->AddChild(node->surfaceNode_, -1); in AddAppSurfaceNodeOnRSTree()
785 bool WindowNodeContainer::AddNodeOnRSTree(sptr<WindowNode>& node, DisplayId displayId, DisplayId pa… in AddNodeOnRSTree() argument
789 …if (node->GetWindowProperty()->GetAnimationFlag() == static_cast<uint32_t>(WindowAnimation::CUSTOM… in AddNodeOnRSTree()
790 node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT) { in AddNodeOnRSTree()
797 node->GetWindowId(), displayId, parentDisplayId, isMultiDisplay, animationPlayed); in AddNodeOnRSTree()
799 if (!node->currentVisibility_) { in AddNodeOnRSTree()
800 WLOGI("id: %{public}d invisible, no need update RS tree", node->GetWindowId()); in AddNodeOnRSTree()
804 if (IsWindowFollowParent(node->GetWindowType())) { in AddNodeOnRSTree()
805 auto& parentNode = node->parent_; in AddNodeOnRSTree()
807 node->surfaceNode_ != nullptr) { in AddNodeOnRSTree()
808node->surfaceNode_->SetTranslateX(node->GetWindowRect().posX_ - parentNode->GetWindowRect().posX_); in AddNodeOnRSTree()
809node->surfaceNode_->SetTranslateY(node->GetWindowRect().posY_ - parentNode->GetWindowRect().posY_); in AddNodeOnRSTree()
810 node->surfaceNode_->SetVisible(true); in AddNodeOnRSTree()
811 parentNode->surfaceNode_->AddChild(node->surfaceNode_, -1); in AddNodeOnRSTree()
817 …auto& surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->sur… in AddNodeOnRSTree()
819 for (auto& child : node->children_) { in AddNodeOnRSTree()
833 node->GetWindowGravity(windowGravity, percent); in AddNodeOnRSTree()
834 if (node->EnableDefaultAnimation(animationPlayed)) { in AddNodeOnRSTree()
836 StartTraceArgs(HITRACE_TAG_WINDOW_MANAGER, "Animate(%u)", node->GetWindowId()); in AddNodeOnRSTree()
840 } else if (node->GetWindowType() == WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT && in AddNodeOnRSTree()
854 bool WindowNodeContainer::RemoveNodeFromRSTree(sptr<WindowNode>& node, DisplayId displayId, Display… in RemoveNodeFromRSTree() argument
858 …if (node->GetWindowProperty()->GetAnimationFlag() == static_cast<uint32_t>(WindowAnimation::CUSTOM… in RemoveNodeFromRSTree()
859 node->GetWindowType() == WindowType::WINDOW_TYPE_APP_COMPONENT) { in RemoveNodeFromRSTree()
866 node->GetWindowId(), displayId, isMultiDisplay, parentDisplayId, animationPlayed); in RemoveNodeFromRSTree()
868 if (IsWindowFollowParent(node->GetWindowType())) { in RemoveNodeFromRSTree()
869 const auto& parentNode = node->parent_; in RemoveNodeFromRSTree()
871 node->surfaceNode_ != nullptr) { in RemoveNodeFromRSTree()
872 node->surfaceNode_->SetVisible(false); in RemoveNodeFromRSTree()
873 parentNode->surfaceNode_->RemoveChild(node->surfaceNode_); in RemoveNodeFromRSTree()
879 …auto& surfaceNode = node->leashWinSurfaceNode_ != nullptr ? node->leashWinSurfaceNode_ : node->sur… in RemoveNodeFromRSTree()
881 for (auto& child : node->children_) { in RemoveNodeFromRSTree()
895 node->GetWindowGravity(windowGravity, percent); in RemoveNodeFromRSTree()
896 if (node->EnableDefaultAnimation(animationPlayed)) { in RemoveNodeFromRSTree()
898 StartTraceArgs(HITRACE_TAG_WINDOW_MANAGER, "Animate(%u)", node->GetWindowId()); in RemoveNodeFromRSTree()
899 if (node->surfaceNode_) { in RemoveNodeFromRSTree()
900 node->surfaceNode_->SetFreeze(true); in RemoveNodeFromRSTree()
902 wptr<WindowNode> weakNode(node); in RemoveNodeFromRSTree()
911 } else if (node->GetWindowType() == WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT && in RemoveNodeFromRSTree()
929 for (auto& node : belowAppWindowNode_->children_) { in Destroy() local
930 DestroyWindowNode(node, removedIds_); in Destroy()
932 for (auto& node : appWindowNode_->children_) { in Destroy() local
933 DestroyWindowNode(node, removedIds_); in Destroy()
935 for (auto& node : aboveAppWindowNode_->children_) { in Destroy() local
936 DestroyWindowNode(node, removedIds_); in Destroy()
961 for (auto& node : rootNode->children_) { in FindWindowNodeById() local
962 if (node->GetWindowId() == id) { in FindWindowNodeById()
963 return node; in FindWindowNodeById()
965 for (auto& subNode : node->children_) { in FindWindowNodeById()
977 auto node = FindWindowNodeById(id); in UpdateFocusStatus() local
978 if (node == nullptr) { in UpdateFocusStatus()
983 focusedPid_ = node->GetCallingPid(); in UpdateFocusStatus()
985 node->isFocused_ = focused; in UpdateFocusStatus()
987 WindowSystemEffect::SetWindowShadow(node); in UpdateFocusStatus()
988 if (node->GetCallingPid() == 0) { in UpdateFocusStatus()
993 if (focused && node->GetWindowProperty() != nullptr) { in UpdateFocusStatus()
994 AbilityInfo info = node->GetWindowProperty()->GetAbilityInfo(); in UpdateFocusStatus()
997node->GetWindowProperty()->GetWindowName().c_str(), info.bundleName_.c_str(), info.abilityName_.c_… in UpdateFocusStatus()
998 node->GetCallingPid(), node->GetCallingUid()); in UpdateFocusStatus()
1000 if (node->surfaceNode_ == nullptr) { in UpdateFocusStatus()
1003 focusNodeId = node->surfaceNode_->GetId(); in UpdateFocusStatus()
1006 …{ node->GetCallingPid(), node->GetCallingUid(), info.bundleName_, info.abilityName_, focusNodeId }; in UpdateFocusStatus()
1009 if (node->GetWindowToken()) { in UpdateFocusStatus()
1010 node->GetWindowToken()->UpdateFocusStatus(focused); in UpdateFocusStatus()
1012 if (node->abilityToken_ == nullptr) { in UpdateFocusStatus()
1015 …sptr<FocusChangeInfo> focusChangeInfo = new FocusChangeInfo(node->GetWindowId(), node->GetDisplayI… in UpdateFocusStatus()
1016 node->GetCallingPid(), node->GetCallingUid(), node->GetWindowType(), node->abilityToken_); in UpdateFocusStatus()
1023 auto node = FindWindowNodeById(id); in UpdateActiveStatus() local
1024 if (node == nullptr) { in UpdateActiveStatus()
1029 activePid_ = node->GetCallingPid(); in UpdateActiveStatus()
1031 if (node->GetWindowToken()) { in UpdateActiveStatus()
1032 node->GetWindowToken()->UpdateActiveStatus(isActive); in UpdateActiveStatus()
1038 auto node = FindWindowNodeById(id); in UpdateBrightness() local
1039 if (node == nullptr) { in UpdateBrightness()
1045 if (!WindowHelper::IsAppWindow(node->GetWindowType())) { in UpdateBrightness()
1049 WLOGI("Brightness: [%{public}f, %{public}f]", GetDisplayBrightness(), node->GetBrightness()); in UpdateBrightness()
1050 … if (std::fabs(node->GetBrightness() - UNDEFINED_BRIGHTNESS) < std::numeric_limits<float>::min()) { in UpdateBrightness()
1051 if (GetDisplayBrightness() != node->GetBrightness()) { in UpdateBrightness()
1060 if (GetDisplayBrightness() != node->GetBrightness()) { in UpdateBrightness()
1061 … WLOGI("adjust brightness with value: %{public}u", ToOverrideBrightness(node->GetBrightness())); in UpdateBrightness()
1064 ToOverrideBrightness(node->GetBrightness())); in UpdateBrightness()
1066 SetDisplayBrightness(node->GetBrightness()); in UpdateBrightness()
1068 SetBrightnessWindow(node->GetWindowId()); in UpdateBrightness()
1075 WindowNodeOperationFunc func = [this](sptr<WindowNode> node) { in AssignZOrder() argument
1076 if (!node->leashWinSurfaceNode_ && !node->surfaceNode_ && !node->startingWinSurfaceNode_) { in AssignZOrder()
1078 WLOGFE("Id: %{public}u has no surface nodes", node->GetWindowId()); in AssignZOrder()
1081 if (node->leashWinSurfaceNode_ != nullptr) { in AssignZOrder()
1083 node->leashWinSurfaceNode_->SetPositionZ(zOrder_); in AssignZOrder()
1086 if (node->surfaceNode_ != nullptr) { in AssignZOrder()
1088 node->surfaceNode_->SetPositionZ(zOrder_); in AssignZOrder()
1089 node->zOrder_ = zOrder_; in AssignZOrder()
1092 if (node->startingWinSurfaceNode_ != nullptr) { in AssignZOrder()
1094 node->startingWinSurfaceNode_->SetPositionZ(zOrder_); in AssignZOrder()
1197 void WindowNodeContainer::HandleKeepScreenOn(const sptr<WindowNode>& node, bool requireLock) in HandleKeepScreenOn() argument
1200 if (requireLock && node->keepScreenLock_ == nullptr) { in HandleKeepScreenOn()
1203node->keepScreenLock_ = PowerMgr::PowerMgrClient::GetInstance().CreateRunningLock(node->GetWindowN… in HandleKeepScreenOn()
1208 if (node->keepScreenLock_ == nullptr) { in HandleKeepScreenOn()
1211 WLOGI("keep screen on: [%{public}s, %{public}d]", node->GetWindowName().c_str(), requireLock); in HandleKeepScreenOn()
1213 node->GetWindowName().c_str(), requireLock); in HandleKeepScreenOn()
1218 res = node->keepScreenLock_->Lock(); in HandleKeepScreenOn()
1220 res = node->keepScreenLock_->UnLock(); in HandleKeepScreenOn()
1230 bool WindowNodeContainer::IsAboveSystemBarNode(sptr<WindowNode> node) const in IsAboveSystemBarNode()
1232 int32_t curPriority = zorderPolicy_->GetWindowPriority(node->GetWindowType()); in IsAboveSystemBarNode()
1240 bool WindowNodeContainer::IsSplitImmersiveNode(sptr<WindowNode> node) const in IsSplitImmersiveNode()
1242 auto type = node->GetWindowType(); in IsSplitImmersiveNode()
1243 return node->IsSplitMode() || type == WindowType::WINDOW_TYPE_DOCK_SLICE; in IsSplitImmersiveNode()
1259 for (const auto& node : rootNodes) { in GetExpectImmersiveProperty() local
1260 for (auto iter = node->children_.rbegin(); iter < node->children_.rend(); ++iter) { in GetExpectImmersiveProperty()
1298 void WindowNodeContainer::NotifyIfAvoidAreaChanged(const sptr<WindowNode>& node, in NotifyIfAvoidAreaChanged() argument
1301 auto checkFunc = [this](sptr<WindowNode> node) { in NotifyIfAvoidAreaChanged() argument
1302 return CheckWindowNodeWhetherInWindowTree(node); in NotifyIfAvoidAreaChanged()
1304 avoidController_->ProcessWindowChange(node, avoidType, checkFunc); in NotifyIfAvoidAreaChanged()
1305 if (WindowHelper::IsSystemBarWindow(node->GetWindowType())) { in NotifyIfAvoidAreaChanged()
1306 NotifyIfSystemBarRegionChanged(node->GetDisplayId()); in NotifyIfAvoidAreaChanged()
1308 NotifyIfSystemBarTintChanged(node->GetDisplayId()); in NotifyIfAvoidAreaChanged()
1311 NotifyIfKeyboardRegionChanged(node, avoidType); in NotifyIfAvoidAreaChanged()
1322 auto checkFunc = [this](sptr<WindowNode> node) { in ProcessWindowAvoidAreaChangeWhenDisplayChange() argument
1323 return CheckWindowNodeWhetherInWindowTree(node); in ProcessWindowAvoidAreaChangeWhenDisplayChange()
1325 …wNodeOperationFunc func = [avoidController = avoidController_, &checkFunc](sptr<WindowNode> node) { in ProcessWindowAvoidAreaChangeWhenDisplayChange() argument
1326 avoidController->ProcessWindowChange(node, AvoidControlType::AVOID_NODE_UPDATE, checkFunc); in ProcessWindowAvoidAreaChangeWhenDisplayChange()
1398 void WindowNodeContainer::NotifyIfKeyboardRegionChanged(const sptr<WindowNode>& node, in NotifyIfKeyboardRegionChanged() argument
1403 node->GetWindowGravity(windowGravity, percent); in NotifyIfKeyboardRegionChanged()
1404 if (node->GetWindowType() != WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT || in NotifyIfKeyboardRegionChanged()
1406 WLOGFD("windowType: %{public}u", node->GetWindowType()); in NotifyIfKeyboardRegionChanged()
1410 auto callingWindow = FindWindowNodeById(node->GetCallingWindow()); in NotifyIfKeyboardRegionChanged()
1412 WLOGD("callingWindow: %{public}u does not be set", node->GetCallingWindow()); in NotifyIfKeyboardRegionChanged()
1423 const Rect keyRect = node->GetWindowRect(); in NotifyIfKeyboardRegionChanged()
1435 if (node->GetWindowProperty() != nullptr) { in NotifyIfKeyboardRegionChanged()
1436 textFieldPositionY = node->GetWindowProperty()->GetTextFieldPositionY(); in NotifyIfKeyboardRegionChanged()
1437 textFieldHeight = node->GetWindowProperty()->GetTextFieldHeight(); in NotifyIfKeyboardRegionChanged()
1484 void WindowNodeContainer::NotifyDockWindowStateChanged(sptr<WindowNode>& node, bool isEnable) in NotifyDockWindowStateChanged() argument
1490 if (windowNode->GetWindowId() == node->GetWindowId()) { in NotifyDockWindowStateChanged()
1505 …WindowManagerAgentController::GetInstance().UpdateSystemBarRegionTints(node->GetDisplayId(), tints… in NotifyDockWindowStateChanged()
1541 auto node = *(rootNode->children_.rbegin()); in IsTopWindow() local
1542 if (node == nullptr) { in IsTopWindow()
1547 for (auto iter = node->children_.rbegin(); iter < node->children_.rend(); iter++) { in IsTopWindow()
1554 return node->GetWindowId() == windowId; in IsTopWindow()
1583 [windowId](sptr<WindowNode> node) { in RaiseWindowToTop() argument
1584 return node->GetWindowId() == windowId; in RaiseWindowToTop()
1588 sptr<WindowNode> node = *iter; in RaiseWindowToTop() local
1590 UpdateWindowTree(node); in RaiseWindowToTop()
1591 WLOGD("raise window to top %{public}u", node->GetWindowId()); in RaiseWindowToTop()
1597 for (auto& node : belowAppWindowNode_->children_) { in TraverseContainer() local
1598 TraverseWindowNode(node, windowNodes); in TraverseContainer()
1600 for (auto& node : appWindowNode_->children_) { in TraverseContainer() local
1601 TraverseWindowNode(node, windowNodes); in TraverseContainer()
1603 for (auto& node : aboveAppWindowNode_->children_) { in TraverseContainer() local
1604 TraverseWindowNode(node, windowNodes); in TraverseContainer()
1609 void WindowNodeContainer::TraverseWindowNode(sptr<WindowNode>& node, std::vector<sptr<WindowNode>>&… in TraverseWindowNode() argument
1611 if (node == nullptr) { in TraverseWindowNode()
1614 auto iter = node->children_.begin(); in TraverseWindowNode()
1615 for (; iter < node->children_.end(); ++iter) { in TraverseWindowNode()
1622 windowNodes.emplace_back(node); in TraverseWindowNode()
1623 for (; iter < node->children_.end(); ++iter) { in TraverseWindowNode()
1628 AvoidArea WindowNodeContainer::GetAvoidAreaByType(const sptr<WindowNode>& node, AvoidAreaType avoid… in GetAvoidAreaByType() argument
1630 if (CheckWindowNodeWhetherInWindowTree(node)) { in GetAvoidAreaByType()
1631 return avoidController_->GetAvoidAreaByType(node, avoidAreaType); in GetAvoidAreaByType()
1636 bool WindowNodeContainer::CheckWindowNodeWhetherInWindowTree(const sptr<WindowNode>& node) const in CheckWindowNodeWhetherInWindowTree()
1639 WindowNodeOperationFunc func = [&node, &isInWindowTree](sptr<WindowNode> windowNode) { in CheckWindowNodeWhetherInWindowTree()
1640 if (node->GetWindowId() == windowNode->GetWindowId()) { in CheckWindowNodeWhetherInWindowTree()
1655 WindowNodeOperationFunc func = [&zOrder, &winid](sptr<WindowNode> node) { in DumpScreenWindowTreeByWinId() argument
1656 Rect rect = node->GetWindowRect(); in DumpScreenWindowTreeByWinId()
1657 uint32_t windowId = node->GetWindowId(); in DumpScreenWindowTreeByWinId()
1658 const std::string& windowName = node->GetWindowName().size() < WINDOW_NAME_MAX_LENGTH ? in DumpScreenWindowTreeByWinId()
1659 node->GetWindowName() : node->GetWindowName().substr(0, WINDOW_NAME_MAX_LENGTH); in DumpScreenWindowTreeByWinId()
1663 … windowName.c_str(), node->GetWindowId(), node->GetWindowType(), node->GetWindowMode(), in DumpScreenWindowTreeByWinId()
1668 … windowName.c_str(), node->GetWindowId(), node->GetWindowType(), node->GetWindowMode(), in DumpScreenWindowTreeByWinId()
1682 WindowNodeOperationFunc func = [&zOrder](sptr<WindowNode> node) { in DumpScreenWindowTree() argument
1683 Rect rect = node->GetWindowRect(); in DumpScreenWindowTree()
1684 const std::string& windowName = node->GetWindowName().size() < WINDOW_NAME_MAX_LENGTH ? in DumpScreenWindowTree()
1685 node->GetWindowName() : node->GetWindowName().substr(0, WINDOW_NAME_MAX_LENGTH); in DumpScreenWindowTree()
1688 …windowName.c_str(), node->GetDisplayId(), node->GetWindowId(), node->GetWindowType(), node->GetWin… in DumpScreenWindowTree()
1689node->GetWindowFlags(), --zOrder, static_cast<uint32_t>(node->GetRequestedOrientation()), in DumpScreenWindowTree()
1690 node->firstFrameAvailable_, rect.posX_, rect.posY_, rect.width_, rect.height_); in DumpScreenWindowTree()
1719 for (auto& node : rootNodes) { in TraverseAndUpdateWindowState() local
1720 UpdateWindowState(node, topPriority, state); in TraverseAndUpdateWindowState()
1724 void WindowNodeContainer::UpdateWindowState(sptr<WindowNode> node, int32_t topPriority, WindowState… in UpdateWindowState() argument
1726 if (node == nullptr) { in UpdateWindowState()
1729 if (node->parent_ != nullptr && node->currentVisibility_) { in UpdateWindowState()
1730 … if (node->priority_ < topPriority && !WindowHelper::IsShowWhenLocked(node->GetWindowFlags()) && in UpdateWindowState()
1731 !WindowHelper::IsShowWhenLocked(node->parent_->GetWindowFlags())) { in UpdateWindowState()
1732 if (node->GetWindowToken()) { in UpdateWindowState()
1733 node->GetWindowToken()->UpdateWindowState(state); in UpdateWindowState()
1735 HandleKeepScreenOn(node, state); in UpdateWindowState()
1738 for (auto& childNode : node->children_) { in UpdateWindowState()
1743 void WindowNodeContainer::HandleKeepScreenOn(const sptr<WindowNode>& node, WindowState state) in HandleKeepScreenOn() argument
1745 if (node == nullptr) { in HandleKeepScreenOn()
1750 HandleKeepScreenOn(node, false); in HandleKeepScreenOn()
1752 HandleKeepScreenOn(node, node->IsKeepScreenOn()); in HandleKeepScreenOn()
1768 void WindowNodeContainer::RaiseSplitRelatedWindowToTop(sptr<WindowNode>& node) in RaiseSplitRelatedWindowToTop() argument
1770 if (node == nullptr) { in RaiseSplitRelatedWindowToTop()
1773 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in RaiseSplitRelatedWindowToTop()
1778 std::vector<sptr<WindowNode>> orderedPair = windowPair->GetOrderedPair(node); in RaiseSplitRelatedWindowToTop()
1784 WMError WindowNodeContainer::RaiseZOrderForAppWindow(sptr<WindowNode>& node, sptr<WindowNode>& pare… in RaiseZOrderForAppWindow() argument
1786 if (node == nullptr) { in RaiseZOrderForAppWindow()
1789 …if (IsTopWindow(node->GetWindowId(), appWindowNode_) || IsTopWindow(node->GetWindowId(), aboveAppW… in RaiseZOrderForAppWindow()
1790 WLOGE("Window %{public}u is already at top", node->GetWindowId()); in RaiseZOrderForAppWindow()
1794 if (WindowHelper::IsSubWindow(node->GetWindowType()) || in RaiseZOrderForAppWindow()
1795 (node->GetWindowType() == WindowType::WINDOW_TYPE_DIALOG)) { in RaiseZOrderForAppWindow()
1800 RaiseWindowToTop(node->GetWindowId(), parentNode->children_); // raise itself in RaiseZOrderForAppWindow()
1806 } else if (WindowHelper::IsMainWindow(node->GetWindowType())) { in RaiseZOrderForAppWindow()
1807 if (node->IsSplitMode()) { in RaiseZOrderForAppWindow()
1808 RaiseSplitRelatedWindowToTop(node); in RaiseZOrderForAppWindow()
1811 if (node->parent_ == nullptr) { in RaiseZOrderForAppWindow()
1815 RaiseWindowToTop(node->GetWindowId(), node->parent_->children_); in RaiseZOrderForAppWindow()
1823 DumpScreenWindowTreeByWinId(node->GetWindowId()); in RaiseZOrderForAppWindow()
1832 sptr<WindowNode> node) { in GetNextFocusableWindow() argument
1833 …if (previousFocusedWindowFound && node->GetWindowProperty()->GetFocusable() && node->currentVisibi… in GetNextFocusableWindow()
1834 nextFocusableWindow = node; in GetNextFocusableWindow()
1837 if (node->GetWindowId() == windowId) { in GetNextFocusableWindow()
1850 sptr<WindowNode> node) { in GetNextRotatableWindow() argument
1851 if (windowId != node->GetWindowId() && in GetNextRotatableWindow()
1852 WindowHelper::IsRotatableWindow(node->GetWindowType(), node->GetWindowMode())) { in GetNextRotatableWindow()
1853 nextRotatableWindow = node; in GetNextRotatableWindow()
1871 for (auto& node : appWindowNode_->children_) { in GetNextActiveWindow() local
1872 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DOCK_SLICE) { in GetNextActiveWindow()
1875 return node; in GetNextActiveWindow()
1877 for (auto& node : belowAppWindowNode_->children_) { in GetNextActiveWindow() local
1878 if (node->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) { in GetNextActiveWindow()
1879 return node; in GetNextActiveWindow()
1885 …to iter = std::find_if(windowNodes.begin(), windowNodes.end(), [windowId](sptr<WindowNode>& node) { in GetNextActiveWindow() argument
1886 return node->GetWindowId() == windowId; in GetNextActiveWindow()
1957 WindowNodeOperationFunc findDeskTopFunc = [this, &deskTop](sptr<WindowNode> node) { in GetDeskTopWindow() argument
1958 if (node->GetWindowProperty()->GetWindowType() == WindowType::WINDOW_TYPE_DESKTOP) { in GetDeskTopWindow()
1959 deskTop = node; in GetDeskTopWindow()
1972 for (const auto& node : windowNodes) { in HasPrivateWindow() local
1973 if (node && node->GetVisibilityState() < WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION && in HasPrivateWindow()
1974 node->GetWindowProperty()->GetPrivacyMode()) { in HasPrivateWindow()
1975 WLOGI("window name %{public}s", node->GetWindowName().c_str()); in HasPrivateWindow()
1985 for (auto& node : appWindowNode_->children_) { in HasMainFullScreenWindowShown() local
1986 TraverseWindowNode(node, windowNodes); in HasMainFullScreenWindowShown()
1988 for (const auto& node : windowNodes) { in HasMainFullScreenWindowShown() local
1989 if (node->currentVisibility_ && in HasMainFullScreenWindowShown()
1990 WindowHelper::IsMainFullScreenWindow(node->GetWindowType(), node->GetWindowMode())) { in HasMainFullScreenWindowShown()
2046 for (auto node : aboveAppWindowNode_->children_) { in ToggleShownStateForAllAppWindows() local
2047 if (node->GetWindowType() == WindowType::WINDOW_TYPE_LAUNCHER_RECENT && in ToggleShownStateForAllAppWindows()
2048 node->GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN && restore) { in ToggleShownStateForAllAppWindows()
2176 WMError WindowNodeContainer::MinimizeStructuredAppWindowsExceptSelf(const sptr<WindowNode>& node) in MinimizeStructuredAppWindowsExceptSelf() argument
2178 std::vector<uint32_t> exceptionalIds = { node->GetWindowId() }; in MinimizeStructuredAppWindowsExceptSelf()
2217 …NodeContainer::UpdateWindowModeSupportTypeWhenKeyguardChange(const sptr<WindowNode>& node, bool up) in UpdateWindowModeSupportTypeWhenKeyguardChange() argument
2219 …if (!WindowHelper::IsWindowModeSupported(node->GetWindowProperty()->GetRequestWindowModeSupportTyp… in UpdateWindowModeSupportTypeWhenKeyguardChange()
2221 WLOGFD("window doesn't support split mode, winId: %{public}d", node->GetWindowId()); in UpdateWindowModeSupportTypeWhenKeyguardChange()
2226 windowModeSupportType = node->GetWindowModeSupportType() & in UpdateWindowModeSupportTypeWhenKeyguardChange()
2229 …windowModeSupportType = node->GetWindowModeSupportType() | WindowModeSupport::WINDOW_MODE_SUPPORT_… in UpdateWindowModeSupportTypeWhenKeyguardChange()
2231 node->SetWindowModeSupportType(windowModeSupportType); in UpdateWindowModeSupportTypeWhenKeyguardChange()
2232 if (node->GetWindowToken() != nullptr) { in UpdateWindowModeSupportTypeWhenKeyguardChange()
2233 node->GetWindowToken()->UpdateWindowModeSupportType(windowModeSupportType); in UpdateWindowModeSupportTypeWhenKeyguardChange()
2237 void WindowNodeContainer::RaiseInputMethodWindowPriorityIfNeeded(const sptr<WindowNode>& node) const in RaiseInputMethodWindowPriorityIfNeeded()
2239 if (node->GetWindowType() != WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT) { in RaiseInputMethodWindowPriorityIfNeeded()
2244 node->priority_ = zorderPolicy_->GetWindowPriority( in RaiseInputMethodWindowPriorityIfNeeded()
2250 auto callingWindowId = node->GetCallingWindow(); in RaiseInputMethodWindowPriorityIfNeeded()
2257 node->priority_ = (inputMethodPriority < callingWindowPriority) ? in RaiseInputMethodWindowPriorityIfNeeded()
2259 WLOGFD("Reset input method float window priority to %{public}d.", node->priority_); in RaiseInputMethodWindowPriorityIfNeeded()
2265 node->priority_ = zorderPolicy_->GetWindowPriority(WindowType::WINDOW_TYPE_PANEL) + 1; in RaiseInputMethodWindowPriorityIfNeeded()
2326 void WindowNodeContainer::ReZOrderShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node) in ReZOrderShowWhenLockedWindowIfNeeded() argument
2328 … if (!(node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED)) || in ReZOrderShowWhenLockedWindowIfNeeded()
2334 WLOGI("ShowWhenLocked window %{public}u re-zorder to up", node->GetWindowId()); in ReZOrderShowWhenLockedWindowIfNeeded()
2337 void WindowNodeContainer::RaiseShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node) in RaiseShowWhenLockedWindowIfNeeded() argument
2340 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in RaiseShowWhenLockedWindowIfNeeded()
2346 … if (!(node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED)) || in RaiseShowWhenLockedWindowIfNeeded()
2351 node->priority_ = zorderPolicy_->GetWindowPriority(WindowType::WINDOW_TYPE_KEYGUARD) + 1; in RaiseShowWhenLockedWindowIfNeeded()
2352 node->parent_ = aboveAppWindowNode_; in RaiseShowWhenLockedWindowIfNeeded()
2353 if (WindowHelper::IsSplitWindowMode(node->GetWindowMode())) { in RaiseShowWhenLockedWindowIfNeeded()
2354 node->GetWindowProperty()->ResumeLastWindowMode(); in RaiseShowWhenLockedWindowIfNeeded()
2356 WindowSystemEffect::SetWindowEffect(node); in RaiseShowWhenLockedWindowIfNeeded()
2357 if (node->GetWindowToken() != nullptr) { in RaiseShowWhenLockedWindowIfNeeded()
2358 node->GetWindowToken()->UpdateWindowMode(node->GetWindowMode()); in RaiseShowWhenLockedWindowIfNeeded()
2361 WLOGI("ShowWhenLocked window %{public}u raise itself", node->GetWindowId()); in RaiseShowWhenLockedWindowIfNeeded()
2364 void WindowNodeContainer::DropShowWhenLockedWindowIfNeeded(const sptr<WindowNode>& node) in DropShowWhenLockedWindowIfNeeded() argument
2367 if (node->GetWindowType() == WindowType::WINDOW_TYPE_KEYGUARD) { in DropShowWhenLockedWindowIfNeeded()
2380 for (const auto& node : rootNodes) { in TraverseWindowTree() local
2382 for (auto iter = node->children_.rbegin(); iter != node->children_.rend(); ++iter) { in TraverseWindowTree()
2388 for (auto iter = node->children_.begin(); iter != node->children_.end(); ++iter) { in TraverseWindowTree()
2397 bool WindowNodeContainer::TraverseFromTopToBottom(sptr<WindowNode> node, const WindowNodeOperationF… in TraverseFromTopToBottom() argument
2399 if (node == nullptr) { in TraverseFromTopToBottom()
2402 auto iterBegin = node->children_.rbegin(); in TraverseFromTopToBottom()
2403 for (; iterBegin != node->children_.rend(); ++iterBegin) { in TraverseFromTopToBottom()
2411 if (func(node)) { in TraverseFromTopToBottom()
2414 for (; iterBegin != node->children_.rend(); ++iterBegin) { in TraverseFromTopToBottom()
2422 bool WindowNodeContainer::TraverseFromBottomToTop(sptr<WindowNode> node, const WindowNodeOperationF… in TraverseFromBottomToTop() argument
2424 if (node == nullptr) { in TraverseFromBottomToTop()
2427 auto iterBegin = node->children_.begin(); in TraverseFromBottomToTop()
2428 for (; iterBegin != node->children_.end(); ++iterBegin) { in TraverseFromBottomToTop()
2436 if (func(node)) { in TraverseFromBottomToTop()
2439 for (; iterBegin != node->children_.end(); ++iterBegin) { in TraverseFromBottomToTop()
2452 void WindowNodeContainer::UpdateSizeChangeReason(sptr<WindowNode>& node, WindowMode srcMode, Window… in UpdateSizeChangeReason() argument
2455 node->SetWindowSizeChangeReason(WindowSizeChangeReason::RECOVER); in UpdateSizeChangeReason()
2457 node->SetWindowSizeChangeReason(WindowSizeChangeReason::MAXIMIZE); in UpdateSizeChangeReason()
2459 node->SetRequestRect(node->GetWindowRect()); in UpdateSizeChangeReason()
2462 node->SetWindowSizeChangeReason(WindowSizeChangeReason::FULL_TO_SPLIT); in UpdateSizeChangeReason()
2464 node->SetWindowSizeChangeReason(WindowSizeChangeReason::SPLIT_TO_FULL); in UpdateSizeChangeReason()
2466 node->SetWindowSizeChangeReason(WindowSizeChangeReason::RESIZE); in UpdateSizeChangeReason()
2470 WMError WindowNodeContainer::SetWindowMode(sptr<WindowNode>& node, WindowMode dstMode) in SetWindowMode() argument
2472 if (node == nullptr) { in SetWindowMode()
2476 WindowMode srcMode = node->GetWindowMode(); in SetWindowMode()
2478 … (node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED))) { in SetWindowMode()
2482 auto windowPair = displayGroupController_->GetWindowPairByDisplayId(node->GetDisplayId()); in SetWindowMode()
2490 if (node->IsSplitMode() && (status == WindowPairStatus::SINGLE_PRIMARY || in SetWindowMode()
2495 UpdateSizeChangeReason(node, srcMode, dstMode); in SetWindowMode()
2496 node->SetWindowMode(dstMode); in SetWindowMode()
2497 windowPair->UpdateIfSplitRelated(node); in SetWindowMode()
2499 if (WindowHelper::IsMainWindow(node->GetWindowType())) { in SetWindowMode()
2500 if (WindowHelper::IsFloatingWindow(node->GetWindowMode())) { in SetWindowMode()
2501 NotifyDockWindowStateChanged(node, true); in SetWindowMode()
2503 NotifyDockWindowStateChanged(node, false); in SetWindowMode()
2507 if (node->GetWindowMode() == WindowMode::WINDOW_MODE_FULLSCREEN && in SetWindowMode()
2508 WindowHelper::IsAppWindow(node->GetWindowType())) { in SetWindowMode()
2510 res = MinimizeStructuredAppWindowsExceptSelf(node); in SetWindowMode()
2516 WindowSystemEffect::SetWindowEffect(node); in SetWindowMode()
2519 ResetWindowZOrderPriorityWhenSetMode(node, dstMode, srcMode); in SetWindowMode()
2520 MinimizeOldestMainFloatingWindow(node->GetWindowId()); in SetWindowMode()
2522 if (node->GetWindowToken() != nullptr) { in SetWindowMode()
2523 node->GetWindowToken()->UpdateWindowMode(node->GetWindowMode()); in SetWindowMode()
2525 res = UpdateWindowNode(node, WindowUpdateReason::UPDATE_MODE); in SetWindowMode()
2533 void WindowNodeContainer::ResetWindowZOrderPriorityWhenSetMode(sptr<WindowNode>& node, in ResetWindowZOrderPriorityWhenSetMode() argument
2541 if (WindowHelper::IsMainFloatingWindow(node->GetWindowType(), srcMode)) { in ResetWindowZOrderPriorityWhenSetMode()
2542 auto basePriority = zorderPolicy_->GetWindowPriority(node->GetWindowType()); in ResetWindowZOrderPriorityWhenSetMode()
2544 … (node->GetWindowFlags() & static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_SHOW_WHEN_LOCKED))) { in ResetWindowZOrderPriorityWhenSetMode()
2547 node->priority_ = basePriority; in ResetWindowZOrderPriorityWhenSetMode()
2550 if (!WindowHelper::IsMainFloatingWindow(node->GetWindowType(), srcMode) && in ResetWindowZOrderPriorityWhenSetMode()
2551 !WindowHelper::IsMainFloatingWindow(node->GetWindowType(), dstMode) && in ResetWindowZOrderPriorityWhenSetMode()
2558 ResetAllMainFloatingWindowZOrder(node->parent_); in ResetWindowZOrderPriorityWhenSetMode()
2559 if (node->parent_ != nullptr && node->GetWindowId() == focusedWindow_ && in ResetWindowZOrderPriorityWhenSetMode()
2560 WindowHelper::IsMainFloatingWindow(node->GetWindowType(), dstMode)) { in ResetWindowZOrderPriorityWhenSetMode()
2562 RaiseWindowToTop(node->GetWindowId(), node->parent_->children_); in ResetWindowZOrderPriorityWhenSetMode()
2583 void WindowNodeContainer::UpdateCameraFloatWindowStatus(const sptr<WindowNode>& node, bool isShowin… in UpdateCameraFloatWindowStatus() argument
2585 if (node->GetWindowType() == WindowType::WINDOW_TYPE_FLOAT_CAMERA) { in UpdateCameraFloatWindowStatus()
2586 …WindowManagerAgentController::GetInstance().UpdateCameraFloatWindowStatus(node->GetAccessTokenId()… in UpdateCameraFloatWindowStatus()