• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_COMMON_PIPELINE_NG_CONTEXT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_PIPELINE_NG_CONTEXT_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <list>
22 #include <unordered_map>
23 #include <utility>
24 
25 #include "interfaces/inner_api/ace/arkui_rect.h"
26 
27 #include "base/geometry/ng/rect_t.h"
28 #include "base/log/frame_info.h"
29 #include "base/log/frame_report.h"
30 #include "base/memory/referenced.h"
31 #include "base/utils/device_config.h"
32 #include "base/view_data/view_data_wrap.h"
33 #include "core/accessibility/accessibility_manager_ng.h"
34 #include "core/common/ai/ai_write_adapter.h"
35 #include "core/common/color_inverter.h"
36 #include "core/common/frontend.h"
37 #include "core/common/thp_extra_manager.h"
38 #include "core/components/common/layout/constants.h"
39 #include "core/components_ng/base/frame_node.h"
40 #include "core/components_ng/gestures/recognizers/gesture_recognizer.h"
41 #include "core/components_ng/manager/avoid_info/avoid_info_manager.h"
42 #include "core/components_ng/manager/drag_drop/drag_drop_manager.h"
43 #include "core/components_ng/manager/force_split/force_split_manager.h"
44 #include "core/components_ng/manager/form_event/form_event_manager.h"
45 #include "core/components_ng/manager/form_gesture/form_gesture_manager.h"
46 #include "core/components_ng/manager/form_visible/form_visible_manager.h"
47 #include "core/components_ng/manager/frame_rate/frame_rate_manager.h"
48 #include "core/components_ng/manager/full_screen/full_screen_manager.h"
49 #include "core/components_ng/manager/memory/memory_manager.h"
50 #include "core/components_ng/manager/navigation/navigation_manager.h"
51 #include "core/components_ng/manager/post_event/post_event_manager.h"
52 #include "core/components_ng/manager/privacy_sensitive/privacy_sensitive_manager.h"
53 #include "core/components_ng/manager/safe_area/safe_area_manager.h"
54 #include "core/components_ng/manager/select_overlay/select_overlay_manager.h"
55 #include "core/components_ng/manager/shared_overlay/shared_overlay_manager.h"
56 #include "core/components_ng/manager/toolbar/toolbar_manager.h"
57 #include "core/components_ng/pattern/custom/custom_node.h"
58 #ifdef WINDOW_SCENE_SUPPORTED
59 #include "core/components_ng/pattern/ui_extension/ui_extension_manager.h"
60 #endif
61 #include "core/common/ace_translate_manager.h"
62 #include "core/components_ng/manager/focus/focus_manager.h"
63 #include "core/components_ng/pattern/overlay/overlay_manager.h"
64 #include "core/components_ng/pattern/recycle_view/recycle_manager.h"
65 #include "core/components_ng/pattern/stage/stage_manager.h"
66 #include "core/components_ng/pattern/web/itouch_event_callback.h"
67 #include "core/components_ng/property/safe_area_insets.h"
68 #include "core/pipeline/pipeline_base.h"
69 namespace OHOS::Ace::Kit {
70 class UIContext;
71 class UIContextImpl;
72 }
73 
74 namespace OHOS::Rosen {
75   class RSUIDirector;
76 }
77 
78 namespace OHOS::Ace::NG {
79 
80 using VsyncCallbackFun = std::function<void()>;
81 using FrameCallbackFunc = std::function<void(uint64_t nanoTimestamp)>;
82 using FrameCallbackFuncFromCAPI = std::function<void(uint64_t nanoTimestamp, uint32_t frameCount)>;
83 using IdleCallbackFunc = std::function<void(uint64_t nanoTimestamp, uint32_t frameCount)>;
84 class NodeRenderStatusMonitor;
85 
86 enum class MockFlushEventType : int32_t {
87     REJECT = -1,
88     NONE = 0,
89     EXECUTE = 1,
90 };
91 class ACE_FORCE_EXPORT PipelineContext : public PipelineBase {
92     DECLARE_ACE_TYPE(NG::PipelineContext, PipelineBase);
93 
94 public:
95     using SurfaceChangedCallbackMap =
96         std::unordered_map<int32_t, std::function<void(int32_t, int32_t, int32_t, int32_t, WindowSizeChangeReason)>>;
97     using SurfacePositionChangedCallbackMap = std::unordered_map<int32_t, std::function<void(int32_t, int32_t)>>;
98     using FoldStatusChangedCallbackMap = std::unordered_map<int32_t, std::function<void(FoldStatus)>>;
99     using HalfFoldHoverChangedCallbackMap = std::unordered_map<int32_t, std::function<void(bool)>>;
100     using FoldDisplayModeChangedCallbackMap = std::unordered_map<int32_t, std::function<void(FoldDisplayMode)>>;
101     using TransformHintChangedCallbackMap = std::unordered_map<int32_t, std::function<void(uint32_t)>>;
102     using PredictTask = std::function<void(int64_t, bool)>;
103     using RotationEndCallbackMap = std::unordered_map<int32_t, std::function<void()>>;
104     using RawKeyboardChangedCallbackMap = std::unordered_map<int32_t, std::function<void()>>;
105     PipelineContext(std::shared_ptr<Window> window, RefPtr<TaskExecutor> taskExecutor,
106         RefPtr<AssetManager> assetManager, RefPtr<PlatformResRegister> platformResRegister,
107         const RefPtr<Frontend>& frontend, int32_t instanceId);
108     PipelineContext(std::shared_ptr<Window> window, RefPtr<TaskExecutor> taskExecutor,
109         RefPtr<AssetManager> assetManager, const RefPtr<Frontend>& frontend, int32_t instanceId);
110     PipelineContext();
111 
112     ~PipelineContext() override = default;
113 
114     static RefPtr<PipelineContext> GetCurrentContext();
115 
116     static RefPtr<PipelineContext> GetCurrentContextSafely();
117 
118     static RefPtr<PipelineContext> GetCurrentContextSafelyWithCheck();
119 
120     static PipelineContext* GetCurrentContextPtrSafely();
121 
122     static PipelineContext* GetCurrentContextPtrSafelyWithCheck();
123 
124 
125     static RefPtr<PipelineContext> GetMainPipelineContext();
126 
127     static RefPtr<PipelineContext> GetContextByContainerId(int32_t containerId);
128 
129     static float GetCurrentRootWidth();
130 
131     static float GetCurrentRootHeight();
132 
133     void MarkDirtyOverlay();
134 
135     void SetupRootElement() override;
136 
137     void SetupSubRootElement();
138 
139     bool NeedSoftKeyboard() override;
140 
141     void SetOnWindowFocused(const std::function<void()>& callback) override;
142 
GetWindowFocusCallback()143     const std::function<void()>& GetWindowFocusCallback() const
144     {
145         return focusOnNodeCallback_;
146     }
147 
SetSizeChangeByRotateCallback(const std::function<void (bool isRotate,const std::shared_ptr<Rosen::RSTransaction> & rsTransaction)> & callback)148     void SetSizeChangeByRotateCallback(const std::function<void(bool isRotate,
149         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction)>& callback)
150     {
151         sizeChangeByRotateCallback_ = callback;
152     }
153 
SetLinkJumpCallback(const std::function<void (const std::string & link)> & callback)154     void SetLinkJumpCallback(const std::function<void(const std::string& link)>& callback)
155     {
156         linkJumpCallback_ = callback;
157     }
158 
ExecuteLinkJumpCallback(const std::string & link)159     void ExecuteLinkJumpCallback(const std::string& link)
160     {
161         linkJumpCallback_(link);
162     }
163 
GetIsLinkJumpOpen()164     bool GetIsLinkJumpOpen()
165     {
166         return linkJumpCallback_ != nullptr;
167     }
168 
FireSizeChangeByRotateCallback(bool isRotate,const std::shared_ptr<Rosen::RSTransaction> & rsTransaction)169     void FireSizeChangeByRotateCallback(bool isRotate,
170         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction)
171     {
172         if (sizeChangeByRotateCallback_) {
173             sizeChangeByRotateCallback_(isRotate, rsTransaction);
174         }
175     }
176 
GetRootElement()177     const RefPtr<FrameNode>& GetRootElement() const
178     {
179         return rootNode_;
180     }
181 
AddKeyFrame(float fraction,const RefPtr<Curve> & curve,const std::function<void ()> & propertyCallback)182     void AddKeyFrame(float fraction, const RefPtr<Curve>& curve, const std::function<void()>& propertyCallback) override
183     {}
184 
AddKeyFrame(float fraction,const std::function<void ()> & propertyCallback)185     void AddKeyFrame(float fraction, const std::function<void()>& propertyCallback) override {}
186 
187     // add schedule task and return the unique mark id.
188     uint32_t AddScheduleTask(const RefPtr<ScheduleTask>& task) override;
189 
190     // remove schedule task by id.
191     void RemoveScheduleTask(uint32_t id) override;
192 
193     std::string GetCurrentPageNameCallback();
194 
195     void OnTouchEvent(const TouchEvent& point, const RefPtr<NG::FrameNode>& node, bool isSubPipe = false) override;
196 
197     void OnAccessibilityHoverEvent(const TouchEvent& point, const RefPtr<NG::FrameNode>& node) override;
198 
199     void OnPenHoverEvent(const TouchEvent& point, const RefPtr<NG::FrameNode>& node) override;
200 
201     void HandlePenHoverOut(const TouchEvent& point) override;
202 
203     void OnMouseMoveEventForAxisEvent(const MouseEvent& event, const RefPtr<NG::FrameNode>& node) override;
204 
205     void OnMouseEvent(const MouseEvent& event, const RefPtr<NG::FrameNode>& node) override;
206     void DispatchMouseEvent(const MouseEvent& event, const RefPtr<FrameNode>& node);
207 
208     void OnAxisEvent(const AxisEvent& event, const RefPtr<NG::FrameNode>& node) override;
209 
210     // Called by view when touch event received.
211     void OnTouchEvent(const TouchEvent& point, bool isSubPipe = false) override;
212 
213 #if defined(SUPPORT_TOUCH_TARGET_TEST)
214     // Used to determine whether the touched frameNode is the target
215     bool OnTouchTargetHitTest(const TouchEvent& point, bool isSubPipe = false, const std::string& target = "") override;
216 #endif
217     // Called by container when key event received.
218     // if return false, then this event needs platform to handle it.
219     bool OnNonPointerEvent(const NonPointerEvent& event) override;
220 
221     // ReDispatch KeyEvent from Web process.
222     void ReDispatch(KeyEvent& keyEvent);
223 
224     // Called by view when mouse event received.
225     void OnMouseEvent(const MouseEvent& event) override;
226 
227     // Do mouse event actively.
228     void FlushMouseEvent();
229 
230     void HandleTouchHoverOut(const TouchEvent& point);
231 
232     void FlushMouseEventVoluntarily();
233 
234     void FlushMouseEventForHover();
235 
236     void FlushMouseEventInVsync();
237 
238     void SetDisplayWindowRectInfo(const Rect& displayWindowRectInfo) override;
239 
240     void SetWindowSizeChangeReason(WindowSizeChangeReason reason) override;
241 
242     void SetIsTransFlag(bool result);
243 
244     void OnFlushMouseEvent(TouchRestrict& touchRestrict);
245     void OnFlushMouseEvent(const RefPtr<FrameNode> &node,
246         const std::list<MouseEvent>& moseEvents, TouchRestrict& touchRestric);
247     void DispatchMouseEvent(
248         std::unordered_map<int, MouseEvent>& idToMousePoints,
249         std::unordered_map<int32_t, MouseEvent> &newIdMousePoints,
250         const std::list<MouseEvent> &mouseEvents,
251         TouchRestrict& touchRestrict,
252         const RefPtr<FrameNode> &node);
253     void FlushDragEvents();
254     void FlushDragEvents(const RefPtr<DragDropManager>& manager,
255         const std::string& extraInfo,
256         const RefPtr<FrameNode>& node,
257         const std::list<DragPointerEvent>& pointEvent);
258     void FlushDragEvents(const RefPtr<DragDropManager>& manager,
259         const std::unordered_map<int32_t, DragPointerEvent>& newIdPoints,
260         const std::string& extraInfo,
261         const std::unordered_map<int, DragPointerEvent>& idToPoints,
262         const RefPtr<FrameNode>& node);
263 
264     // Called by view when axis event received.
265     void OnAxisEvent(const AxisEvent& event) override;
266 
267     // Called by container when rotation event received.
268     // if return false, then this event needs platform to handle it.
OnRotationEvent(const RotationEvent & event)269     bool OnRotationEvent(const RotationEvent& event) const override
270     {
271         return false;
272     }
273 
274     void OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
275         const RefPtr<NG::FrameNode>& node = nullptr) override;
276 
277     // Called by view when idle event.
278     void OnIdle(int64_t deadline) override;
279 
SetBuildAfterCallback(const std::function<void ()> & callback)280     void SetBuildAfterCallback(const std::function<void()>& callback) override
281     {
282         buildFinishCallbacks_.emplace_back(callback);
283     }
284 
SaveExplicitAnimationOption(const AnimationOption & option)285     void SaveExplicitAnimationOption(const AnimationOption& option) override {}
286 
CreateExplicitAnimator(const std::function<void ()> & onFinishEvent)287     void CreateExplicitAnimator(const std::function<void()>& onFinishEvent) override {}
288 
ClearExplicitAnimationOption()289     void ClearExplicitAnimationOption() override {}
290 
GetExplicitAnimationOption()291     AnimationOption GetExplicitAnimationOption() const override
292     {
293         return {};
294     }
295 
296     bool HasOnAreaChangeNode(int32_t nodeId);
297 
298     void AddOnAreaChangeNode(int32_t nodeId);
299 
300     void RemoveOnAreaChangeNode(int32_t nodeId);
301 
302     void HandleOnAreaChangeEvent(uint64_t nanoTimestamp);
303 
304     // Just register notification, no need to update callback.
305     void AddVisibleAreaChangeNode(const int32_t nodeId);
306 
307     void AddVisibleAreaChangeNode(const RefPtr<FrameNode>& node,
308         const std::vector<double>& ratio, const VisibleRatioCallback& callback, bool isUserCallback = true,
309         bool isCalculateInnerClip = false);
310     void RemoveVisibleAreaChangeNode(int32_t nodeId);
311 
312     void HandleVisibleAreaChangeEvent(uint64_t nanoTimestamp);
313 
SetAreaChangeNodeMinDepth(int32_t depth)314     void SetAreaChangeNodeMinDepth(int32_t depth)
315     {
316         if (areaChangeNodeMinDepth_ > 0) {
317             areaChangeNodeMinDepth_ = std::min(areaChangeNodeMinDepth_, depth);
318         } else {
319             areaChangeNodeMinDepth_ = depth;
320         }
321     }
322 
SetIsDisappearChangeNodeMinDepth(int32_t depth)323     void SetIsDisappearChangeNodeMinDepth(int32_t depth)
324     {
325         if (isDisappearChangeNodeMinDepth_ > 0) {
326             isDisappearChangeNodeMinDepth_ = std::min(isDisappearChangeNodeMinDepth_, depth);
327         } else {
328             isDisappearChangeNodeMinDepth_ = depth;
329         }
330     }
331 
332     void HandleSubwindow(bool isShow);
333 
334     void Destroy() override;
335 
336     void OnShow() override;
337 
338     void OnHide() override;
339 
340     void WindowFocus(bool isFocus) override;
341 
342     void WindowActivate(bool isActive) override;
343 
344     void ContainerModalUnFocus() override;
345 
346     void ShowContainerTitle(bool isShow, bool hasDeco = true, bool needUpdate = false) override;
347 
348     void SetAppBgColor(const Color& color) override;
349 
350     void SetWindowContainerColor(const Color& activeColor, const Color& inactiveColor) override;
351 
352     void SetAppTitle(const std::string& title) override;
353 
354     void SetAppIcon(const RefPtr<PixelMap>& icon) override;
355 
356     void OnSurfaceChanged(int32_t width, int32_t height,
357         WindowSizeChangeReason type = WindowSizeChangeReason::UNDEFINED,
358         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) override;
359 
360     void OnLayoutCompleted(const std::string& componentId);
361     void OnDrawCompleted(const std::string& componentId);
362     void OnDrawChildrenCompleted(const std::string& componentId);
363 
364     void OnSurfacePositionChanged(int32_t posX, int32_t posY) override;
365 
366     void OnSurfaceDensityChanged(double density) override;
367 
OnSystemBarHeightChanged(double statusBar,double navigationBar)368     void OnSystemBarHeightChanged(double statusBar, double navigationBar) override {}
369 
OnSurfaceDestroyed()370     void OnSurfaceDestroyed() override {}
371 
NotifyOnPreDraw()372     void NotifyOnPreDraw() override {}
373 
374     bool CallRouterBackToPopPage(bool* isUserAccept = nullptr) override
375     {
376         return OnBackPressed();
377     }
378 
379     bool OnBackPressed();
380 
381     RefPtr<FrameNode> FindNavigationNodeToHandleBack(const RefPtr<UINode>& node, bool& isEntry);
382 
383     void AddDirtyPropertyNode(const RefPtr<FrameNode>& dirty);
384 
385     void AddDirtyCustomNode(const RefPtr<UINode>& dirtyNode);
386 
387     void AddDirtyLayoutNode(const RefPtr<FrameNode>& dirty);
388 
389     void AddIgnoreLayoutSafeAreaBundle(IgnoreLayoutSafeAreaBundle&& bundle);
390 
391     void AddLayoutNode(const RefPtr<FrameNode>& layoutNode);
392 
393     void AddDirtyRenderNode(const RefPtr<FrameNode>& dirty);
394 
395     void AddDirtyFreezeNode(FrameNode* node);
396 
397     void AddPredictTask(PredictTask&& task);
398 
399     void AddAfterLayoutTask(std::function<void()>&& task, bool isFlushInImplicitAnimationTask = false);
400 
401     void AddPersistAfterLayoutTask(std::function<void()>&& task);
402 
403     void AddAfterModifierTask(std::function<void()>&& task);
404 
405     void AddAfterRenderTask(std::function<void()>&& task);
406 
407     void AddSafeAreaPaddingProcessTask(FrameNode* node);
408     void RemoveSafeAreaPaddingProcessTask(FrameNode* node);
409 
AddDragWindowVisibleTask(std::function<void ()> && task)410     void AddDragWindowVisibleTask(std::function<void()>&& task)
411     {
412         dragWindowVisibleCallback_ = std::move(task);
413     }
414 
415     void FlushOnceVsyncTask() override;
416 
417     void FlushFreezeNode();
418     void FlushDirtyPropertyNodes();
419     void FlushDirtyNodeUpdate();
420     void FlushSafeAreaPaddingProcess();
421 
422     void FlushTSUpdates();
423     void SetFlushTSUpdates(std::function<bool(int32_t)>&& flushTSUpdates) override;
424 
425     void SetRootRect(double width, double height, double offset) override;
426 
427     void SetWindowSceneConsumed(bool isConsumed);
428 
429     bool IsWindowSceneConsumed();
430 
431     void UpdateSystemSafeArea(const SafeAreaInsets& systemSafeArea, bool checkSystemWindow = false) override;
432     void UpdateCutoutSafeArea(const SafeAreaInsets& cutoutSafeArea, bool checkSystemWindow = false) override;
433     void UpdateNavSafeArea(const SafeAreaInsets& navSafeArea, bool checkSystemWindow = false) override;
434 
435     void UpdateSystemSafeAreaWithoutAnimation(const SafeAreaInsets& systemSafeArea,
436         bool checkSceneBoardWindow = false) override;
437 
438     void UpdateCutoutSafeAreaWithoutAnimation(const SafeAreaInsets& cutoutSafeArea,
439         bool checkSceneBoardWindow = false) override;
440 
441     void UpdateNavSafeAreaWithoutAnimation(const SafeAreaInsets& navSafeArea,
442         bool checkSceneBoardWindow = false) override;
443 
444     void UpdateOriginAvoidArea(const Rosen::AvoidArea& avoidArea, uint32_t type) override;
445 
446     float GetPageAvoidOffset() override;
447 
448     bool CheckSourceTypeChange(SourceType currentSourceType);
449 
450     bool CheckNeedAvoidInSubWindow() override;
451 
452     void CheckAndUpdateKeyboardInset(float keyboardHeight) override;
453 
454     void UpdateSizeChangeReason(
455         WindowSizeChangeReason type, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
456 
UpdateDisplayAvailableRect(const Rect & displayAvailableRect)457     void UpdateDisplayAvailableRect(const Rect& displayAvailableRect)
458     {
459         displayAvailableRect_ = displayAvailableRect;
460     }
GetDisplayAvailableRect()461     Rect GetDisplayAvailableRect() const
462     {
463         return displayAvailableRect_;
464     }
465 
466     void SetEnableKeyBoardAvoidMode(KeyBoardAvoidMode value) override;
467 
468     KeyBoardAvoidMode GetEnableKeyBoardAvoidMode() override;
469 
470     bool UsingCaretAvoidMode();
471 
472     void OnCaretPositionChangeOrKeyboardHeightChange(float keyboardHeight, double positionY, double height,
473         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, bool forceChange = false);
474     void DoKeyboardAvoidFunc(float keyboardHeight, double positionY, double height,
475         bool keyboardHeightChanged);
476     float CalcNewKeyboardOffset(float keyboardHeight, float positionYWithOffset,
477         float height, SizeF& rootSize, bool isInline = false);
478     float CalcAvoidOffset(float keyboardHeight, float positionYWithOffset,
479         float height, SizeF rootSize);
480 
481     bool IsEnableKeyBoardAvoidMode() override;
482 
GetSafeAreaManager()483     const RefPtr<SafeAreaManager>& GetSafeAreaManager() const
484     {
485         return safeAreaManager_;
486     }
487     virtual SafeAreaInsets GetSafeArea() const;
488 
489     virtual SafeAreaInsets GetSafeAreaWithoutProcess() const;
490 
491     const RefPtr<FullScreenManager>& GetFullScreenManager();
492 
493     RefPtr<AccessibilityManagerNG> GetAccessibilityManagerNG();
494 
495     void SendEventToAccessibilityWithNode(
496         const AccessibilityEvent& accessibilityEvent, const RefPtr<FrameNode>& node);
497 
498     const RefPtr<StageManager>& GetStageManager();
499 
500     const RefPtr<OverlayManager>& GetOverlayManager();
501 
502     const RefPtr<SelectOverlayManager>& GetSelectOverlayManager();
503 
GetSharedOverlayManager()504     const RefPtr<SharedOverlayManager>& GetSharedOverlayManager()
505     {
506         return sharedTransitionManager_;
507     }
508 
509 #ifdef WINDOW_SCENE_SUPPORTED
GetUIExtensionManager()510     const RefPtr<UIExtensionManager>& GetUIExtensionManager()
511     {
512         return uiExtensionManager_;
513     }
514 #endif
515 
516     const RefPtr<DragDropManager>& GetDragDropManager();
517 
518     const RefPtr<FocusManager>& GetFocusManager() const;
519 
520     const RefPtr<FocusManager>& GetOrCreateFocusManager();
521 
GetFrameRateManager()522     const RefPtr<FrameRateManager>& GetFrameRateManager()
523     {
524         return frameRateManager_;
525     }
526 
527     void FlushBuild() override;
528 
529     void FlushPipelineImmediately() override;
530     void RebuildFontNode() override;
531 
532     void AddBuildFinishCallBack(std::function<void()>&& callback);
533 
534     void AddWindowStateChangedCallback(int32_t nodeId);
535 
536     void RemoveWindowStateChangedCallback(int32_t nodeId);
537 
538     void AddWindowFocusChangedCallback(int32_t nodeId);
539 
540     void RemoveWindowFocusChangedCallback(int32_t nodeId);
541 
542     void AddWindowActivateChangedCallback(int32_t nodeId);
543 
544     void RemoveWindowActivateChangedCallback(int32_t nodeId);
545 
546     void AddWindowSizeChangeCallback(int32_t nodeId);
547 
548     void RemoveWindowSizeChangeCallback(int32_t nodeId);
549 
550     void AddWindowSizeDragEndCallback(std::function<void()>&& callback);
551 
552     void AddNavigationNode(int32_t pageId, WeakPtr<UINode> navigationNode);
553 
554     void RemoveNavigationNode(int32_t pageId, int32_t nodeId);
555 
556     void FirePageChanged(int32_t pageId, bool isOnShow);
557 
558     bool HasDifferentDirectionGesture() const;
559 
IsKeyInPressed(KeyCode tarCode)560     bool IsKeyInPressed(KeyCode tarCode) const
561     {
562         CHECK_NULL_RETURN(eventManager_, false);
563         return eventManager_->IsKeyInPressed(tarCode);
564     }
565 
GetIsFocusingByTab()566     bool GetIsFocusingByTab() const
567     {
568         return isFocusingByTab_;
569     }
570 
SetIsFocusingByTab(bool isFocusingByTab)571     void SetIsFocusingByTab(bool isFocusingByTab)
572     {
573         isFocusingByTab_ = isFocusingByTab;
574     }
575 
GetIsFocusActive()576     bool GetIsFocusActive() const
577     {
578         return focusManager_ ? focusManager_->GetIsFocusActive() : false;
579     }
580 
581     bool SetIsFocusActive(bool isFocusActive,
582         FocusActiveReason reason = FocusActiveReason::DEFAULT, bool autoFocusInactive = true);
583 
584     void AddIsFocusActiveUpdateEvent(const RefPtr<FrameNode>& node, const std::function<void(bool)>& eventCallback);
585     void RemoveIsFocusActiveUpdateEvent(const RefPtr<FrameNode>& node);
586 
IsTabJustTriggerOnKeyEvent()587     bool IsTabJustTriggerOnKeyEvent() const
588     {
589         return eventManager_->IsTabJustTriggerOnKeyEvent();
590     }
591 
GetOnShow()592     bool GetOnShow() const override
593     {
594         return onShow_;
595     }
596 
597     bool ChangeMouseStyle(int32_t nodeId, MouseFormat format, int32_t windowId = 0, bool isByPass = false,
598         MouseStyleChangeReason reason = MouseStyleChangeReason::INNER_SET_MOUSESTYLE);
599 
600     bool RequestFocus(const std::string& targetNodeId, bool isSyncRequest = false) override;
601     void AddDirtyFocus(const RefPtr<FrameNode>& node);
602     void AddDirtyRequestFocus(const RefPtr<FrameNode>& node);
603     void RootLostFocus(BlurReason reason = BlurReason::FOCUS_SWITCH) const;
604 
605     void SetContainerWindow(bool isShow, RRect& rRect);
606     void SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose) override;
607     void EnableContainerModalGesture(bool isEnable) override;
608     void SetCloseButtonStatus(bool isEnabled);
609 
610     void AddNodesToNotifyMemoryLevel(int32_t nodeId);
611     void RemoveNodesToNotifyMemoryLevel(int32_t nodeId);
612     void NotifyMemoryLevel(int32_t level) override;
613     void FlushModifier() override;
614     void FlushMessages(std::function<void()> callback = nullptr) override;
615 
616     void FlushUITasks(bool triggeredByImplicitAnimation = false) override;
617     void FlushUITaskWithSingleDirtyNode(const RefPtr<FrameNode>& node);
618 
619     void FlushAfterLayoutCallbackInImplicitAnimationTask() override;
620 
GetIsRequestVsync()621     bool GetIsRequestVsync()
622     {
623         return window_->GetIsRequestVsync();
624     }
625 
IsLayouting()626     bool IsLayouting() const override
627     {
628         return taskScheduler_->IsLayouting();
629     }
630     // end pipeline, exit app
631     void Finish(bool autoFinish) const override;
GetRootRect()632     RectF GetRootRect()
633     {
634         CHECK_NULL_RETURN(rootNode_, RectF());
635         auto geometryNode = rootNode_->GetGeometryNode();
636         CHECK_NULL_RETURN(geometryNode, RectF());
637         return geometryNode->GetFrameRect();
638     }
639 
640     void FlushReload(const ConfigurationChange& configurationChange, bool fullUpdate = true) override;
OnFlushReloadFinish()641     void OnFlushReloadFinish()
642     {
643         auto tasks = std::move(afterReloadAnimationTasks_);
644         for (const auto& task : tasks) {
645             if (task) {
646                 task();
647             }
648         }
649     }
AddAfterReloadAnimationTask(std::function<void ()> && task)650     void AddAfterReloadAnimationTask(std::function<void()>&& task)
651     {
652         afterReloadAnimationTasks_.emplace_back(std::move(task));
653     }
654 
RegisterSurfaceChangedCallback(std::function<void (int32_t,int32_t,int32_t,int32_t,WindowSizeChangeReason)> && callback)655     int32_t RegisterSurfaceChangedCallback(
656         std::function<void(int32_t, int32_t, int32_t, int32_t, WindowSizeChangeReason)>&& callback)
657     {
658         if (callback) {
659             surfaceChangedCallbackMap_.emplace(++callbackId_, std::move(callback));
660             return callbackId_;
661         }
662         return 0;
663     }
664 
UnregisterSurfaceChangedCallback(int32_t callbackId)665     void UnregisterSurfaceChangedCallback(int32_t callbackId)
666     {
667         surfaceChangedCallbackMap_.erase(callbackId);
668     }
669 
RegisterFoldStatusChangedCallback(std::function<void (FoldStatus)> && callback)670     int32_t RegisterFoldStatusChangedCallback(std::function<void(FoldStatus)>&& callback)
671     {
672         if (callback) {
673             foldStatusChangedCallbackMap_.emplace(callbackId_, std::move(callback));
674             return callbackId_;
675         }
676         return 0;
677     }
678 
UnRegisterFoldStatusChangedCallback(int32_t callbackId)679     void UnRegisterFoldStatusChangedCallback(int32_t callbackId)
680     {
681         foldStatusChangedCallbackMap_.erase(callbackId);
682     }
683 
RegisterHalfFoldHoverChangedCallback(std::function<void (bool)> && callback)684     int32_t RegisterHalfFoldHoverChangedCallback(std::function<void(bool)>&& callback)
685     {
686         if (callback) {
687             halfFoldHoverChangedCallbackMap_.emplace(++callbackId_, std::move(callback));
688             return callbackId_;
689         }
690         return 0;
691     }
692 
UnRegisterHalfFoldHoverChangedCallback(int32_t callbackId)693     void UnRegisterHalfFoldHoverChangedCallback(int32_t callbackId)
694     {
695         halfFoldHoverChangedCallbackMap_.erase(callbackId);
696     }
697 
RegisterRawKeyboardChangedCallback(std::function<void ()> && callback)698     int32_t RegisterRawKeyboardChangedCallback(std::function<void()>&& callback)
699     {
700         if (callback) {
701             rawKeyboardChangedCallbackMap_.emplace(++callbackId_, std::move(callback));
702             return callbackId_;
703         }
704         return 0;
705     }
706 
UnRegisterRawKeyboardChangedCallback(int32_t callbackId)707     void UnRegisterRawKeyboardChangedCallback(int32_t callbackId)
708     {
709         rawKeyboardChangedCallbackMap_.erase(callbackId);
710     }
711 
712     void UpdateHalfFoldHoverStatus(int32_t windowWidth, int32_t windowHeight);
713 
IsHalfFoldHoverStatus()714     bool IsHalfFoldHoverStatus()
715     {
716         return isHalfFoldHoverStatus_;
717     }
718 
719     void OnHalfFoldHoverChangedCallback();
720 
721     void OnRawKeyboardChangedCallback() override;
722 
RegisterFoldDisplayModeChangedCallback(std::function<void (FoldDisplayMode)> && callback)723     int32_t RegisterFoldDisplayModeChangedCallback(std::function<void(FoldDisplayMode)>&& callback)
724     {
725         if (callback) {
726             foldDisplayModeChangedCallbackMap_.emplace(++callbackId_, std::move(callback));
727             return callbackId_;
728         }
729         return 0;
730     }
731 
UnRegisterFoldDisplayModeChangedCallback(int32_t callbackId)732     void UnRegisterFoldDisplayModeChangedCallback(int32_t callbackId)
733     {
734         foldDisplayModeChangedCallbackMap_.erase(callbackId);
735     }
736 
RegisterSurfacePositionChangedCallback(std::function<void (int32_t,int32_t)> && callback)737     int32_t RegisterSurfacePositionChangedCallback(std::function<void(int32_t, int32_t)>&& callback)
738     {
739         if (callback) {
740             surfacePositionChangedCallbackMap_.emplace(++callbackId_, std::move(callback));
741             return callbackId_;
742         }
743         return 0;
744     }
745 
UnregisterSurfacePositionChangedCallback(int32_t callbackId)746     void UnregisterSurfacePositionChangedCallback(int32_t callbackId)
747     {
748         surfacePositionChangedCallbackMap_.erase(callbackId);
749     }
750 
RegisterTransformHintChangeCallback(std::function<void (uint32_t)> && callback)751     int32_t RegisterTransformHintChangeCallback(std::function<void(uint32_t)>&& callback)
752     {
753         if (callback) {
754             transformHintChangedCallbackMap_.emplace(++callbackId_, std::move(callback));
755             return callbackId_;
756         }
757         return 0;
758     }
759 
UnregisterTransformHintChangedCallback(int32_t callbackId)760     void UnregisterTransformHintChangedCallback(int32_t callbackId)
761     {
762         transformHintChangedCallbackMap_.erase(callbackId);
763     }
764 
SetMouseStyleHoldNode(int32_t id)765     bool SetMouseStyleHoldNode(int32_t id)
766     {
767         CHECK_NULL_RETURN(eventManager_, false);
768         auto mouseStyleManager = eventManager_->GetMouseStyleManager();
769         if (mouseStyleManager) {
770             return mouseStyleManager->SetMouseStyleHoldNode(id);
771         }
772         return false;
773     }
774 
FreeMouseStyleHoldNode(int32_t id)775     bool FreeMouseStyleHoldNode(int32_t id)
776     {
777         CHECK_NULL_RETURN(eventManager_, false);
778         auto mouseStyleManager = eventManager_->GetMouseStyleManager();
779         if (mouseStyleManager) {
780             return mouseStyleManager->FreeMouseStyleHoldNode(id);
781         }
782         return false;
783     }
784 
FreeMouseStyleHoldNode()785     bool FreeMouseStyleHoldNode()
786     {
787         CHECK_NULL_RETURN(eventManager_, false);
788         auto mouseStyleManager = eventManager_->GetMouseStyleManager();
789         if (mouseStyleManager) {
790             return mouseStyleManager->FreeMouseStyleHoldNode();
791         }
792         return false;
793     }
794 
795     void MarkNeedFlushMouseEvent(MockFlushEventType type = MockFlushEventType::EXECUTE)
796     {
797         isNeedFlushMouseEvent_ = type;
798     }
799 
MarkNeedFlushAnimationStartTime()800     void MarkNeedFlushAnimationStartTime()
801     {
802         isNeedFlushAnimationStartTime_ = true;
803     }
804 
805     // font
806     void AddFontNodeNG(const WeakPtr<UINode>& node);
807     void RemoveFontNodeNG(const WeakPtr<UINode>& node);
808 
809     // restore
810     void RestoreNodeInfo(std::unique_ptr<JsonValue> nodeInfo) override;
811     std::unique_ptr<JsonValue> GetStoredNodeInfo() override;
812     void StoreNode(int32_t restoreId, const WeakPtr<FrameNode>& node);
813     bool GetRestoreInfo(int32_t restoreId, std::string& restoreInfo);
RemoveStoredNode(int32_t restoreId)814     void RemoveStoredNode(int32_t restoreId)
815     {
816         storeNode_.erase(restoreId);
817     }
818     void SetNeedRenderNode(const WeakPtr<FrameNode>& node);
819 
820     void SetIgnoreViewSafeArea(bool value) override;
821     void SetIsLayoutFullScreen(bool value) override;
822     void SetIsNeedAvoidWindow(bool value) override;
823 
824     void AddAnimationClosure(std::function<void()>&& animation);
825     void FlushAnimationClosure();
826     void DumpJsInfo(const std::vector<std::string>& params) const;
827     void DumpUIExt() const override;
828 
829     bool DumpPageViewData(const RefPtr<FrameNode>& node, RefPtr<ViewDataWrap> viewDataWrap,
830         bool skipSubAutoFillContainer = false, bool needsRecordData = false);
831     bool CheckNeedAutoSave();
832     bool CheckOverlayFocus();
833     void NotifyFillRequestSuccess(AceAutoFillType autoFillType, RefPtr<ViewDataWrap> viewDataWrap);
834     void NotifyFillRequestFailed(RefPtr<FrameNode> node, int32_t errCode,
835         const std::string& fillContent = "", bool isPopup = false);
836 
837     std::shared_ptr<NavigationController> GetNavigationController(const std::string& id) override;
838     void AddOrReplaceNavigationNode(const std::string& id, const WeakPtr<FrameNode>& node);
839     void DeleteNavigationNode(const std::string& id);
840 
AddGestureTask(const DelayedTask & task)841     void AddGestureTask(const DelayedTask& task)
842     {
843         delayedTasks_.emplace_back(task);
844     }
845 
RemoveGestureTask(const DelayedTask & task)846     void RemoveGestureTask(const DelayedTask& task)
847     {
848         for (auto iter = delayedTasks_.begin(); iter != delayedTasks_.end();) {
849             if (iter->recognizer == task.recognizer) {
850                 iter = delayedTasks_.erase(iter);
851             } else {
852                 ++iter;
853             }
854         }
855     }
856 
SetScreenNode(const RefPtr<FrameNode> & node)857     void SetScreenNode(const RefPtr<FrameNode>& node)
858     {
859         CHECK_NULL_VOID(node);
860         screenNode_ = AceType::WeakClaim(AceType::RawPtr(node));
861     }
GetScreenNode()862     RefPtr<FrameNode> GetScreenNode() const
863     {
864         return screenNode_.Upgrade();
865     }
866 
SetFocusedWindowSceneNode(const WeakPtr<FrameNode> & node)867     void SetFocusedWindowSceneNode(const WeakPtr<FrameNode>& node)
868     {
869         windowSceneNode_ = node;
870     }
GetFocusedWindowSceneNode()871     RefPtr<FrameNode> GetFocusedWindowSceneNode() const
872     {
873         return windowSceneNode_.Upgrade();
874     }
875 
876     void SetJSViewActive(bool active, WeakPtr<CustomNode> custom);
877 
UpdateCurrentActiveNode(const WeakPtr<FrameNode> & node)878     void UpdateCurrentActiveNode(const WeakPtr<FrameNode>& node) override
879     {
880         activeNode_ = std::move(node);
881     }
882 
GetCurrentActiveNode()883     const WeakPtr<FrameNode>& GetCurrentActiveNode() const
884     {
885         return activeNode_;
886     }
887 
888     std::string GetCurrentExtraInfo() override;
889     void UpdateTitleInTargetPos(bool isShow, int32_t height) override;
890 
891     void SetCursor(int32_t cursorValue) override;
892 
893     void RestoreDefault(int32_t windowId, MouseStyleChangeReason reason) override;
894 
895     void OnFoldStatusChange(FoldStatus foldStatus) override;
896     void OnFoldDisplayModeChange(FoldDisplayMode foldDisplayMode) override;
897 
898     void OnTransformHintChanged(uint32_t transform) override;
899 
GetTransformHint()900     uint32_t GetTransformHint() const
901     {
902         return transform_;
903     }
904 
905     // for frontend animation interface.
906     void OpenFrontendAnimation(
907         const AnimationOption& option, const RefPtr<Curve>& curve, const std::function<void()>& finishCallback);
908     void CloseFrontendAnimation();
909 
910     bool IsDragging() const override;
911     void SetIsDragging(bool isDragging) override;
912 
913     void ResetDragging() override;
914     const RefPtr<PostEventManager>& GetPostEventManager();
915 
916     void SetContainerModalTitleVisible(bool customTitleSettedShow, bool floatingTitleSettedShow);
917     void SetContainerModalTitleHeight(int32_t height);
918     int32_t GetContainerModalTitleHeight();
919     bool GetContainerModalButtonsRect(RectF& containerModal, RectF& buttons);
920     void SubscribeContainerModalButtonsRectChange(
921         std::function<void(RectF& containerModal, RectF& buttons)>&& callback);
922     void GetWindowPaintRectWithoutMeasureAndLayout(RectInt& rect);
923 
924     const SerializedGesture& GetSerializedGesture() const override;
925     // return value means whether it has printed info
926     bool PrintVsyncInfoIfNeed() const override;
927     void SetUIExtensionImeShow(bool imeShow);
928 
StartWindowAnimation()929     void StartWindowAnimation() override
930     {
931         isWindowAnimation_ = true;
932     }
933 
934     void StopWindowAnimation() override;
935 
936     void AddSyncGeometryNodeTask(std::function<void()>&& task) override;
937     void FlushSyncGeometryNodeTasks() override;
938     void SetVsyncListener(VsyncCallbackFun vsync);
939 
SetOnceVsyncListener(VsyncCallbackFun vsync)940     void SetOnceVsyncListener(VsyncCallbackFun vsync)
941     {
942         onceVsyncListener_ = std::move(vsync);
943     }
944 
HasOnceVsyncListener()945     bool HasOnceVsyncListener() {
946         return onceVsyncListener_ != nullptr;
947     }
948 
GetMemoryManager()949     const RefPtr<MemoryManager>& GetMemoryManager() const
950     {
951         return memoryMgr_;
952     }
953 
GetNavigationManager()954     const RefPtr<NavigationManager>& GetNavigationManager() const
955     {
956         return navigationMgr_;
957     }
958 
GetForceSplitManager()959     const RefPtr<ForceSplitManager>& GetForceSplitManager() const
960     {
961         return forceSplitMgr_;
962     }
963 
GetFormVisibleManager()964     const RefPtr<FormVisibleManager>& GetFormVisibleManager() const
965     {
966         return formVisibleMgr_;
967     }
968 
GetFormEventManager()969     const RefPtr<FormEventManager>& GetFormEventManager() const
970     {
971         return formEventMgr_;
972     }
973 
GetFormGestureManager()974     const RefPtr<FormGestureManager>& GetFormGestureManager() const
975     {
976         return formGestureMgr_;
977     }
978 
GetAvoidInfoManager()979     const RefPtr<AvoidInfoManager>& GetAvoidInfoManager() const
980     {
981         return avoidInfoMgr_;
982     }
983 
GetRecycleManager()984     const std::unique_ptr<RecycleManager>& GetRecycleManager() const
985     {
986         return recycleManager_;
987     }
988 
GetPrivacySensitiveManager()989     RefPtr<PrivacySensitiveManager> GetPrivacySensitiveManager() const
990     {
991         return privacySensitiveManager_;
992     }
993 
GetToolbarManager()994     const RefPtr<ToolbarManager>& GetToolbarManager() const
995     {
996         return toolbarManager_;
997     }
998 
ChangeSensitiveNodes(bool flag)999     void ChangeSensitiveNodes(bool flag) override
1000     {
1001         privacySensitiveManager_->TriggerFrameNodesSensitive(flag);
1002     }
1003 
1004     void FlushRequestFocus();
1005 
1006     Dimension GetCustomTitleHeight();
1007 
1008     void SetOverlayNodePositions(std::vector<Ace::RectF> rects);
1009 
1010     static void SetCallBackNode(const WeakPtr<NG::FrameNode>& node);
1011 
1012     std::vector<Ace::RectF> GetOverlayNodePositions();
1013 
1014     void RegisterOverlayNodePositionsUpdateCallback(
1015         const std::function<void(std::vector<Ace::RectF>)>&& callback);
1016 
1017     void TriggerOverlayNodePositionsUpdateCallback(std::vector<Ace::RectF> rects);
1018 
1019     void DetachNode(RefPtr<UINode> uiNode);
1020 
1021     void CheckNeedUpdateBackgroundColor(Color& color);
1022 
1023     bool CheckNeedDisableUpdateBackgroundImage();
1024 
1025     void ChangeDarkModeBrightness() override;
1026 
1027     std::string GetResponseRegion(const RefPtr<NG::FrameNode>& rootNode) override;
1028 
1029     void NotifyResponseRegionChanged(const RefPtr<NG::FrameNode>& rootNode) override;
1030 
1031     void DisableNotifyResponseRegionChanged() override;
1032 
SetLocalColorMode(ColorMode colorMode)1033     void SetLocalColorMode(ColorMode colorMode)
1034     {
1035         auto localColorModeValue = static_cast<int32_t>(colorMode);
1036         localColorMode_ = localColorModeValue;
1037     }
1038 
GetLocalColorMode()1039     ColorMode GetLocalColorMode() const // ColorMode for WithTheme
1040     {
1041         ColorMode colorMode = static_cast<ColorMode>(localColorMode_.load());
1042         return colorMode;
1043     }
1044 
1045     ColorMode GetColorMode() const;
1046 
SetIsFreezeFlushMessage(bool isFreezeFlushMessage)1047     void SetIsFreezeFlushMessage(bool isFreezeFlushMessage)
1048     {
1049         isFreezeFlushMessage_ = isFreezeFlushMessage;
1050     }
1051 
IsFreezeFlushMessage()1052     bool IsFreezeFlushMessage() const
1053     {
1054         return isFreezeFlushMessage_;
1055     }
1056     bool IsContainerModalVisible() const override;
SetDoKeyboardAvoidAnimate(bool isDoKeyboardAvoidAnimate)1057     void SetDoKeyboardAvoidAnimate(bool isDoKeyboardAvoidAnimate)
1058     {
1059         isDoKeyboardAvoidAnimate_ = isDoKeyboardAvoidAnimate;
1060     }
1061 
1062     void CheckAndLogLastReceivedTouchEventInfo(int32_t eventId, TouchType type) override;
1063 
1064     void CheckAndLogLastConsumedTouchEventInfo(int32_t eventId, TouchType type) override;
1065 
1066     void CheckAndLogLastReceivedMouseEventInfo(int32_t eventId, MouseAction action) override;
1067 
1068     void CheckAndLogLastConsumedMouseEventInfo(int32_t eventId, MouseAction action) override;
1069 
1070     void CheckAndLogLastReceivedAxisEventInfo(int32_t eventId, AxisAction action) override;
1071 
1072     void CheckAndLogLastConsumedAxisEventInfo(int32_t eventId, AxisAction action) override;
1073 
1074     void AddFrameCallback(FrameCallbackFunc&& frameCallbackFunc, IdleCallbackFunc&& idleCallbackFunc,
1075         int64_t delayMillis);
1076 
1077     void FlushFrameCallback(uint64_t nanoTimestamp, uint64_t frameCount);
1078     void TriggerIdleCallback(int64_t deadline);
1079 
1080     void AddCAPIFrameCallback(FrameCallbackFuncFromCAPI&& frameCallbackFuncFromCAPI);
1081     void FlushFrameCallbackFromCAPI(uint64_t nanoTimestamp, uint64_t frameCount);
1082 
1083     void RegisterTouchEventListener(const std::shared_ptr<ITouchEventCallback>& listener);
1084     void UnregisterTouchEventListener(const WeakPtr<NG::Pattern>& pattern);
1085 
SetPredictNode(const RefPtr<FrameNode> & node)1086     void SetPredictNode(const RefPtr<FrameNode>& node)
1087     {
1088         predictNode_ = node;
1089     }
1090 
ResetPredictNode()1091     void ResetPredictNode()
1092     {
1093         predictNode_.Reset();
1094     }
1095 
1096     void PreLayout(uint64_t nanoTimestamp, uint32_t frameCount);
1097 
IsDensityChanged()1098     bool IsDensityChanged() const override
1099     {
1100         return isDensityChanged_;
1101     }
1102 
IsNeedReloadDensity()1103     bool IsNeedReloadDensity() const override
1104     {
1105         return isNeedReloadDensity_;
1106     }
1107 
SetIsNeedReloadDensity(bool isNeedReloadDensity)1108     void SetIsNeedReloadDensity(bool isNeedReloadDensity) override
1109     {
1110         isNeedReloadDensity_ = isNeedReloadDensity;
1111     }
1112 
1113     void GetInspectorTree(bool onlyNeedVisible);
1114     void NotifyAllWebPattern(bool isRegister);
1115     void AddFrameNodeChangeListener(const WeakPtr<FrameNode>& node);
1116     void RemoveFrameNodeChangeListener(int32_t nodeId);
1117     bool AddChangedFrameNode(const WeakPtr<FrameNode>& node);
1118     void RemoveChangedFrameNode(int32_t nodeId);
1119 
1120     bool CatchInteractiveAnimations(const std::function<void()>& animationCallback) override;
1121 
IsWindowFocused()1122     bool IsWindowFocused() const override
1123     {
1124         return isWindowHasFocused_ && GetOnFocus();
1125     }
1126 
1127     void CollectTouchEventsBeforeVsync(std::list<TouchEvent>& touchEvents);
1128 
IsDirtyNodesEmpty()1129     bool IsDirtyNodesEmpty() const override
1130     {
1131         return dirtyNodes_.empty();
1132     }
1133 
IsDirtyLayoutNodesEmpty()1134     bool IsDirtyLayoutNodesEmpty() const override
1135     {
1136         return taskScheduler_->IsDirtyLayoutNodesEmpty();
1137     }
1138 
IsDirtyPropertyNodesEmpty()1139     bool IsDirtyPropertyNodesEmpty() const override
1140     {
1141         return dirtyPropertyNodes_.empty();
1142     }
1143 
1144     void SyncSafeArea(SafeAreaSyncType syncType = SafeAreaSyncType::SYNC_TYPE_NONE);
1145     bool CheckThreadSafe();
1146 
IsHoverModeChange()1147     bool IsHoverModeChange() const
1148     {
1149         return isHoverModeChanged_;
1150     }
1151 
1152     void UpdateHalfFoldHoverProperty(int32_t windowWidth, int32_t windowHeight);
1153 
1154     void AnimateOnSafeAreaUpdate();
1155     void RegisterAttachedNode(UINode* uiNode);
1156     void RemoveAttachedNode(UINode* uiNode);
1157 
1158     void NotifyColorModeChange(uint32_t colorMode) override;
1159 
1160     bool GetContainerFloatingTitleVisible() override;
1161 
1162     bool GetContainerCustomTitleVisible() override;
1163 
1164     bool GetContainerControlButtonVisible() override;
1165 
1166     std::string GetBundleName();
1167     std::string GetModuleName();
1168 
SaveTranslateManager(std::shared_ptr<UiTranslateManagerImpl> uiTranslateManager)1169     void SaveTranslateManager(std::shared_ptr<UiTranslateManagerImpl> uiTranslateManager)
1170     {
1171         uiTranslateManager_ = uiTranslateManager;
1172     }
1173 
RegisterListenerForTranslate(const WeakPtr<NG::FrameNode> node)1174     void RegisterListenerForTranslate(const WeakPtr<NG::FrameNode> node)
1175     {
1176         uiTranslateManager_->AddTranslateListener(node);
1177     }
1178 
UnRegisterListenerForTranslate(int32_t nodeId)1179     void UnRegisterListenerForTranslate(int32_t nodeId)
1180     {
1181         uiTranslateManager_->RemoveTranslateListener(nodeId);
1182     }
1183 
SetEnableSwipeBack(bool isEnable)1184     void SetEnableSwipeBack(bool isEnable) override
1185     {
1186         enableSwipeBack_ = isEnable;
1187     }
1188 
GetHostParentOffsetToWindow()1189     Offset GetHostParentOffsetToWindow() const
1190     {
1191         return lastHostParentOffsetToWindow_;
1192     }
1193 
1194     void SetHostParentOffsetToWindow(const Offset& offset);
1195 
1196     RefPtr<Kit::UIContext> GetUIContext();
1197     void AddPendingDeleteCustomNode(const RefPtr<CustomNode>& node);
1198     void FlushPendingDeleteCustomNode();
1199 
1200     void HandleSpecialContainerNode();
1201 
AddPositionZNode(int32_t nodeId)1202     void AddPositionZNode(int32_t nodeId)
1203     {
1204         positionZNodes_.insert(nodeId);
1205     }
1206 
DeletePositionZNode(int32_t nodeId)1207     void DeletePositionZNode(int32_t nodeId)
1208     {
1209         auto it = positionZNodes_.find(nodeId);
1210         if (it != positionZNodes_.end()) {
1211             positionZNodes_.erase(it);
1212         }
1213     }
1214 
GetPositionZNodes()1215     std::set<int32_t> GetPositionZNodes()
1216     {
1217         return positionZNodes_;
1218     }
1219 
ClearPositionZNodes()1220     void ClearPositionZNodes()
1221     {
1222         positionZNodes_.clear();
1223     }
IsWindowSizeDragging()1224     bool IsWindowSizeDragging() const
1225     {
1226         return isWindowSizeDragging_;
1227     }
1228 
1229     void SetIsWindowSizeDragging(bool isDragging);
1230     void GetAllPixelMap();
1231     std::shared_ptr<Rosen::RSUIDirector> GetRSUIDirector();
AddPixelMap(int32_t nodeId,RefPtr<PixelMap> pixelMap)1232     void AddPixelMap(int32_t nodeId, RefPtr<PixelMap> pixelMap)
1233     {
1234         uiTranslateManager_->AddPixelMap(nodeId, pixelMap);
1235     }
1236 
GetOrCreateAIWriteAdapter()1237     WeakPtr<AIWriteAdapter> GetOrCreateAIWriteAdapter()
1238     {
1239         if (!aiWriteAdapter_) {
1240             aiWriteAdapter_ = MakeRefPtr<AIWriteAdapter>();
1241         }
1242         return aiWriteAdapter_;
1243     }
1244 
RegisterRotationEndCallback(std::function<void ()> && callback)1245     int32_t RegisterRotationEndCallback(std::function<void()>&& callback)
1246     {
1247         if (callback) {
1248             rotationEndCallbackMap_.emplace(++callbackId_, std::move(callback));
1249             return callbackId_;
1250         }
1251         return 0;
1252     }
1253 
UnregisterRotationEndCallback(int32_t callbackId)1254     void UnregisterRotationEndCallback(int32_t callbackId)
1255     {
1256         rotationEndCallbackMap_.erase(callbackId);
1257     }
1258 
1259     void SetNeedRenderForDrawChildrenNode(const WeakPtr<NG::UINode>& node);
1260     void NotifyDragTouchEvent(const TouchEvent& event, const RefPtr<NG::FrameNode>& node = nullptr);
1261     void NotifyDragMouseEvent(const MouseEvent& event);
1262     void NotifyDragOnHide();
1263 
AddToOcclusionMap(int32_t frameNodeId,bool enable)1264     void AddToOcclusionMap(int32_t frameNodeId, bool enable)
1265     {
1266         keyOcclusionNodes_[frameNodeId] = enable;
1267     }
1268     const RefPtr<NodeRenderStatusMonitor>& GetNodeRenderStatusMonitor();
1269     void RegisterArkUIObjectLifecycleCallback(Kit::ArkUIObjectLifecycleCallback&& callback);
1270     void UnregisterArkUIObjectLifecycleCallback();
1271     void FireArkUIObjectLifecycleCallback(void* data);
1272 
SetNeedCallbackAreaChange(bool needChange)1273     inline void SetNeedCallbackAreaChange(bool needChange)
1274     {
1275         isNeedCallbackAreaChange_ = needChange;
1276     }
1277 
1278     uint32_t ExeAppAIFunctionCallback(const std::string& funcName, const std::string& params);
1279     void OnDumpBindAICaller(const std::vector<std::string>& params) const;
1280 
1281 protected:
1282     void StartWindowSizeChangeAnimate(int32_t width, int32_t height, WindowSizeChangeReason type,
1283         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
1284     void StartWindowMaximizeAnimation(
1285         int32_t width, int32_t height, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
1286     void StartFullToMultWindowAnimation(int32_t width, int32_t height, WindowSizeChangeReason type,
1287         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
1288     void StartSplitWindowAnimation(int32_t width, int32_t height, WindowSizeChangeReason type,
1289         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
1290     void MaximizeInImplictAnimation(int32_t width, int32_t height, WindowSizeChangeReason type,
1291         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
1292 
1293     void FlushVsync(uint64_t nanoTimestamp, uint64_t frameCount) override;
1294     void FlushPipelineWithoutAnimation() override;
1295     void FlushFocus();
1296     void FlushFocusWithNode(RefPtr<FrameNode> focusNode, bool isScope);
1297     void DispatchDisplaySync(uint64_t nanoTimestamp) override;
1298     void FlushAnimation(uint64_t nanoTimestamp) override;
1299     bool OnDumpInfo(const std::vector<std::string>& params) const override;
1300     void OnDumpRecorderStart(const std::vector<std::string>& params) const;
1301     void TriggerFrameDumpFuncIfExist() const;
1302 
1303     void OnVirtualKeyboardHeightChange(float keyboardHeight,
1304         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, const float safeHeight = 0.0f,
1305         const bool supportAvoidance = false, bool forceChange = false) override;
1306     void OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height,
1307         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, bool forceChange = false) override;
1308     void FlushDirtyPropertyNodesWhenExist();
1309 
SetIsLayouting(bool layouting)1310     void SetIsLayouting(bool layouting)
1311     {
1312         taskScheduler_->SetIsLayouting(layouting);
1313     }
1314 
1315     void AvoidanceLogic(float keyboardHeight, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr,
1316         float safeHeight = 0.0f, const bool supportAvoidance = false);
1317     void OriginalAvoidanceLogic(
1318         float keyboardHeight, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
1319     RefPtr<FrameNode> GetContainerModalNode();
1320     void DoKeyboardAvoidAnimate(const KeyboardAnimationConfig& keyboardAnimationConfig, float keyboardHeight,
1321         const std::function<void()>& func);
1322     void StartFoldStatusDelayTask(FoldStatus foldStatus);
1323     void PostKeyboardAvoidTask();
1324 
1325 private:
1326     void ExecuteSurfaceChangedCallbacks(int32_t newWidth, int32_t newHeight, WindowSizeChangeReason type);
1327 
1328     void FlushWindowStateChangedCallback(bool isShow);
1329 
1330     void FlushWindowFocusChangedCallback(bool isFocus);
1331 
1332     void FlushWindowActivateChangedCallback(bool isActivate);
1333 
1334     void FlushWindowSizeChangeCallback(int32_t width, int32_t height, WindowSizeChangeReason type);
1335 
1336 
1337     uint64_t GetResampleStamp() const;
1338     void ConsumeTouchEvents(std::list<TouchEvent>& touchEvents, std::unordered_map<int, TouchEvent>& idToTouchPoints);
1339     void ConsumeTouchEventsInterpolation(
1340         const std::unordered_set<int32_t>& ids, const std::map<int32_t, int32_t>& timestampToIds,
1341         std::unordered_map<int32_t, TouchEvent>& newIdTouchPoints,
1342         const std::unordered_map<int, TouchEvent>& idToTouchPoints);
1343     void AccelerateConsumeTouchEvents(
1344         std::list<TouchEvent>& touchEvents, std::unordered_map<int, TouchEvent>& idToTouchPoints);
SetTouchAccelarate(bool isEnable)1345     void SetTouchAccelarate(bool isEnable) override
1346     {
1347         touchAccelarate_ = isEnable;
1348     }
SetTouchPassThrough(bool isEnable)1349     void SetTouchPassThrough(bool isEnable) override
1350     {
1351         isEventsPassThrough_ = isEnable;
1352     }
1353     void SetBackgroundColorModeUpdated(bool backgroundColorModeUpdated) override;
1354 
1355     void FlushTouchEvents();
1356     void FlushWindowPatternInfo();
1357     void FlushFocusView();
1358     void FlushFocusScroll();
1359 
1360     void ProcessDelayTasks();
1361 
1362     void InspectDrew();
1363 
1364     void FlushBuildFinishCallbacks();
1365 
1366     void DumpPipelineInfo() const;
1367 
1368     void RegisterRootEvent();
1369 
1370     void UpdateLastMoveEvent(const MouseEvent& event);
1371 
1372     void CompensateTouchMoveEvent(const TouchEvent& event);
1373 
1374     bool CompensateTouchMoveEventFromUnhandledEvents(const TouchEvent& event);
1375     void CompensateTouchMoveEventBeforeDown();
1376 
1377     void DispatchMouseToTouchEvent(const MouseEvent& event, const RefPtr<FrameNode>& node);
1378 
1379     void CompensateMouseMoveEvent(const MouseEvent& event, const RefPtr<FrameNode>& node);
1380 
1381     bool CompensateMouseMoveEventFromUnhandledEvents(const MouseEvent& event, const RefPtr<FrameNode>& node);
1382 
1383     void CompensatePointerMoveEvent(const DragPointerEvent& event, const RefPtr<FrameNode>& node);
1384 
1385     bool CompensatePointerMoveEventFromUnhandledEvents(const DragPointerEvent& event, const RefPtr<FrameNode>& node);
1386 
1387     FrameInfo* GetCurrentFrameInfo(uint64_t recvTime, uint64_t timeStamp);
1388 
1389     void DispatchAxisEventToDragDropManager(const AxisEvent& event, const RefPtr<FrameNode>& node,
1390         SerializedGesture& etsSerializedGesture);
1391 
1392     // only used for static form.
1393     void UpdateFormLinkInfos();
1394 
1395     void FlushFrameRate();
1396     void FlushDragWindowVisibleCallback();
1397 
1398     void RegisterFocusCallback();
1399     void DumpFocus(bool hasJson) const;
1400     void DumpResLoadError() const;
1401     void DumpInspector(const std::vector<std::string>& params, bool hasJson) const;
1402     void DumpElement(const std::vector<std::string>& params, bool hasJson) const;
1403     void DumpData(const RefPtr<FrameNode>& node, const std::vector<std::string>& params, bool hasJson) const;
1404     void OnDumpInjection(const std::vector<std::string>& params) const;
1405     void DumpForceColor(const std::vector<std::string>& params) const;
1406     void OnRotationAnimationEnd();
1407     template<typename T>
1408     struct NodeCompare {
operatorNodeCompare1409         bool operator()(const T& nodeLeft, const T& nodeRight) const
1410         {
1411             if (!nodeLeft || !nodeRight) {
1412                 return false;
1413             }
1414             if (nodeLeft->GetDepth() < nodeRight->GetDepth()) {
1415                 return true;
1416             }
1417             if (nodeLeft->GetDepth() == nodeRight->GetDepth()) {
1418                 return nodeLeft < nodeRight;
1419             }
1420             return false;
1421         }
1422     };
1423 
1424     void FlushNodeChangeFlag();
1425     void CleanNodeChangeFlag();
1426 
1427     void RSTransactionBegin(const std::shared_ptr<Rosen::RSUIDirector>& rsUIDirector);
1428     void RSTransactionCommit(const std::shared_ptr<Rosen::RSUIDirector>& rsUIDirector);
1429 
1430     uint64_t AdjustVsyncTimeStamp(uint64_t nanoTimestamp);
1431     bool FlushModifierAnimation(uint64_t nanoTimestamp);
1432 
1433     void FlushAnimationDirtysWhenExist(const AnimationOption& option);
1434 
1435     void UpdateOcclusionCullingStatus();
1436 
1437     void UpdateDVSyncTime(uint64_t nanoTimestamp, const std::string& abilityName, uint64_t vsyncPeriod);
1438 
1439     std::unique_ptr<UITaskScheduler> taskScheduler_ = std::make_unique<UITaskScheduler>();
1440 
1441     std::unordered_map<uint32_t, WeakPtr<ScheduleTask>> scheduleTasks_;
1442 
1443     std::list<WeakPtr<FrameNode>> dirtyFreezeNode_; // used in freeze feature.
1444     std::stack<RefPtr<CustomNode>> pendingDeleteCustomNode_;
1445     std::set<RefPtr<FrameNode>, NodeCompare<RefPtr<FrameNode>>> dirtyPropertyNodes_; // used in node api.
1446     std::set<RefPtr<UINode>, NodeCompare<RefPtr<UINode>>> dirtyNodes_;
1447     std::list<std::function<void()>> buildFinishCallbacks_;
1448 
1449     // window on show or on hide
1450     std::set<int32_t> onWindowStateChangedCallbacks_;
1451     // window on focused or on unfocused
1452     std::set<int32_t> onWindowFocusChangedCallbacks_;
1453     // window on activate or on unactivate
1454     std::set<int32_t> onWindowActivateChangedCallbacks_;
1455     // window on drag
1456     std::list<int32_t> onWindowSizeChangeCallbacks_;
1457     // window size drag end
1458     std::list<std::function<void()>> onWindowSizeDragEndCallbacks_;
1459 
1460     std::list<int32_t> nodesToNotifyMemoryLevel_;
1461 
1462     std::list<TouchEvent> touchEvents_;
1463 
1464     std::map<RefPtr<FrameNode>, std::list<DragPointerEvent>> dragEvents_;
1465     std::map<RefPtr<FrameNode>, std::list<MouseEvent>> mouseEvents_;
1466     std::vector<std::function<void(const std::vector<std::string>&)>> dumpListeners_;
1467 
1468     RefPtr<FrameNode> rootNode_;
1469 
1470     int32_t curFocusNodeId_ = -1;
1471 
1472     bool isTransFlag_ = false;
1473     OHOS::Ace::WindowSizeChangeReason windowSizeChangeReason_ = WindowSizeChangeReason::UNDEFINED;
1474     SourceType lastSourceType_ = SourceType::NONE;
1475     bool preIsHalfFoldHoverStatus_ = false;
1476     bool isHoverModeChanged_ = false;
1477 
1478     std::set<WeakPtr<FrameNode>> needRenderNode_;
1479 
1480     int32_t callbackId_ = 0;
1481     SurfaceChangedCallbackMap surfaceChangedCallbackMap_;
1482     SurfacePositionChangedCallbackMap surfacePositionChangedCallbackMap_;
1483     FoldStatusChangedCallbackMap foldStatusChangedCallbackMap_;
1484     HalfFoldHoverChangedCallbackMap halfFoldHoverChangedCallbackMap_;
1485     FoldDisplayModeChangedCallbackMap foldDisplayModeChangedCallbackMap_;
1486     TransformHintChangedCallbackMap transformHintChangedCallbackMap_;
1487     RawKeyboardChangedCallbackMap rawKeyboardChangedCallbackMap_;
1488 
1489     bool isOnAreaChangeNodesCacheVaild_ = false;
1490     std::vector<FrameNode*> onAreaChangeNodesCache_;
1491     std::unordered_set<int32_t> onAreaChangeNodeIds_;
1492     std::unordered_set<int32_t> onVisibleAreaChangeNodeIds_;
1493 
1494     // MinDepth < 0, do not work;
1495     // MinDepth = 0, no Change Node from last frame;
1496     // MinDepth > 0, represent Change MinDepth from last frame;
1497     int32_t areaChangeNodeMinDepth_ = -1;
1498     int32_t isDisappearChangeNodeMinDepth_ = -1;
1499 
1500     std::unordered_map<int32_t, std::vector<MouseEvent>> historyMousePointsById_;
1501     std::unordered_map<int32_t, std::vector<DragPointerEvent>> historyPointsEventById_;
1502     RefPtr<AccessibilityManagerNG> accessibilityManagerNG_;
1503     RefPtr<StageManager> stageManager_;
1504     RefPtr<OverlayManager> overlayManager_;
1505     RefPtr<FullScreenManager> fullScreenManager_;
1506     RefPtr<SelectOverlayManager> selectOverlayManager_;
1507     RefPtr<DragDropManager> dragDropManager_;
1508     RefPtr<FocusManager> focusManager_;
1509     RefPtr<SharedOverlayManager> sharedTransitionManager_;
1510 #ifdef WINDOW_SCENE_SUPPORTED
1511     RefPtr<UIExtensionManager> uiExtensionManager_ = MakeRefPtr<UIExtensionManager>();
1512 #endif
1513     RefPtr<SafeAreaManager> safeAreaManager_ = MakeRefPtr<SafeAreaManager>();
1514     RefPtr<FrameRateManager> frameRateManager_ = MakeRefPtr<FrameRateManager>();
1515     RefPtr<PrivacySensitiveManager> privacySensitiveManager_ = MakeRefPtr<PrivacySensitiveManager>();
1516     RefPtr<ToolbarManager> toolbarManager_ = MakeRefPtr<ToolbarManager>();
1517     Rect displayAvailableRect_;
1518     WeakPtr<FrameNode> dirtyFocusNode_;
1519     WeakPtr<FrameNode> dirtyFocusScope_;
1520     WeakPtr<FrameNode> dirtyRequestFocusNode_;
1521     WeakPtr<FrameNode> screenNode_;
1522     WeakPtr<FrameNode> windowSceneNode_;
1523     uint32_t nextScheduleTaskId_ = 0;
1524     uint64_t resampleTimeStamp_ = 0;
1525     bool touchAccelarate_ = false;
1526     bool isEventsPassThrough_ = false;
1527     bool backgroundColorModeUpdated_ = false;  // Dark/light color switch flag
1528     uint64_t animationTimeStamp_ = 0;
1529     bool hasIdleTasks_ = false;
1530     bool isFocusingByTab_ = false;
1531     bool isWindowHasFocused_ = false;
1532     bool onShow_ = false;
1533     MockFlushEventType isNeedFlushMouseEvent_ = MockFlushEventType::NONE;
1534     bool isNeedFlushAnimationStartTime_ = false;
1535     bool canUseLongPredictTask_ = false;
1536     bool isWindowSceneConsumed_ = false;
1537     bool isDensityChanged_ = false;
1538     bool isNeedReloadDensity_ = false;
1539     bool isBeforeDragHandleAxis_ = false;
1540     WeakPtr<FrameNode> activeNode_;
1541     bool isWindowAnimation_ = false;
1542     bool isWindowSizeDragging_ = false;
1543     KeyBoardAvoidMode prevKeyboardAvoidMode_ = KeyBoardAvoidMode::OFFSET;
1544     bool isFreezeFlushMessage_ = false;
1545     bool isNeedCallbackAreaChange_ = true;
1546 
1547     RefPtr<FrameNode> focusNode_;
1548     std::function<void()> focusOnNodeCallback_;
1549     std::function<void(bool isRotate,
1550         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction)> sizeChangeByRotateCallback_;
1551     std::function<void(const std::string&)> linkJumpCallback_ = nullptr;
1552     std::function<void()> dragWindowVisibleCallback_;
1553     std::function<bool(int32_t)> flushTSUpdatesCb_;
1554 
1555     std::optional<bool> needSoftKeyboard_;
1556     std::optional<bool> windowFocus_;
1557     std::optional<bool> windowShow_;
1558 
1559     std::unique_ptr<MouseEvent> lastMouseEvent_;
1560 
1561     std::unordered_map<int32_t, WeakPtr<FrameNode>> storeNode_;
1562     std::unordered_map<int32_t, std::string> restoreNodeInfo_;
1563     std::unordered_map<int32_t, std::vector<WeakPtr<UINode>>> pageToNavigationNodes_;
1564     std::unordered_map<int32_t, std::vector<TouchEvent>> historyPointsById_;
1565 
1566     std::set<int32_t> positionZNodes_;
1567 
1568     std::list<FrameInfo> dumpFrameInfos_;
1569     std::list<std::function<void()>> animationClosuresList_;
1570 
1571     mutable std::mutex navigationMutex_;
1572     std::map<std::string, WeakPtr<FrameNode>> navigationNodes_;
1573     std::list<DelayedTask> delayedTasks_;
1574     RefPtr<PostEventManager> postEventManager_;
1575 
1576     std::map<WeakPtr<FrameNode>, std::vector<MouseEvent>> nodeToMousePoints_;
1577     std::map<WeakPtr<FrameNode>, std::vector<DragPointerEvent>> nodeToPointEvent_;
1578     std::vector<Ace::RectF> overlayNodePositions_;
1579     std::function<void(std::vector<Ace::RectF>)> overlayNodePositionUpdateCallback_;
1580 
1581     RefPtr<FrameNode> predictNode_;
1582 
1583     VsyncCallbackFun vsyncListener_;
1584     VsyncCallbackFun onceVsyncListener_;
1585     ACE_DISALLOW_COPY_AND_MOVE(PipelineContext);
1586 
1587     int32_t preNodeId_ = -1;
1588     bool enableSwipeBack_ = true;
1589 
1590     RefPtr<AvoidInfoManager> avoidInfoMgr_ = MakeRefPtr<AvoidInfoManager>();
1591     RefPtr<MemoryManager> memoryMgr_ = MakeRefPtr<MemoryManager>();
1592     RefPtr<NavigationManager> navigationMgr_ = MakeRefPtr<NavigationManager>();
1593     RefPtr<ForceSplitManager> forceSplitMgr_ = MakeRefPtr<ForceSplitManager>();
1594     RefPtr<FormVisibleManager> formVisibleMgr_ = MakeRefPtr<FormVisibleManager>();
1595     RefPtr<FormEventManager> formEventMgr_ = MakeRefPtr<FormEventManager>();
1596     RefPtr<FormGestureManager> formGestureMgr_ = MakeRefPtr<FormGestureManager>();
1597     std::unique_ptr<RecycleManager> recycleManager_ = std::make_unique<RecycleManager>();
1598     ColorMode colorMode_ = ColorMode::LIGHT;
1599     std::atomic<int32_t> localColorMode_ = static_cast<int32_t>(ColorMode::COLOR_MODE_UNDEFINED);
1600     std::vector<std::shared_ptr<ITouchEventCallback>> listenerVector_;
1601     bool customTitleSettedShow_ = true;
1602     bool isShowTitle_ = false;
1603     int32_t lastAnimatorExpectedFrameRate_ = -1;
1604     bool isDoKeyboardAvoidAnimate_ = true;
1605 
1606     std::list<FrameCallbackFuncFromCAPI> frameCallbackFuncsFromCAPI_;
1607     std::list<IdleCallbackFunc> idleCallbackFuncs_;
1608     std::list<FrameCallbackFunc> frameCallbackFuncs_;
1609     uint32_t transform_ = 0;
1610     std::list<WeakPtr<FrameNode>> changeInfoListeners_;
1611     std::list<WeakPtr<FrameNode>> changedNodes_;
1612     bool isHalfFoldHoverStatus_ = false;
1613     CancelableCallback<void()> foldStatusDelayTask_;
1614     bool isFirstRootLayout_ = true;
1615     bool isFirstFlushMessages_ = true;
1616     AxisEventChecker axisEventChecker_;
1617     std::set<WeakPtr<UINode>> attachedNodeSet_;
1618     std::list<std::function<void()>> afterReloadAnimationTasks_;
1619     Offset lastHostParentOffsetToWindow_ { 0, 0 };
1620     int32_t frameCountForNotCallJSCleanUp_ = 0;
1621     RefPtr<Kit::UIContextImpl> uiContextImpl_;
1622     std::shared_ptr<UiTranslateManagerImpl> uiTranslateManager_;
1623     RotationEndCallbackMap rotationEndCallbackMap_ {};
1624     friend class ScopedLayout;
1625     friend class FormGestureManager;
1626     RefPtr<AIWriteAdapter> aiWriteAdapter_ = nullptr;
1627     std::set<WeakPtr<NG::UINode>> needRenderForDrawChildrenNodes_;
1628     std::unordered_map<int32_t, bool> keyOcclusionNodes_;
1629     RefPtr<NodeRenderStatusMonitor> nodeRenderStatusMonitor_;
1630     Kit::ArkUIObjectLifecycleCallback objectLifecycleCallback_;
1631     bool needUpdateTimeForDVSync_ = false;
1632     uint64_t lastVSyncTime_ = 0;
1633 };
1634 
1635 /**
1636  * @description: only protect isLayouting_ flag in pipeline and
1637  * the user needs to guarantee that current layout is not nested
1638  */
1639 class ACE_FORCE_EXPORT ScopedLayout final {
1640 public:
1641     ScopedLayout(PipelineContext* pipeline);
1642     ~ScopedLayout();
1643 
1644 private:
1645     PipelineContext* pipeline_ = nullptr;
1646     bool isLayouting_ = false;
1647 };
1648 } // namespace OHOS::Ace::NG
1649 
1650 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_PIPELINE_NG_CONTEXT_H
1651