1 /*
2  * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_OVERLAY_MANAGER_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_OVERLAY_MANAGER_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <stack>
22 #include <unordered_map>
23 #include <utility>
24 
25 #include "base/memory/ace_type.h"
26 #include "base/memory/referenced.h"
27 #include "base/utils/noncopyable.h"
28 #include "base/want/want_wrap.h"
29 #include "base/utils/utils.h"
30 #include "core/components/common/properties/placement.h"
31 #include "core/components/dialog/dialog_properties.h"
32 #include "core/components/picker/picker_data.h"
33 #include "core/components_ng/animation/geometry_transition.h"
34 #include "core/components_ng/base/frame_node.h"
35 #include "core/components_ng/base/ui_node.h"
36 #include "core/components_ng/pattern/calendar_picker/calendar_type_define.h"
37 #include "core/components_ng/pattern/overlay/content_cover_param.h"
38 #include "core/components_ng/pattern/overlay/modal_presentation_pattern.h"
39 #include "core/components_ng/pattern/overlay/modal_style.h"
40 #include "core/components_ng/pattern/overlay/sheet_style.h"
41 #include "core/components_ng/pattern/overlay/group_manager.h"
42 #include "core/components_ng/pattern/picker/datepicker_event_hub.h"
43 #include "core/components_ng/pattern/picker/picker_type_define.h"
44 #include "core/components_ng/pattern/text_picker/textpicker_event_hub.h"
45 #include "core/components_ng/pattern/toast/toast_layout_property.h"
46 #include "core/components_ng/pattern/toast/toast_view.h"
47 #include "core/pipeline_ng/ui_task_scheduler.h"
48 #include "interfaces/inner_api/ace/modal_ui_extension_config.h"
49 
50 namespace OHOS::Ace::NG {
51 
52 struct PopupInfo {
53     int32_t popupId = -1;
54     WeakPtr<FrameNode> target;
55     RefPtr<FrameNode> popupNode;
56     bool markNeedUpdate = false;
57     bool isCurrentOnShow = false;
58     bool isBlockEvent = true;
59     SizeF targetSize;
60     OffsetF targetOffset;
61     bool focusable = false;
62 };
63 
64 struct GatherNodeChildInfo {
65     WeakPtr<FrameNode> imageNode;
66     OffsetF offset;
67     float width = 0.0f;
68     float height = 0.0f;
69     float halfWidth = 0.0f;
70     float halfHeight = 0.0f;
71 };
72 
73 struct DismissTarget {
DismissTargetDismissTarget74     DismissTarget() {}
DismissTargetDismissTarget75     explicit DismissTarget(int32_t inputTargetId) : targetIdOfModal(inputTargetId) {}
DismissTargetDismissTarget76     explicit DismissTarget(const SheetKey& index) : sheetKey(index)
77     {
78         targetIsSheet = true;
79     }
80 
GetTargetIdDismissTarget81     int32_t GetTargetId()
82     {
83         return targetIsSheet ? sheetKey.targetId : targetIdOfModal;
84     }
85 
86     int32_t targetIdOfModal = -1;
87     SheetKey sheetKey;
88     bool targetIsSheet = false;
89 };
90 
91 struct CustomKeyboardOffsetInfo {
92     float finalOffset = 0.0f;
93     float inAniStartOffset = 0.0f;
94     float outAniEndOffset = 0.0f;
95 };
96 
97 // StageManager is the base class for root render node to perform page switch.
98 class ACE_FORCE_EXPORT OverlayManager : public virtual AceType {
99     DECLARE_ACE_TYPE(OverlayManager, AceType);
100 
101 public:
OverlayManager(const RefPtr<FrameNode> & rootNode)102     explicit OverlayManager(const RefPtr<FrameNode>& rootNode) : rootNodeWeak_(rootNode) {}
103     ~OverlayManager() override;
104     void ShowIndexerPopup(int32_t targetId, RefPtr<FrameNode>& customNode);
105     void RemoveIndexerPopupById(int32_t targetId);
106     void RemoveIndexerPopup();
107     void HidePopup(int32_t targetId, const PopupInfo& popupInfo);
108     RefPtr<FrameNode> HidePopupWithoutAnimation(int32_t targetId, const PopupInfo& popupInfo);
109     void ShowPopup(int32_t targetId, const PopupInfo& popupInfo,
110         const std::function<void(int32_t)>&& onWillDismiss = nullptr, bool interactiveDismiss = true);
111     void ErasePopup(int32_t targetId);
112     void HideAllPopups();
113     void HideCustomPopups();
114     void SetPopupHotAreas(RefPtr<FrameNode> popupNode);
115     void ShowPopupAnimation(const RefPtr<FrameNode>& popupNode);
116     void ShowPopupAnimationNG(const RefPtr<FrameNode>& popupNode);
117     void HidePopupAnimation(const RefPtr<FrameNode>& popupNode, const std::function<void()>& finish);
118 
GetPopupInfo(int32_t targetId)119     PopupInfo GetPopupInfo(int32_t targetId) const
120     {
121         auto it = popupMap_.find(targetId);
122         if (it == popupMap_.end()) {
123             return {};
124         }
125         return it->second;
126     }
127 
HasPopupInfo(int32_t targetId)128     bool HasPopupInfo(int32_t targetId) const
129     {
130         return popupMap_.find(targetId) != popupMap_.end();
131     }
132 
ErasePopupInfo(int32_t targetId)133     void ErasePopupInfo(int32_t targetId)
134     {
135         if (popupMap_.find(targetId) != popupMap_.end()) {
136             popupMap_.erase(targetId);
137         }
138     }
139 
SetDismissDialogId(int32_t id)140     void SetDismissDialogId(int32_t id)
141     {
142         dismissDialogId_ = id;
143     }
144 
GetDismissDialogId()145     int32_t GetDismissDialogId() const
146     {
147         return dismissDialogId_;
148     }
149 
150     void ShowMenu(int32_t targetId, const NG::OffsetF& offset, RefPtr<FrameNode> menu = nullptr);
151     void HideMenu(const RefPtr<FrameNode>& menu, int32_t targetId, bool isMenuOnTouch = false);
152     void DeleteMenu(int32_t targetId);
153     void ShowMenuInSubWindow(int32_t targetId, const NG::OffsetF& offset, RefPtr<FrameNode> menu = nullptr);
154     void HideMenuInSubWindow(const RefPtr<FrameNode>& menu, int32_t targetId);
155     RefPtr<FrameNode> GetMenuNode(int32_t targetId);
156     void HideMenuInSubWindow(bool showPreviewAnimation = true, bool startDrag = false);
157     void CleanMenuInSubWindow(int32_t targetId);
158     void CleanPreviewInSubWindow();
159     void CleanHoverImagePreviewInSubWindow(const RefPtr<FrameNode>& flexNode);
160     void CleanPopupInSubWindow();
161     void CleanMenuInSubWindowWithAnimation();
162     void HideAllMenus();
163 
164     void ClearToastInSubwindow();
165     void ClearToast();
166     void ShowToast(const NG::ToastInfo& toastInfo);
167 
168     void FireAutoSave(const RefPtr<FrameNode>& ContainerNode);
169 
GetDialogMap()170     std::unordered_map<int32_t, RefPtr<FrameNode>> GetDialogMap()
171     {
172         return dialogMap_;
173     };
174     RefPtr<FrameNode> GetDialog(int32_t dialogId);
175     RefPtr<FrameNode> SetDialogMask(const DialogProperties& dialogProps);
176     // customNode only used by customDialog, pass in nullptr if not customDialog
177     RefPtr<FrameNode> ShowDialog(
178         const DialogProperties& dialogProps, std::function<void()>&& buildFunc, bool isRightToLeft = false);
179     RefPtr<FrameNode> ShowDialogWithNode(
180         const DialogProperties& dialogProps, const RefPtr<NG::UINode>& customNode, bool isRightToLeft = false);
181     void ShowCustomDialog(const RefPtr<FrameNode>& customNode);
182     void ShowDateDialog(const DialogProperties& dialogProps, const DatePickerSettingData& settingData,
183         std::map<std::string, NG::DialogEvent> dialogEvent,
184         std::map<std::string, NG::DialogGestureEvent> dialogCancelEvent,
185         std::map<std::string, NG::DialogCancelEvent> dialogLifeCycleEvent = {},
186         const std::vector<ButtonInfo>& buttonInfos = std::vector<ButtonInfo>({}));
187     void ShowTimeDialog(const DialogProperties& dialogProps, const TimePickerSettingData& settingData,
188         std::map<std::string, PickerTime> timePickerProperty, std::map<std::string, NG::DialogEvent> dialogEvent,
189         std::map<std::string, NG::DialogGestureEvent> dialogCancelEvent,
190         std::map<std::string, NG::DialogCancelEvent> dialogLifeCycleEvent = {},
191         const std::vector<ButtonInfo>& buttonInfos = std::vector<ButtonInfo>({}));
192     void ShowTextDialog(const DialogProperties& dialogProps, const TextPickerSettingData& settingData,
193         std::map<std::string, NG::DialogTextEvent> dialogEvent,
194         std::map<std::string, NG::DialogGestureEvent> dialogCancelEvent,
195         std::map<std::string, NG::DialogCancelEvent> dialogLifeCycleEvent = {},
196         const std::vector<ButtonInfo>& buttonInfos = std::vector<ButtonInfo>({}));
197     void ShowCalendarDialog(const DialogProperties& dialogProps, const CalendarSettingData& settingData,
198         std::map<std::string, NG::DialogEvent> dialogEvent,
199         std::map<std::string, NG::DialogGestureEvent> dialogCancelEvent,
200         std::map<std::string, NG::DialogCancelEvent> dialogLifeCycleEvent = {},
201         const std::vector<ButtonInfo>& buttonInfos = std::vector<ButtonInfo>({}));
202     void PopModalDialog(int32_t maskId);
203 
204     void CloseDialog(const RefPtr<FrameNode>& dialogNode);
205     void DeleteDialogHotAreas(const RefPtr<FrameNode>& dialogNode);
206 
207     void OpenCustomDialog(const DialogProperties& dialogProps, std::function<void(int32_t)> &&callback);
208     void CloseCustomDialog(const int32_t dialogId);
209     void CloseCustomDialog(const WeakPtr<NG::UINode>& node, std::function<void(int32_t)> &&callback);
210     void UpdateCustomDialog(const WeakPtr<NG::UINode>& node, const DialogProperties& dialogProps,
211         std::function<void(int32_t)> &&callback);
212 
SetSubWindowId(int32_t subWindowId)213     void SetSubWindowId(int32_t subWindowId)
214     {
215         subWindowId_ = subWindowId;
216     }
GetSubwindowId()217     int32_t GetSubwindowId()
218     {
219         return subWindowId_;
220     }
SetMaskNodeId(int32_t dialogId,int32_t maskId)221     void SetMaskNodeId(int32_t dialogId, int32_t maskId)
222     {
223         maskNodeIdMap_[dialogId] = maskId;
224     }
225     bool isMaskNode(int32_t maskId);
226     int32_t GetMaskNodeIdWithDialogId(int32_t dialogId);
227 
228     /**  pop overlays (if any) on back press
229      *
230      *   @return    true if popup was removed, false if no overlay exists
231      */
232     bool RemoveOverlay(bool isBackPressed, bool isPageRouter = false);
233     bool RemoveDialog(const RefPtr<FrameNode>& overlay, bool isBackPressed, bool isPageRouter = false);
234     bool RemoveBubble(const RefPtr<FrameNode>& overlay);
235     bool RemoveMenu(const RefPtr<FrameNode>& overlay);
236     bool RemoveDragPreview(const RefPtr<FrameNode>& overlay);
237     bool RemoveModalInOverlay();
238     bool RemoveAllModalInOverlay(bool isRouterTransition = true);
239     bool RemoveAllModalInOverlayByStack();
240     bool RemoveAllModalInOverlayByList();
241     bool OnRemoveAllModalInOverlayByList();
242     void AfterRemoveAllModalInOverlayByList();
243     bool IsModalUiextensionNode(const RefPtr<FrameNode>& topModalNode);
244     bool IsProhibitedRemoveByRouter(const RefPtr<FrameNode>& topModalNode);
245     bool IsProhibitedRemoveByNavigation(const RefPtr<FrameNode>& topModalNode);
246     bool RemoveOverlayInSubwindow();
247 
RegisterOnHideDialog(std::function<void ()> callback)248     void RegisterOnHideDialog(std::function<void()> callback)
249     {
250         onHideDialogCallback_ = callback;
251     }
252 
CallOnHideDialogCallback()253     void CallOnHideDialogCallback()
254     {
255         if (onHideDialogCallback_) {
256             onHideDialogCallback_();
257         }
258     }
259 
SetBackPressEvent(std::function<bool ()> event)260     void SetBackPressEvent(std::function<bool()> event)
261     {
262         backPressEvent_ = event;
263     }
264 
FireBackPressEvent()265     bool FireBackPressEvent() const
266     {
267         if (backPressEvent_) {
268             return backPressEvent_();
269         }
270         return false;
271     }
272 
GetHasPixelMap()273     bool GetHasPixelMap()
274     {
275         return hasPixelMap_;
276     }
277 
SetHasPixelMap(bool hasPixelMap)278     void SetHasPixelMap(bool hasPixelMap)
279     {
280         hasPixelMap_ = hasPixelMap;
281     }
282 
GetHasDragPixelMap()283     bool GetHasDragPixelMap() const
284     {
285         return hasDragPixelMap_;
286     }
287 
SetHasDragPixelMap(bool hasDragPixelMap)288     void SetHasDragPixelMap(bool hasDragPixelMap)
289     {
290         hasDragPixelMap_ = hasDragPixelMap;
291     }
292 
GetHasGatherNode()293     bool GetHasGatherNode()
294     {
295         return hasGatherNode_;
296     }
297 
GetPixelMapNode()298     RefPtr<FrameNode> GetPixelMapNode()
299     {
300         return pixmapColumnNodeWeak_.Upgrade();
301     }
302 
303     RefPtr<FrameNode> GetPixelMapContentNode(bool isSubwindowOverlay = false) const;
304 
305     RefPtr<FrameNode> GetPixelMapContentNodeForSubwindow() const;
306 
307     RefPtr<FrameNode> GetDragPixelMapContentNode() const;
308 
309     RefPtr<FrameNode> GetPixelMapBadgeNode() const;
310 
311     RefPtr<FrameNode> GetDragPixelMapBadgeNode() const;
312 
GetHasFilter()313     bool GetHasFilter()
314     {
315         return hasFilter_;
316     }
317 
SetHasFilter(bool hasFilter)318     void SetHasFilter(bool hasFilter)
319     {
320         hasFilter_ = hasFilter;
321     }
322 
GetHasEvent()323     bool GetHasEvent()
324     {
325         return hasEvent_;
326     }
327 
SetHasEvent(bool hasEvent)328     void SetHasEvent(bool hasEvent)
329     {
330         hasEvent_ = hasEvent;
331     }
332 
GetIsOnAnimation()333     bool GetIsOnAnimation()
334     {
335         return isOnAnimation_;
336     }
337 
SetIsOnAnimation(bool isOnAnimation)338     void SetIsOnAnimation(bool isOnAnimation)
339     {
340         isOnAnimation_ = isOnAnimation;
341     }
342 
SetFilterColumnNode(const RefPtr<FrameNode> & columnNode)343     void SetFilterColumnNode(const RefPtr<FrameNode>& columnNode)
344     {
345         filterColumnNodeWeak_ = columnNode;
346     }
347     void MountFilterToWindowScene(const RefPtr<FrameNode>& columnNode, const RefPtr<UINode>& windowScene);
348     void MountPixelMapToWindowScene(
349         const RefPtr<FrameNode>& columnNode, const RefPtr<UINode>& windowScene, bool isDragPixelMap = false);
350     void MountEventToWindowScene(const RefPtr<FrameNode>& columnNode, const RefPtr<UINode>& windowScene);
351     void MountPixelMapToRootNode(const RefPtr<FrameNode>& columnNode, bool isDragPixelMap = false);
352     void MountEventToRootNode(const RefPtr<FrameNode>& columnNode);
353     void RemovePixelMap();
354     void RemovePixelMapAnimation(bool startDrag, double x, double y, bool isSubwindowOverlay = false);
355     void RemoveDragPixelMap();
356     void UpdatePixelMapScale(float& scale);
357     void RemoveFilter();
358     void RemoveFilterAnimation();
359     void RemoveEventColumn();
360     void UpdatePixelMapPosition(bool isSubwindowOverlay = false);
361     void UpdateContextMenuDisappearPosition(const NG::OffsetF& offset, float menuScale = 1.0f,
362 	    bool isRedragStart = false, int32_t menuWrapperId = -1);
363     void ContextMenuSwitchDragPreviewAnimation(const RefPtr<NG::FrameNode>& dragPreviewNode,
364         const NG::OffsetF& offset);
365     bool GetMenuPreviewCenter(NG::OffsetF& offset);
366 
ResetContextMenuDragHideFinished()367     void ResetContextMenuDragHideFinished()
368     {
369         isContextMenuDragHideFinished_ = false;
370         dragMoveVector_ = OffsetF(0.0f, 0.0f);
371         lastDragMoveVector_ = OffsetF(0.0f, 0.0f);
372     }
373 
ResetContextMenuRestartDragVector()374     void ResetContextMenuRestartDragVector()
375     {
376         dragMoveVector_ = OffsetF(0.0f, 0.0f);
377         lastDragMoveVector_ = OffsetF(0.0f, 0.0f);
378     }
379 
SetContextMenuDragHideFinished(bool isContextMenuDragHideFinished)380     void SetContextMenuDragHideFinished(bool isContextMenuDragHideFinished)
381     {
382         isContextMenuDragHideFinished_ = isContextMenuDragHideFinished;
383     }
384 
IsContextMenuDragHideFinished()385     bool IsContextMenuDragHideFinished() const
386     {
387         return isContextMenuDragHideFinished_ == true;
388     }
389 
IsOriginDragMoveVector()390     bool IsOriginDragMoveVector() const
391     {
392         return dragMoveVector_.NonOffset() && lastDragMoveVector_.NonOffset();
393     }
394 
IsUpdateDragMoveVector()395     bool IsUpdateDragMoveVector() const
396     {
397         return !GetUpdateDragMoveVector().NonOffset() && !lastDragMoveVector_.NonOffset();
398     }
399 
UpdateDragMoveVector(const NG::OffsetF & offset)400     void UpdateDragMoveVector(const NG::OffsetF& offset)
401     {
402         lastDragMoveVector_ = dragMoveVector_;
403         dragMoveVector_ = offset;
404     }
405 
GetUpdateDragMoveVector()406     OffsetF GetUpdateDragMoveVector() const
407     {
408         return dragMoveVector_ - lastDragMoveVector_;
409     }
410 
411     void BindContentCover(bool isShow, std::function<void(const std::string&)>&& callback,
412         std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::ModalStyle& modalStyle, std::function<void()>&& onAppear,
413         std::function<void()>&& onDisappear, std::function<void()>&& onWillAppear,
414         std::function<void()>&& onWillDisappear, const NG::ContentCoverParam& contentCoverParam,
415         const RefPtr<FrameNode>& targetNode, int32_t sessionId = 0);
416     void OnBindContentCover(bool isShow, std::function<void(const std::string&)>&& callback,
417         std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::ModalStyle& modalStyle, std::function<void()>&& onAppear,
418         std::function<void()>&& onDisappear, std::function<void()>&& onWillAppear,
419         std::function<void()>&& onWillDisappear, const NG::ContentCoverParam& contentCoverParam,
420         const RefPtr<FrameNode>& targetNode, int32_t sessionId = 0);
421     void BindSheet(bool isShow, std::function<void(const std::string&)>&& callback,
422         std::function<RefPtr<UINode>()>&& buildNodeFunc, std::function<RefPtr<UINode>()>&& buildTitleNodeFunc,
423         NG::SheetStyle& sheetStyle, std::function<void()>&& onAppear, std::function<void()>&& onDisappear,
424         std::function<void()>&& shouldDismiss, std::function<void(const int32_t info)>&& onWillDismiss,
425         std::function<void()>&& onWillAppear, std::function<void()>&& onWillDisappear,
426         std::function<void(const float)>&& onHeightDidChange,
427         std::function<void(const float)>&& onDetentsDidChange,
428         std::function<void(const float)>&& onWidthDidChange,
429         std::function<void(const float)>&& onTypeDidChange,
430         std::function<void()>&& sheetSpringBack, const RefPtr<FrameNode>& targetNode);
431     void OnBindSheet(bool isShow, std::function<void(const std::string&)>&& callback,
432         std::function<RefPtr<UINode>()>&& buildNodeFunc, std::function<RefPtr<UINode>()>&& buildtitleNodeFunc,
433         NG::SheetStyle& sheetStyle, std::function<void()>&& onAppear, std::function<void()>&& onDisappear,
434         std::function<void()>&& shouldDismiss, std::function<void(const int32_t info)>&& onWillDismiss,
435         std::function<void()>&& onWillAppear, std::function<void()>&& onWillDisappear,
436         std::function<void(const float)>&& onHeightDidChange,
437         std::function<void(const float)>&& onDetentsDidChange,
438         std::function<void(const float)>&& onWidthDidChange,
439         std::function<void(const float)>&& onTypeDidChange,
440         std::function<void()>&& sheetSpringBack, const RefPtr<FrameNode>& targetNode);
441     void CloseSheet(const SheetKey& sheetKey);
442     void PlaySheetTransitionWhenClose(const RefPtr<FrameNode>& sheetNode);
443     void InitSheetMask(
444         const RefPtr<FrameNode>& maskNode, const RefPtr<FrameNode>& sheetNode, const SheetStyle& sheetStyle);
IsModalEmpty()445     bool IsModalEmpty() const
446     {
447         return modalStack_.empty();
448     }
449     bool HasModalPage();
450     void DismissSheet();
451     void DismissContentCover();
452     void SheetSpringBack();
453 
454     void OpenBindSheetByUIContext(
455         const RefPtr<FrameNode>& sheetContentNode, std::function<RefPtr<UINode>()>&& buildtitleNodeFunc,
456         NG::SheetStyle& sheetStyle, std::function<void()>&& onAppear, std::function<void()>&& onDisappear,
457         std::function<void()>&& shouldDismiss, std::function<void(const int32_t)>&& onWillDismiss,
458         std::function<void()>&& onWillAppear, std::function<void()>&& onWillDisappear,
459         std::function<void(const float)>&& onHeightDidChange,
460         std::function<void(const float)>&& onDetentsDidChange,
461         std::function<void(const float)>&& onWidthDidChange,
462         std::function<void(const float)>&& onTypeDidChange,
463         std::function<void()>&& sheetSpringBack,
464         std::function<void(const int32_t, const int32_t)> cleanViewContextMapCallback,
465         const RefPtr<FrameNode>& targetNode);
466     void UpdateBindSheetByUIContext(const RefPtr<NG::FrameNode>& sheetContentNode,
467         NG::SheetStyle& sheetStyle, int32_t targetId, bool isPartialUpdate);
468     void CloseBindSheetByUIContext(const RefPtr<NG::FrameNode>& sheetContentNode, int32_t targetId);
SetDismissTarget(const DismissTarget & dismissTarget)469     void SetDismissTarget(const DismissTarget& dismissTarget)
470     {
471         dismissTarget_ = dismissTarget;
472     }
SetDismissSheet(int32_t sheetId)473     void SetDismissSheet(int32_t sheetId)
474     {
475         dismissSheetId_ = sheetId;
476     }
GetDismissSheet()477     int32_t GetDismissSheet() const
478     {
479         return dismissSheetId_;
480     }
481     void RemoveSheetNode(const RefPtr<FrameNode>& sheetNode);
482 
483     void DestroySheet(const RefPtr<FrameNode>& sheetNode, const SheetKey& sheetKey);
484     void CleanSheet(const RefPtr<FrameNode>& sheetNode, const SheetKey& sheetKey);
485 
486     RefPtr<FrameNode> GetSheetMask(const RefPtr<FrameNode>& sheetNode);
487 
488     RefPtr<FrameNode> GetModal(int32_t targetId);
489     void RemoveModal(int32_t targetId);
490     void DeleteModal(int32_t targetId, bool needOnWillDisappear = true);
491     void PopTopModalNode();
492 
493     void DeleteModalNode(int32_t targetId, RefPtr<FrameNode>& modalNode, bool isModal, bool needOnWillDisappear);
494 
495     void BindKeyboard(const std::function<void()>& keyboardBuilder, int32_t targetId);
496     void BindKeyboardWithNode(const RefPtr<UINode>& keyboard, int32_t targetId);
497     void CloseKeyboard(int32_t targetId);
498     void UpdateCustomKeyboardPosition();
499 
500     RefPtr<UINode> FindWindowScene(RefPtr<FrameNode> targetNode);
501 
502     // ui extension
503     bool HandleUIExtNodeSize(const AAFwk::Want& want, RefPtr<FrameNode> uiExtNode);
504     bool HandleUIExtNodeAngle(int32_t uiExtNodeAngle, RefPtr<FrameNode> uiExtNode);
505     bool HandleUIExtNodeTransform(const AAFwk::Want& want, RefPtr<FrameNode> uiExtNode);
506     bool UIExtNodeAngleValid(int32_t uiExtNodeAngle);
507     int32_t CreateModalUIExtension(const RefPtr<WantWrap>& want, const ModalUIExtensionCallbacks& callbacks,
508         const ModalUIExtensionConfig& config);
509     int32_t CreateModalUIExtension(const AAFwk::Want& want, const ModalUIExtensionCallbacks& callbacks,
510         const ModalUIExtensionConfig& config);
511     void CloseModalUIExtension(int32_t sessionId);
512     void UpdateModalUIExtensionConfig(
513         int32_t sessionId, const ModalUIExtensionAllowedUpdateConfig& config);
514     static ModalStyle SetUIExtensionModalStyleAndGet(bool prohibitedRemoveByRouter, bool prohibitedRemoveByNavigation);
515 
516     RefPtr<FrameNode> BuildAIEntityMenu(const std::vector<std::pair<std::string, std::function<void()>>>& menuOptions);
517     RefPtr<FrameNode> CreateAIEntityMenu(const std::vector<std::pair<std::string, std::function<void()>>>& menuOptions,
518         const RefPtr<FrameNode>& targetNode);
519     bool ShowAIEntityMenu(const std::vector<std::pair<std::string, std::function<void()>>>& menuOptions,
520         const RectF& aiRect, const RefPtr<FrameNode>& targetNode);
521     void CloseAIEntityMenu(int32_t targetId);
522 
523     void MarkDirty(PropertyChangeFlag flag);
524     void MarkDirtyOverlay();
525     float GetRootHeight() const;
526     float GetRootWidth() const;
527 
528     void PlaySheetMaskTransition(RefPtr<FrameNode> maskNode, bool isTransitionIn);
529 
530     void PlaySheetTransition(RefPtr<FrameNode> sheetNode, bool isTransitionIn, bool isFirstTransition = true);
531 
532     void ComputeSheetOffset(NG::SheetStyle& sheetStyle, RefPtr<FrameNode> sheetNode);
533 
534     void ComputeSingleGearSheetOffset(NG::SheetStyle& sheetStyle, RefPtr<FrameNode> sheetNode);
535 
536     void ComputeDetentsSheetOffset(NG::SheetStyle& sheetStyle, RefPtr<FrameNode> sheetNode);
537 
538     void CheckDeviceInLandscape(NG::SheetStyle& sheetStyle, RefPtr<FrameNode> sheetNode, float& sheetTopSafeArea);
539 
SetSheetHeight(float height)540     void SetSheetHeight(float height)
541     {
542         sheetHeight_ = height;
543     }
544 
545     const WeakPtr<UINode>& GetRootNode() const;
546     const RefPtr<GroupManager>& GetGroupManager() const;
547 
548     void ModalPageLostFocus(const RefPtr<FrameNode>& node);
549 
550     void SetCustomKeyboardOption(bool supportAvoidance);
551 
SetFilterActive(bool actived)552     void SetFilterActive(bool actived)
553     {
554         hasFilterActived = actived;
555     }
556 
SetDismissPopupId(int32_t targetId)557     void SetDismissPopupId(int32_t targetId)
558     {
559         dismissPopupId_ = targetId;
560     }
561 
562     void DismissPopup();
563     bool CheckPageNeedAvoidKeyboard() const;
564     void AvoidCustomKeyboard(int32_t targetId, float safeHeight);
565 
566     void CreateOverlayNode();
567     void AddFrameNodeToOverlay(const RefPtr<NG::FrameNode>& node, std::optional<int32_t> index = std::nullopt);
568     void RemoveFrameNodeOnOverlay(const RefPtr<NG::FrameNode>& node);
569     void ShowNodeOnOverlay(const RefPtr<NG::FrameNode>& node);
570     void HideNodeOnOverlay(const RefPtr<NG::FrameNode>& node);
571     void ShowAllNodesOnOverlay();
572     void HideAllNodesOnOverlay();
GetOverlayNode()573     RefPtr<FrameNode> GetOverlayNode()
574     {
575         return overlayNode_;
576     }
577 
578     void MountGatherNodeToRootNode(const RefPtr<FrameNode>& frameNode,
579         const std::vector<GatherNodeChildInfo>& gatherNodeChildrenInfo);
580     void MountGatherNodeToWindowScene(const RefPtr<FrameNode>& frameNode,
581         const std::vector<GatherNodeChildInfo>& gatherNodeChildrenInfo,
582         const RefPtr<UINode>& windowScene);
583     void RemoveGatherNode();
584     void RemoveGatherNodeWithAnimation();
585     void UpdateGatherNodeToTop();
GetGatherNode()586     RefPtr<FrameNode> GetGatherNode() const
587     {
588         return gatherNodeWeak_.Upgrade();
589     }
GetGatherNodeChildrenInfo()590     const std::vector<GatherNodeChildInfo>& GetGatherNodeChildrenInfo()
591     {
592         return gatherNodeChildrenInfo_;
593     }
IsGatherWithMenu()594     bool IsGatherWithMenu() const
595     {
596         return isGatherWithMenu_;
597     }
SetIsGatherWithMenu(bool isGatherWithMenu)598     void SetIsGatherWithMenu(bool isGatherWithMenu)
599     {
600         isGatherWithMenu_ = isGatherWithMenu;
601     }
602     void RemoveMenuBadgeNode(const RefPtr<FrameNode>& menuWrapperNode);
603     void RemovePreviewBadgeNode();
EraseMenuInfo(int32_t targetId)604     void EraseMenuInfo(int32_t targetId)
605     {
606         if (menuMap_.find(targetId) != menuMap_.end()) {
607             menuMap_.erase(targetId);
608         }
609     }
610 
611     bool IsRootExpansive() const;
612     void DumpOverlayInfo() const;
613 
614     void ShowFilterAnimation(const RefPtr<FrameNode>& columnNode);
615 
616     void ReloadBuilderNodeConfig();
617 
IsMenuShow()618     bool IsMenuShow() const
619     {
620         return isMenuShow_;
621     }
622 
SetIsMenuShow(bool isMenuShow)623     void SetIsMenuShow(bool isMenuShow)
624     {
625         isMenuShow_ = isMenuShow;
626     }
627 
SetIsAttachToCustomNode(bool isAttachToCustomNode)628     void SetIsAttachToCustomNode(bool isAttachToCustomNode)
629     {
630         isAttachToCustomNode_ = isAttachToCustomNode;
631     }
632 
633     void SetIsAllowedBeCovered(bool isAllowedBeCovered = true);
634     void ClearUIExtensionNode();
635     void DeleteUIExtensionNode(int32_t sessionId);
636     bool AddCurSessionId(int32_t curSessionId);
637     void ResetRootNode(int32_t sessionId);
638     void OnUIExtensionWindowSizeChange();
639 
640     RefPtr<FrameNode> GetDialogNodeWithExistContent(const RefPtr<UINode>& node);
641     OffsetF CalculateMenuPosition(const RefPtr<FrameNode>& menuWrapperNode, const OffsetF& offset);
642 
643 private:
644     void OnBindSheetInner(std::function<void(const std::string&)>&& callback,
645         const RefPtr<UINode>& sheetContentNode, std::function<RefPtr<UINode>()>&& buildtitleNodeFunc,
646         NG::SheetStyle& sheetStyle, std::function<void()>&& onAppear, std::function<void()>&& onDisappear,
647         std::function<void()>&& shouldDismiss, std::function<void(const int32_t)>&& onWillDismiss,
648         std::function<void()>&& onWillAppear, std::function<void()>&& onWillDisappear,
649         std::function<void(const float)>&& onHeightDidChange, std::function<void(const float)>&& onDetentsDidChange,
650         std::function<void(const float)>&& onWidthDidChange,
651         std::function<void(const float)>&& onTypeDidChange,
652         std::function<void()>&& sheetSpringBack, const RefPtr<FrameNode>& targetNode, bool isStartByUIContext = false);
653     void SetSheetProperty(
654         const RefPtr<FrameNode>& sheetPageNode,
655         NG::SheetStyle& sheetStyle, std::function<void()>&& onAppear, std::function<void()>&& onDisappear,
656         std::function<void()>&& shouldDismiss, std::function<void(const int32_t)>&& onWillDismiss,
657         std::function<void()>&& onWillAppear, std::function<void()>&& onWillDisappear,
658         std::function<void(const float)>&& onHeightDidChange, std::function<void(const float)>&& onDetentsDidChange,
659         std::function<void(const float)>&& onWidthDidChange,
660         std::function<void(const float)>&& onTypeDidChange,
661         std::function<void()>&& sheetSpringBack);
662     void SaveSheePageNode(
663         const RefPtr<FrameNode>& sheetPageNode, const RefPtr<UINode>& sheetContentNode,
664         const RefPtr<FrameNode>& targetNode, bool isStartByUIContext);
665     bool CheckTargetIdIsValid(int32_t targetId);
666     RefPtr<FrameNode> CreateSheetMask(const RefPtr<FrameNode>& sheetPageNode,
667         const RefPtr<FrameNode>& targetNode, NG::SheetStyle& sheetStyle);
668     void UpdateSheetRender(const RefPtr<FrameNode>& sheetPageNode, NG::SheetStyle& sheetStyle, bool isPartialUpdate);
669     void UpdateSheetPage(const RefPtr<FrameNode>& sheetNode, NG::SheetStyle& sheetStyle,
670         int32_t targetId, bool isStartByUIContext = false, bool isPartialUpdate = false,
671         std::function<void()>&& onAppear = nullptr, std::function<void()>&& onDisappear = nullptr,
672         std::function<void()>&& shouldDismiss = nullptr, std::function<void(const int32_t)>&& onWillDismiss = nullptr,
673         std::function<void()>&& onWillDisappear = nullptr,
674         std::function<void(const float)>&& onHeightDidChange = nullptr,
675         std::function<void(const float)>&& onDetentsDidChange = nullptr,
676         std::function<void(const float)>&& onWidthDidChange = nullptr,
677         std::function<void(const float)>&& onTypeDidChange = nullptr,
678         std::function<void()>&& sheetSpringBack = nullptr);
679     SheetStyle UpdateSheetStyle(
680         const RefPtr<FrameNode>& sheetNode, const SheetStyle& sheetStyle, bool isPartialUpdate);
681     void UpdateSheetProperty(const RefPtr<FrameNode>& sheetNode, NG::SheetStyle& currentStyle, bool isPartialUpdate);
682     void UpdateSheetMaskBackgroundColor(const RefPtr<FrameNode>& maskNode,
683         const RefPtr<RenderContext>& maskRenderContext, const SheetStyle& sheetStyle);
684     void UpdateSheetMask(const RefPtr<FrameNode>& maskNode,
685         const RefPtr<FrameNode>& sheetNode, const SheetStyle& sheetStyle, bool isPartialUpdate = false);
CleanViewContextMap(int32_t instanceId,int32_t sheetContentId)686     void CleanViewContextMap(int32_t instanceId, int32_t sheetContentId)
687     {
688         if (cleanViewContextMapCallback_) {
689             cleanViewContextMapCallback_(instanceId, sheetContentId);
690         }
691     }
692     void CleanInvalidModalNode(const WeakPtr<FrameNode>& invalidNode);
693     void PopToast(int32_t targetId);
694 
695     // toast should contain id to avoid multiple delete.
696     std::unordered_map<int32_t, WeakPtr<FrameNode>> toastMap_;
697 
698     /**  find/register menu node and update menu's display position
699      *
700      *   @return     true if process is successful
701      */
702     bool ShowMenuHelper(RefPtr<FrameNode>& menu, int32_t targetId, const NG::OffsetF& offset);
703 
704     // The focus logic of overlay node (menu and dialog):
705     // 1. before start show animation: lower level node set unfocusabel and lost focus;
706     // 2. end show animation: overlay node get focus;
707     // 3. before start hide animation: lower level node set focusable;
708     // 4. end hide animation: overlay node lost focus, lower level node get focus.
709     void FocusOverlayNode(const RefPtr<FrameNode>& overlayNode, bool isInSubWindow = false);
710     void BlurOverlayNode(const RefPtr<FrameNode>& currentOverlay, bool isInSubWindow = false);
711     void BlurLowerNode(const RefPtr<FrameNode>& currentOverlay);
712     void ResetLowerNodeFocusable(const RefPtr<FrameNode>& currentOverlay);
713     void PostDialogFinishEvent(const WeakPtr<FrameNode>& nodeWk);
714     void OnDialogCloseEvent(const RefPtr<FrameNode>& node);
715 
716     void CloseDialogInner(const RefPtr<FrameNode>& dialogNode);
717 
718     void ShowMenuAnimation(const RefPtr<FrameNode>& menu);
719     void SetPatternFirstShow(const RefPtr<FrameNode>& menu);
720     void PopMenuAnimation(const RefPtr<FrameNode>& menu, bool showPreviewAnimation = true, bool startDrag = false);
721     void ClearMenuAnimation(const RefPtr<FrameNode>& menu, bool showPreviewAnimation = true, bool startDrag = false);
722     void ShowMenuClearAnimation(const RefPtr<FrameNode>& menuWrapper, AnimationOption& option,
723         bool showPreviewAnimation, bool startDrag);
724     bool IsContextMenuBindedOnOrigNode();
725     void OpenDialogAnimation(const RefPtr<FrameNode>& node);
726     void CloseDialogAnimation(const RefPtr<FrameNode>& node);
727     void SetDialogTransitionEffect(const RefPtr<FrameNode>& node);
728     void CloseDialogMatchTransition(const RefPtr<FrameNode>& node);
729     void SetContainerButtonEnable(bool isEnabled);
730 
731     void SaveLastModalNode();
732     void PlayTransitionEffectIn(const RefPtr<FrameNode>& topModalNode);
733     void PlayTransitionEffectOut(const RefPtr<FrameNode>& topModalNode);
734     void PlayDefaultModalTransition(const RefPtr<FrameNode>& modalNode, bool isTransitionIn);
735     void DefaultModalTransition(bool isTransitionIn);
736     void PlayAlphaModalTransition(const RefPtr<FrameNode>& modalNode, bool isTransitionIn);
737     void FireModalPageShow();
738     void FireModalPageHide();
739 
740     void SetSheetBackgroundBlurStyle(const RefPtr<FrameNode>& sheetNode, const BlurStyleOption& bgBlurStyle);
741     void SetSheetBackgroundColor(const RefPtr<FrameNode>& sheetNode, const RefPtr<SheetTheme>& sheetTheme,
742         const NG::SheetStyle& sheetStyle, bool isPartialUpdate = false);
743 
744     bool ModalExitProcess(const RefPtr<FrameNode>& topModalNode);
745     bool ModalPageExitProcess(const RefPtr<FrameNode>& topModalNode);
746     bool SheetPageExitProcess(const RefPtr<FrameNode>& topModalNode);
747 
748     void BeforeShowDialog(const RefPtr<FrameNode>& dialogNode);
749     void RemoveDialogFromMap(const RefPtr<FrameNode>& node);
750     void RemoveMaskFromMap(const RefPtr<FrameNode>& dialogNode);
751     bool DialogInMapHoldingFocus();
752     void PlayKeyboardTransition(const RefPtr<FrameNode>& customKeyboard, bool isTransitionIn);
753     void FireNavigationStateChange(bool show, const RefPtr<UINode>& node = nullptr);
754     RefPtr<FrameNode> GetModalNodeInStack(std::stack<WeakPtr<FrameNode>>& stack);
755     void PlayBubbleStyleSheetTransition(RefPtr<FrameNode> sheetNode, bool isTransitionIn);
756     void CheckReturnFocus(RefPtr<FrameNode> node);
757     void MountPopup(int32_t targetId, const PopupInfo& popupInfo,
758         const std::function<void(int32_t)>&& onWillDismiss = nullptr, bool interactiveDismiss = true);
759 
760     int32_t GetPopupIdByNode(const RefPtr<FrameNode>& overlay);
761     bool PopupInteractiveDismiss(const RefPtr<FrameNode>& overlay);
762     bool PopupCallBackOnWillDismiss(const RefPtr<FrameNode>& overlay);
763     bool RemovePopupInSubwindow(const RefPtr<Pattern>& pattern, const RefPtr<FrameNode>& overlay,
764         const RefPtr<UINode>& rootNode);
765     bool UpdatePopupMap(int32_t targetId, const PopupInfo& popupInfo);
766     void OpenToastAnimation(const RefPtr<FrameNode>& toastNode, int32_t duration);
767     void PlayDefaultModalIn(const RefPtr<FrameNode>& modalNode, const RefPtr<RenderContext>& context,
768         AnimationOption option, float showHeight);
769     void PlayDefaultModalOut(const RefPtr<FrameNode>& modalNode, const RefPtr<RenderContext>& context,
770         AnimationOption option, float showHeight);
771     void OnShowMenuAnimationFinished(const WeakPtr<FrameNode> menuWK, const WeakPtr<OverlayManager> weak,
772         int32_t instanceId);
773     void OnPopMenuAnimationFinished(const WeakPtr<FrameNode> menuWK, const WeakPtr<UINode> rootWeak,
774         const WeakPtr<OverlayManager> weak, int32_t instanceId);
775     void UpdateMenuVisibility(const RefPtr<FrameNode>& menu);
776     void RemoveMenuNotInSubWindow(
777         const WeakPtr<FrameNode>& menuWK, const WeakPtr<UINode>& rootWeak, const WeakPtr<OverlayManager>& overlayWeak);
778     bool CreateSheetKey(const RefPtr<NG::FrameNode>& sheetContentNode, int32_t targetId,
779         SheetKey& sheetKey);
780 
781     bool CheckTopModalNode(const RefPtr<FrameNode>& topModalNode, int32_t targetId);
782     void HandleModalShow(std::function<void(const std::string&)>&& callback,
783         std::function<RefPtr<UINode>()>&& buildNodeFunc, NG::ModalStyle& modalStyle, std::function<void()>&& onAppear,
784         std::function<void()>&& onDisappear, std::function<void()>&& onWillDisappear, const RefPtr<UINode> rootNode,
785         const NG::ContentCoverParam& contentCoverParam, int32_t targetId,
786         std::optional<ModalTransition> modalTransition);
787     void HandleModalPop(std::function<void()>&& onWillDisappear, const RefPtr<UINode> rootNode, int32_t targetId);
788 
789     int32_t ExceptComponent(const RefPtr<NG::UINode>& rootNode, RefPtr<NG::FrameNode>& overlay,
790         bool isBackPressed, bool isPageRouter);
791     int32_t RemoveOverlayCommon(const RefPtr<NG::UINode>& rootNode, RefPtr<NG::FrameNode>& overlay,
792         RefPtr<Pattern>& pattern, bool isBackPressed, bool isPageRouter);
793     int32_t WebBackward(RefPtr<NG::FrameNode>& overlay);
794     void FindWebNode(const RefPtr<NG::UINode>& node, RefPtr<NG::FrameNode>& webNode);
795 
796     void RegisterDialogLifeCycleCallback(const RefPtr<FrameNode>& dialog, const DialogProperties& dialogProps);
797     void CustomDialogRecordEvent(const DialogProperties& dialogProps);
798     RefPtr<UINode> RebuildCustomBuilder(RefPtr<UINode>& contentNode);
799 
800     void DumpPopupMapInfo() const;
801     void DumpMapInfo(
802         std::unordered_map<int32_t, RefPtr<FrameNode>> map, const std::string mapName, bool hasTarget = true) const;
803     void DumpMapInfo(
804         std::unordered_map<int32_t, WeakPtr<FrameNode>> map, const std::string mapName, bool hasTarget = true) const;
805     void DumpSheetMapInfo(const std::unordered_map<SheetKey, WeakPtr<FrameNode>, SheetKeyHash>& map,
806         const std::string mapName) const;
807     void DumpMaskNodeIdMapInfo() const;
808     void DumpModalListInfo() const;
809     void DumpEntry(const RefPtr<FrameNode>& targetNode, int32_t targetId, const RefPtr<FrameNode>& node) const;
810     std::string GetMapNodeLog(const RefPtr<FrameNode>& node, bool hasTarget = true) const;
811     void SetNodeBeforeAppbar(const RefPtr<NG::UINode>& rootNode, const RefPtr<FrameNode>& node);
812     RefPtr<FrameNode> GetOverlayFrameNode();
813     void MountToParentWithService(const RefPtr<UINode>& rootNode, const RefPtr<FrameNode>& node);
814     void RemoveChildWithService(const RefPtr<UINode>& rootNode, const RefPtr<FrameNode>& node);
815     CustomKeyboardOffsetInfo CalcCustomKeyboardOffset(const RefPtr<FrameNode>& customKeyboard);
816     void SendToAccessibility(const WeakPtr<FrameNode> node, bool isShow);
817 
818     void SetDragNodeNeedClean();
819 
820     RefPtr<FrameNode> overlayNode_;
821     // Key: frameNode Id, Value: index
822     std::unordered_map<int32_t, int32_t> frameNodeMapOnOverlay_;
823     // Key: target Id, Value: PopupInfo
824     std::unordered_map<int32_t, NG::PopupInfo> popupMap_;
825     // K: target frameNode ID, V: menuNode
826     std::unordered_map<int32_t, RefPtr<FrameNode>> menuMap_;
827     std::unordered_map<int32_t, RefPtr<FrameNode>> dialogMap_;
828     std::unordered_map<int32_t, RefPtr<FrameNode>> customPopupMap_;
829     std::unordered_map<int32_t, RefPtr<FrameNode>> customKeyboardMap_;
830     std::stack<WeakPtr<FrameNode>> modalStack_;
831     std::list<WeakPtr<FrameNode>> modalList_;
832     std::unordered_map<SheetKey, WeakPtr<FrameNode>, SheetKeyHash> sheetMap_;
833     std::function<void(const int32_t, const int32_t)> cleanViewContextMapCallback_ = nullptr;
834     std::unordered_map<int32_t, RefPtr<NG::ClickEvent>> sheetMaskClickEventMap_; // Key: maskNodeId
835     WeakPtr<FrameNode> lastModalNode_; // Previous Modal Node
836     float sheetHeight_ { 0.0 };
837     WeakPtr<UINode> rootNodeWeak_;
838     int32_t dialogCount_ = 0;
839     DismissTarget dismissTarget_;
840     int32_t dismissSheetId_ = 0;
841     int32_t dismissDialogId_ = 0;
842     std::unordered_map<int32_t, int32_t> maskNodeIdMap_;
843     int32_t subWindowId_ = -1;
844     bool hasPixelMap_ { false };
845     bool hasDragPixelMap_ { false };
846     bool hasFilter_ { false };
847     bool hasEvent_ { false };
848     bool isOnAnimation_ { false };
849     WeakPtr<FrameNode> pixmapColumnNodeWeak_;
850     WeakPtr<FrameNode> dragPixmapColumnNodeWeak_;
851     WeakPtr<FrameNode> filterColumnNodeWeak_;
852     WeakPtr<FrameNode> eventColumnNodeWeak_;
853     bool isContextMenuDragHideFinished_ = false;
854     OffsetF dragMoveVector_ = OffsetF(0.0f, 0.0f);
855     OffsetF lastDragMoveVector_ = OffsetF(0.0f, 0.0f);
856 
857     std::function<void()> onHideDialogCallback_ = nullptr;
858     CancelableCallback<void()> continuousTask_;
859     std::function<bool()> backPressEvent_ = nullptr;
860 
861     std::set<WeakPtr<UINode>> windowSceneSet_;
862 
863     RefPtr<NG::ClickEvent> sheetMaskClickEvent_;
864     RefPtr<GroupManager> groupManager_ = MakeRefPtr<GroupManager>();
865 
866     // native modal ui extension
867     bool isProhibitBack_ = false;
868 
869     std::unordered_map<int32_t, WeakPtr<FrameNode>> uiExtNodes_;
870     bool keyboardAvoidance_ = false;
871     ACE_DISALLOW_COPY_AND_MOVE(OverlayManager);
872 
873     bool hasFilterActived {false};
874 
875     int32_t dismissPopupId_ = 0;
876 
877     bool hasGatherNode_ { false };
878     bool isGatherWithMenu_ { false };
879     WeakPtr<FrameNode> gatherNodeWeak_;
880     std::vector<GatherNodeChildInfo> gatherNodeChildrenInfo_;
881     bool isMenuShow_ = false;
882     bool isAttachToCustomNode_ = false;
883 
884     // Only used when CreateModalUIExtension
885     // No thread safety issue due to they are all run in UI thread
886     bool isAllowedBeCovered_ = true;
887     // Only hasValue when isAllowedBeCovered is false
888     std::set<int32_t> curSessionIds_;
889 };
890 } // namespace OHOS::Ace::NG
891 
892 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_OVERLAY_MANAGER_H
893