• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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_PIPELINE_PIPELINE_BASE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_PIPELINE_PIPELINE_BASE_H
18 
19 #include <atomic>
20 #include <functional>
21 #include <memory>
22 #include <optional>
23 #include <shared_mutex>
24 #include <stack>
25 #include <string>
26 #include <unordered_map>
27 #include <utility>
28 
29 #include "base/geometry/dimension.h"
30 #include "base/resource/asset_manager.h"
31 #include "base/resource/data_provider_manager.h"
32 #include "base/resource/shared_image_manager.h"
33 #include "base/thread/task_executor.h"
34 #include "core/accessibility/accessibility_manager.h"
35 #include "core/animation/schedule_task.h"
36 #include "core/common/clipboard/clipboard_proxy.h"
37 #include "core/common/display_info.h"
38 #include "core/common/draw_delegate.h"
39 #include "core/common/event_manager.h"
40 #include "core/common/platform_bridge.h"
41 #include "core/common/platform_res_register.h"
42 #include "core/common/resource/resource_configuration.h"
43 #include "core/common/thp_extra_manager.h"
44 #include "core/common/thread_checker.h"
45 #include "core/common/window_animation_config.h"
46 #include "core/components/common/layout/constants.h"
47 #include "core/components/common/properties/animation_option.h"
48 #include "core/components/theme/resource_adapter.h"
49 #include "core/components/theme/theme_manager.h"
50 #include "core/components_ng/pattern/ui_extension/ui_extension_config.h"
51 #include "core/components_ng/property/safe_area_insets.h"
52 #include "core/event/axis_event.h"
53 #include "core/event/key_event.h"
54 #include "core/event/mouse_event.h"
55 #include "core/event/rotation_event.h"
56 #include "core/event/touch_event.h"
57 #include "core/event/pointer_event.h"
58 #include "core/gestures/gesture_info.h"
59 #include "core/image/image_cache.h"
60 #include "core/pipeline/container_window_manager.h"
61 #include "core/components_ng/manager/display_sync/ui_display_sync_manager.h"
62 #include "interfaces/inner_api/ace/serialized_gesture.h"
63 
64 namespace OHOS::Rosen {
65 class RSTransaction;
66 class AvoidArea;
67 } // namespace OHOS::Rosen
68 
69 namespace OHOS::Ace {
70 namespace NG {
71 class FrameNode;
72 } // namespace NG
73 
74 struct KeyboardAnimationCurve {
75     std::string curveType_;
76     std::vector<float> curveParams_;
77     uint32_t duration_ = 0;
78 };
79 
80 struct KeyboardAnimationConfig {
81     KeyboardAnimationCurve curveIn_;
82     KeyboardAnimationCurve curveOut_;
83 };
84 
85 struct FontInfo;
86 struct FontConfigJsonInfo;
87 class Frontend;
88 class OffscreenCanvas;
89 class Window;
90 class FontManager;
91 class ManagerInterface;
92 class NavigationController;
93 enum class FrontendType;
94 using SharePanelCallback = std::function<void(const std::string& bundleName, const std::string& abilityName)>;
95 using AceVsyncCallback = std::function<void(uint64_t, uint32_t)>;
96 
97 class ACE_FORCE_EXPORT PipelineBase : public AceType {
98     DECLARE_ACE_TYPE(PipelineBase, AceType);
99 
100 public:
101     PipelineBase() = default;
102     PipelineBase(std::shared_ptr<Window> window, RefPtr<TaskExecutor> taskExecutor, RefPtr<AssetManager> assetManager,
103         const RefPtr<Frontend>& frontend, int32_t instanceId);
104     PipelineBase(std::shared_ptr<Window> window, RefPtr<TaskExecutor> taskExecutor, RefPtr<AssetManager> assetManager,
105         const RefPtr<Frontend>& frontend, int32_t instanceId, RefPtr<PlatformResRegister> platformResRegister);
106     ~PipelineBase() override;
107 
108     static RefPtr<PipelineBase> GetCurrentContext();
109 
110     static RefPtr<PipelineBase> GetCurrentContextSafely();
111 
112     static RefPtr<PipelineBase> GetCurrentContextSafelyWithCheck();
113 
114     static RefPtr<PipelineBase> GetMainPipelineContext();
115 
116     static RefPtr<ThemeManager> CurrentThemeManager();
117 
118     static void SetCallBackNode(const WeakPtr<NG::FrameNode>& node);
119 
120     /*
121      * Change px to vp with density of current pipeline
122      */
123     static double Px2VpWithCurrentDensity(double px);
124 
125     /*
126      * Change vp to px with density of current pipeline
127      */
128     static double Vp2PxWithCurrentDensity(double vp);
129 
130     /*
131      * Get density of current pipeline if valid, or return density of default display
132      */
133     static double GetCurrentDensity();
134 
135     static ColorMode GetCurrentColorMode();
136 
137     virtual void SetupRootElement() = 0;
138 
139     virtual uint64_t GetTimeFromExternalTimer();
140 
141     virtual bool NeedSoftKeyboard() = 0;
142 
143     virtual void SetOnWindowFocused(const std::function<void()>& callback) = 0;
144 
145     bool Animate(const AnimationOption& option, const RefPtr<Curve>& curve,
146         const std::function<void()>& propertyCallback, const std::function<void()>& finishCallBack = nullptr);
147 
148     virtual void AddKeyFrame(
149         float fraction, const RefPtr<Curve>& curve, const std::function<void()>& propertyCallback) = 0;
150 
151     virtual void AddKeyFrame(float fraction, const std::function<void()>& propertyCallback) = 0;
152 
153     void PrepareOpenImplicitAnimation();
154 
CatchInteractiveAnimations(const std::function<void ()> & animationCallback)155     virtual bool CatchInteractiveAnimations(const std::function<void()>& animationCallback)
156     {
157         return false;
158     }
159 
160     void OpenImplicitAnimation(const AnimationOption& option, const RefPtr<Curve>& curve,
161         const std::function<void()>& finishCallback = nullptr);
162 
163     void StartImplicitAnimation(const AnimationOption& operation, const RefPtr<Curve>& curve,
164         const std::function<void()>& finishCallback = nullptr, const std::optional<int32_t>& count = std::nullopt);
165 
166     void PrepareCloseImplicitAnimation();
167 
168     bool CloseImplicitAnimation();
169 
170     void ForceLayoutForImplicitAnimation();
171 
172     void ForceRenderForImplicitAnimation();
173 
174     // add schedule task and return the unique mark id.
175     virtual uint32_t AddScheduleTask(const RefPtr<ScheduleTask>& task) = 0;
176 
177     // remove schedule task by id.
178     virtual void RemoveScheduleTask(uint32_t id) = 0;
179 
180     // Called by view when touch event received.
181     virtual void OnTouchEvent(const TouchEvent& point, bool isSubPipe = false) = 0;
182 
183     // Called by ohos AceContainer when touch event received.
184     virtual void OnTouchEvent(const TouchEvent& point, const RefPtr<NG::FrameNode>& node, bool isSubPipe = false)
185     {}
186 
OnAccessibilityHoverEvent(const TouchEvent & point,const RefPtr<NG::FrameNode> & node)187     virtual void OnAccessibilityHoverEvent(const TouchEvent& point, const RefPtr<NG::FrameNode>& node) {}
188 
OnPenHoverEvent(const TouchEvent & point,const RefPtr<NG::FrameNode> & node)189     virtual void OnPenHoverEvent(const TouchEvent& point, const RefPtr<NG::FrameNode>& node) {}
190 
HandlePenHoverOut(const TouchEvent & point)191     virtual void HandlePenHoverOut(const TouchEvent& point) {}
192 
193     // Called by container when key event received.
194     // if return false, then this event needs platform to handle it.
195     virtual bool OnNonPointerEvent(const NonPointerEvent& event) = 0;
196 
197     // Called by view when mouse event received.
198     virtual void OnMouseEvent(const MouseEvent& event) = 0;
199 
200     // Called by ohos AceContainer when mouse event received.
OnMouseEvent(const MouseEvent & event,const RefPtr<NG::FrameNode> & node)201     virtual void OnMouseEvent(const MouseEvent& event, const RefPtr<NG::FrameNode>& node) {}
202 
OnMouseMoveEventForAxisEvent(const MouseEvent & event,const RefPtr<NG::FrameNode> & node)203     virtual void OnMouseMoveEventForAxisEvent(const MouseEvent& event, const RefPtr<NG::FrameNode>& node) {};
204 
205     // Called by view when axis event received.
206     virtual void OnAxisEvent(const AxisEvent& event) = 0;
207 
208     // Called by ohos AceContainer when axis event received.
OnAxisEvent(const AxisEvent & event,const RefPtr<NG::FrameNode> & node)209     virtual void OnAxisEvent(const AxisEvent& event, const RefPtr<NG::FrameNode>& node) {}
210 
211     // Called by container when rotation event received.
212     // if return false, then this event needs platform to handle it.
213     virtual bool OnRotationEvent(const RotationEvent& event) const = 0;
214 
215     // Called by window when received vsync signal.
216     virtual void OnVsyncEvent(uint64_t nanoTimestamp, uint32_t frameCount);
217 
218     // Called by viewr
219     virtual void OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
220         const RefPtr<NG::FrameNode>& node = nullptr) = 0;
221 
222     // Called by view when idle event.
223     virtual void OnIdle(int64_t deadline) = 0;
224 
225     virtual void SetBuildAfterCallback(const std::function<void()>& callback) = 0;
226 
227     virtual void DispatchDisplaySync(uint64_t nanoTimestamp) = 0;
228 
229     virtual void FlushAnimation(uint64_t nanoTimestamp) = 0;
230 
231     virtual void SendEventToAccessibility(const AccessibilityEvent& accessibilityEvent);
232 
233     virtual void SaveExplicitAnimationOption(const AnimationOption& option) = 0;
234 
235     virtual void CreateExplicitAnimator(const std::function<void()>& onFinishEvent) = 0;
236 
237     virtual void ClearExplicitAnimationOption() = 0;
238 
239     virtual AnimationOption GetExplicitAnimationOption() const = 0;
240 
241     virtual void Destroy();
242 
243     virtual void OnShow() = 0;
244 
245     virtual void OnHide() = 0;
246 
247     virtual void WindowFocus(bool isFocus) = 0;
248 
WindowActivate(bool isActive)249     virtual void WindowActivate(bool isActive) {}
250 
251     virtual void ContainerModalUnFocus() = 0;
252 
253     virtual void ShowContainerTitle(bool isShow, bool hasDeco = true, bool needUpdate = false) = 0;
254 
255     virtual void OnSurfaceChanged(int32_t width, int32_t height,
256         WindowSizeChangeReason type = WindowSizeChangeReason::UNDEFINED,
257         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) = 0;
258 
259     virtual void OnSurfacePositionChanged(int32_t posX, int32_t posY) = 0;
260 
OnSurfaceDensityChanged(double density)261     virtual void OnSurfaceDensityChanged(double density)
262     {
263         // To avoid the race condition caused by the offscreen canvas get density from the pipeline in the worker
264         // thread.
265         std::lock_guard lock(densityChangeMutex_);
266         for (auto&& [id, callback] : densityChangedCallbacks_) {
267             if (callback) {
268                 callback(density);
269             }
270         }
271     }
272 
SendUpdateVirtualNodeFocusEvent()273     void SendUpdateVirtualNodeFocusEvent()
274     {
275         auto accessibilityManager = GetAccessibilityManager();
276         CHECK_NULL_VOID(accessibilityManager);
277         accessibilityManager->UpdateVirtualNodeFocus();
278     }
279 
RegisterWindowDensityCallback(std::function<double ()> && callback)280     void RegisterWindowDensityCallback(std::function<double()>&& callback)
281     {
282         windowDensityCallback_ = callback;
283     }
284 
GetWindowDensity()285     double GetWindowDensity() const
286     {
287         if (windowDensityCallback_) {
288             return windowDensityCallback_();
289         }
290         return 1.0;
291     }
292 
RegisterDensityChangedCallback(std::function<void (double)> && callback)293     int32_t RegisterDensityChangedCallback(std::function<void(double)>&& callback)
294     {
295         if (callback) {
296             // To avoid the race condition caused by the offscreen canvas get density from the pipeline in the worker
297             // thread.
298             std::lock_guard lock(densityChangeMutex_);
299             densityChangedCallbacks_.emplace(++densityChangeCallbackId_, std::move(callback));
300             return densityChangeCallbackId_;
301         }
302         return 0;
303     }
304 
UnregisterDensityChangedCallback(int32_t callbackId)305     void UnregisterDensityChangedCallback(int32_t callbackId)
306     {
307         // To avoid the race condition caused by the offscreen canvas get density from the pipeline in the worker
308         // thread.
309         std::lock_guard lock(densityChangeMutex_);
310         densityChangedCallbacks_.erase(callbackId);
311     }
312 
313     virtual void OnTransformHintChanged(uint32_t transform) = 0;
314 
315     virtual void OnSystemBarHeightChanged(double statusBar, double navigationBar) = 0;
316 
317     virtual void OnSurfaceDestroyed() = 0;
318 
319     virtual void NotifyOnPreDraw() = 0;
320 
321     virtual bool CallRouterBackToPopPage() = 0;
322 
PopPageStackOverlay()323     virtual bool PopPageStackOverlay()
324     {
325         return false;
326     }
327 
HideOverlays()328     virtual void HideOverlays() {}
329 
OnPageShow()330     virtual void OnPageShow() {}
331 
332     virtual void OnActionEvent(const std::string& action);
333 
334     virtual void Finish(bool autoFinish = true) const {}
335 
RequestFullWindow(int32_t duration)336     virtual void RequestFullWindow(int32_t duration) {}
337 
338     virtual bool RequestFocus(const std::string& targetNodeId, bool isSyncRequest = false)
339     {
340         return false;
341     }
342 
343     // Called by AceContainer.
344     bool Dump(const std::vector<std::string>& params) const;
345 
DumpUIExt()346     virtual void DumpUIExt() const {}
347 
IsLastPage()348     virtual bool IsLastPage()
349     {
350         return false;
351     }
352 
GetIsDeclarative()353     virtual bool GetIsDeclarative() const
354     {
355         return true;
356     }
357 
SetAppBgColor(const Color & color)358     virtual void SetAppBgColor(const Color& color)
359     {
360         appBgColor_ = color;
361     }
362 
SetWindowContainerColor(const Color & activeColor,const Color & inactiveColor)363     virtual void SetWindowContainerColor(const Color& activeColor, const Color& inactiveColor) {}
364 
ChangeDarkModeBrightness()365     virtual void ChangeDarkModeBrightness() {}
366 
SetFormRenderingMode(int8_t renderMode)367     void SetFormRenderingMode(int8_t renderMode)
368     {
369         renderingMode_ = renderMode;
370     }
371 
SetFormEnableBlurBackground(bool enableBlurBackground)372     void SetFormEnableBlurBackground(bool enableBlurBackground)
373     {
374         enableBlurBackground_ = enableBlurBackground;
375     }
376 
GetAppBgColor()377     const Color& GetAppBgColor() const
378     {
379         return appBgColor_;
380     }
381 
GetAppLabelId()382     int32_t GetAppLabelId() const
383     {
384         return appLabelId_;
385     }
386 
SetAppLabelId(int32_t appLabelId)387     void SetAppLabelId(int32_t appLabelId)
388     {
389         appLabelId_ = appLabelId;
390     }
391 
392     virtual void SetAppTitle(const std::string& title) = 0;
393 
394     virtual void SetAppIcon(const RefPtr<PixelMap>& icon) = 0;
395 
SetContainerButtonHide(bool hideSplit,bool hideMaximize,bool hideMinimize,bool hideClose)396     virtual void SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose) {}
397 
EnableContainerModalGesture(bool isEnable)398     virtual void EnableContainerModalGesture(bool isEnable) {}
399 
GetContainerFloatingTitleVisible()400     virtual bool GetContainerFloatingTitleVisible()
401     {
402         return false;
403     }
404 
GetContainerCustomTitleVisible()405     virtual bool GetContainerCustomTitleVisible()
406     {
407         return false;
408     }
409 
GetContainerControlButtonVisible()410     virtual bool GetContainerControlButtonVisible()
411     {
412         return false;
413     }
414 
RefreshRootBgColor()415     virtual void RefreshRootBgColor() const {}
416 
PostponePageTransition()417     virtual void PostponePageTransition() {}
LaunchPageTransition()418     virtual void LaunchPageTransition() {}
419 
GetBoundingRectData(int32_t nodeId,Rect & rect)420     virtual void GetBoundingRectData(int32_t nodeId, Rect& rect) {}
421 
CheckAndUpdateKeyboardInset(float keyboardHeight)422     virtual void CheckAndUpdateKeyboardInset(float keyboardHeight) {}
423 
424     virtual RefPtr<AccessibilityManager> GetAccessibilityManager() const;
425 
GetNavigationController(const std::string & id)426     virtual std::shared_ptr<NavigationController> GetNavigationController(const std::string& id)
427     {
428         return nullptr;
429     }
430 
431     void SetRootSize(double density, float width, float height);
432 
433     void UpdateFontWeightScale();
434 
SetFollowSystem(bool followSystem)435     void SetFollowSystem(bool followSystem)
436     {
437         followSystem_ = followSystem;
438     }
439 
SetMaxAppFontScale(float maxAppFontScale)440     void SetMaxAppFontScale(float maxAppFontScale)
441     {
442         maxAppFontScale_ = maxAppFontScale;
443     }
444 
GetMaxAppFontScale()445     float GetMaxAppFontScale()
446     {
447         return maxAppFontScale_;
448     }
449 
IsFollowSystem()450     bool IsFollowSystem()
451     {
452         return followSystem_;
453     }
454 
455     double NormalizeToPx(const Dimension& dimension) const;
456 
457     double ConvertPxToVp(const Dimension& dimension) const;
458 
459     using FinishEventHandler = std::function<void()>;
SetFinishEventHandler(FinishEventHandler && listener)460     void SetFinishEventHandler(FinishEventHandler&& listener)
461     {
462         finishEventHandler_ = std::move(listener);
463     }
464 
465     using StartAbilityHandler = std::function<void(const std::string& address)>;
SetStartAbilityHandler(StartAbilityHandler && listener)466     void SetStartAbilityHandler(StartAbilityHandler&& listener)
467     {
468         startAbilityHandler_ = std::move(listener);
469     }
470     void HyperlinkStartAbility(const std::string& address) const;
471 
472     using StartAbilityOnQueryHandler = std::function<void(const std::string& queryWord)>;
SetStartAbilityOnQueryHandler(StartAbilityOnQueryHandler && listener)473     void SetStartAbilityOnQueryHandler(StartAbilityOnQueryHandler&& listener)
474     {
475         startAbilityOnQueryHandler_ = std::move(listener);
476     }
477     void StartAbilityOnQuery(const std::string& queryWord) const;
478 
479     using ActionEventHandler = std::function<void(const std::string& action)>;
SetActionEventHandler(ActionEventHandler && listener)480     void SetActionEventHandler(ActionEventHandler&& listener)
481     {
482         actionEventHandler_ = std::move(listener);
483     }
484 
485     using FormLinkInfoUpdateHandler = std::function<void(const std::vector<std::string>&)>;
SetFormLinkInfoUpdateHandler(FormLinkInfoUpdateHandler && listener)486     void SetFormLinkInfoUpdateHandler(FormLinkInfoUpdateHandler&& listener)
487     {
488         formLinkInfoUpdateHandler_ = std::move(listener);
489     }
490 
491     using StatusBarEventHandler = std::function<void(const Color& color)>;
SetStatusBarEventHandler(StatusBarEventHandler && listener)492     void SetStatusBarEventHandler(StatusBarEventHandler&& listener)
493     {
494         statusBarBgColorEventHandler_ = std::move(listener);
495     }
496     void NotifyStatusBarBgColor(const Color& color) const;
497 
498     using PopupEventHandler = std::function<void()>;
SetPopupEventHandler(PopupEventHandler && listener)499     void SetPopupEventHandler(PopupEventHandler&& listener)
500     {
501         popupEventHandler_ = std::move(listener);
502     }
503     void NotifyPopupDismiss() const;
504 
505     using MenuEventHandler = std::function<void()>;
SetMenuEventHandler(MenuEventHandler && listener)506     void SetMenuEventHandler(MenuEventHandler&& listener)
507     {
508         menuEventHandler_ = std::move(listener);
509     }
510     void NotifyMenuDismiss() const;
511 
512     using ContextMenuEventHandler = std::function<void()>;
SetContextMenuEventHandler(ContextMenuEventHandler && listener)513     void SetContextMenuEventHandler(ContextMenuEventHandler&& listener)
514     {
515         contextMenuEventHandler_ = std::move(listener);
516     }
517     void NotifyContextMenuDismiss() const;
518 
519     using RouterBackEventHandler = std::function<void()>;
SetRouterBackEventHandler(RouterBackEventHandler && listener)520     void SetRouterBackEventHandler(RouterBackEventHandler&& listener)
521     {
522         routerBackEventHandler_ = std::move(listener);
523     }
524     void NotifyRouterBackDismiss() const;
525 
526     using PopPageSuccessEventHandler = std::function<void(const std::string& pageUrl, const int32_t pageId)>;
SetPopPageSuccessEventHandler(PopPageSuccessEventHandler && listener)527     void SetPopPageSuccessEventHandler(PopPageSuccessEventHandler&& listener)
528     {
529         popPageSuccessEventHandler_.push_back(std::move(listener));
530     }
531     void NotifyPopPageSuccessDismiss(const std::string& pageUrl, int32_t pageId) const;
532 
533     using IsPagePathInvalidEventHandler = std::function<void(bool& isPageInvalid)>;
SetIsPagePathInvalidEventHandler(IsPagePathInvalidEventHandler && listener)534     void SetIsPagePathInvalidEventHandler(IsPagePathInvalidEventHandler&& listener)
535     {
536         isPagePathInvalidEventHandler_.push_back(std::move(listener));
537     }
538     void NotifyIsPagePathInvalidDismiss(bool isPageInvalid) const;
539 
540     using DestroyEventHandler = std::function<void()>;
SetDestroyHandler(DestroyEventHandler && listener)541     void SetDestroyHandler(DestroyEventHandler&& listener)
542     {
543         destroyEventHandler_.push_back(std::move(listener));
544     }
545     void NotifyDestroyEventDismiss() const;
546 
547     using DispatchTouchEventHandler = std::function<void(const TouchEvent& event)>;
SetDispatchTouchEventHandler(DispatchTouchEventHandler && listener)548     void SetDispatchTouchEventHandler(DispatchTouchEventHandler&& listener)
549     {
550         dispatchTouchEventHandler_.push_back(std::move(listener));
551     }
552     void NotifyDispatchTouchEventDismiss(const TouchEvent& event) const;
553 
554     using GetViewScaleCallback = std::function<bool(float&, float&)>;
SetGetViewScaleCallback(GetViewScaleCallback && callback)555     void SetGetViewScaleCallback(GetViewScaleCallback&& callback)
556     {
557         getViewScaleCallback_ = callback;
558     }
559 
560     using OnPageShowCallBack = std::function<void()>;
SetOnPageShow(OnPageShowCallBack && onPageShowCallBack)561     void SetOnPageShow(OnPageShowCallBack&& onPageShowCallBack)
562     {
563         onPageShowCallBack_ = std::move(onPageShowCallBack);
564     }
565 
566     using AnimationCallback = std::function<void()>;
SetAnimationCallback(AnimationCallback && callback)567     void SetAnimationCallback(AnimationCallback&& callback)
568     {
569         animationCallback_ = std::move(callback);
570     }
571 
572     using ProfilerCallback = std::function<void(const std::string&)>;
SetOnVsyncProfiler(const ProfilerCallback & callback)573     void SetOnVsyncProfiler(const ProfilerCallback& callback)
574     {
575         onVsyncProfiler_ = callback;
576     }
577 
578     using OnRouterChangeCallback = bool (*)(const std::string currentRouterPath);
AddRouterChangeCallback(const OnRouterChangeCallback & onRouterChangeCallback)579     void AddRouterChangeCallback(const OnRouterChangeCallback& onRouterChangeCallback)
580     {
581         onRouterChangeCallback_ = onRouterChangeCallback;
582     }
583 
584     void onRouterChange(const std::string& url);
585 
ResetOnVsyncProfiler()586     void ResetOnVsyncProfiler()
587     {
588         onVsyncProfiler_ = nullptr;
589     }
590 
GetViewScale(float & scaleX,float & scaleY)591     bool GetViewScale(float& scaleX, float& scaleY)
592     {
593         if (getViewScaleCallback_) {
594             return getViewScaleCallback_(scaleX, scaleY);
595         }
596         return false;
597     }
598 
GetTaskExecutor()599     RefPtr<TaskExecutor> GetTaskExecutor() const
600     {
601         return taskExecutor_;
602     }
603 
604     RefPtr<Frontend> GetFrontend() const;
605 
GetInstanceId()606     int32_t GetInstanceId() const
607     {
608         return instanceId_;
609     }
610 
611     void ClearImageCache();
612 
613     void SetImageCache(const RefPtr<ImageCache>& imageChache);
614 
615     RefPtr<ImageCache> GetImageCache() const;
616 
GetOrCreateSharedImageManager()617     const RefPtr<SharedImageManager>& GetOrCreateSharedImageManager()
618     {
619         std::scoped_lock<std::shared_mutex> lock(imageMtx_);
620         if (!sharedImageManager_) {
621             sharedImageManager_ = MakeRefPtr<SharedImageManager>(taskExecutor_);
622         }
623         return sharedImageManager_;
624     }
625 
GetOrCreateUIDisplaySyncManager()626     const RefPtr<UIDisplaySyncManager>& GetOrCreateUIDisplaySyncManager()
627     {
628         std::call_once(displaySyncFlag_, [this]() {
629             if (!uiDisplaySyncManager_) {
630                 uiDisplaySyncManager_ = MakeRefPtr<UIDisplaySyncManager>();
631             }
632         });
633         return uiDisplaySyncManager_;
634     }
635 
GetWindow()636     Window* GetWindow()
637     {
638         return window_.get();
639     }
640 
GetAssetManager()641     RefPtr<AssetManager> GetAssetManager() const
642     {
643         return assetManager_;
644     }
645 
GetMinPlatformVersion()646     int32_t GetMinPlatformVersion() const
647     {
648         // Since API10, the platform version data format has changed.
649         // Use the last three digits of data as platform version. For example (4000000010).
650         return minPlatformVersion_ % 1000;
651     }
652 
SetMinPlatformVersion(int32_t minPlatformVersion)653     void SetMinPlatformVersion(int32_t minPlatformVersion)
654     {
655         minPlatformVersion_ = minPlatformVersion;
656     }
657 
SetInstallationFree(int32_t installationFree)658     void SetInstallationFree(int32_t installationFree)
659     {
660         installationFree_ = installationFree;
661     }
662 
GetInstallationFree()663     bool GetInstallationFree() const
664     {
665         return installationFree_;
666     }
667 
SetSharePanelCallback(SharePanelCallback && callback)668     void SetSharePanelCallback(SharePanelCallback&& callback)
669     {
670         sharePanelCallback_ = std::move(callback);
671     }
672 
FireSharePanelCallback(const std::string & bundleName,const std::string & abilityName)673     void FireSharePanelCallback(const std::string& bundleName, const std::string& abilityName)
674     {
675         if (sharePanelCallback_) {
676             sharePanelCallback_(bundleName, abilityName);
677         }
678     }
679 
GetThemeManager()680     RefPtr<ThemeManager> GetThemeManager() const
681     {
682         std::shared_lock<std::shared_mutex> lock(themeMtx_);
683         return themeManager_;
684     }
685 
SetThemeManager(RefPtr<ThemeManager> theme)686     void SetThemeManager(RefPtr<ThemeManager> theme)
687     {
688         CHECK_RUN_ON(UI);
689         std::unique_lock<std::shared_mutex> lock(themeMtx_);
690         themeManager_ = std::move(theme);
691     }
692 
UpdateThemeManager(const RefPtr<ResourceAdapter> & adapter)693     void UpdateThemeManager(const RefPtr<ResourceAdapter>& adapter) {
694         std::unique_lock<std::shared_mutex> lock(themeMtx_);
695         CHECK_NULL_VOID(themeManager_);
696         auto themeConstants = themeManager_->GetThemeConstants();
697         CHECK_NULL_VOID(themeConstants);
698         themeConstants->UpdateResourceAdapter(adapter);
699     }
700 
701     template<typename T>
GetTheme()702     RefPtr<T> GetTheme() const
703     {
704         std::shared_lock<std::shared_mutex> lock(themeMtx_);
705         if (themeManager_) {
706             return themeManager_->GetTheme<T>();
707         }
708         return {};
709     }
710 
711     template<typename T>
GetTheme(int32_t themeScopeId)712     RefPtr<T> GetTheme(int32_t themeScopeId) const
713     {
714         std::shared_lock<std::shared_mutex> lock(themeMtx_);
715         if (themeManager_) {
716             return themeManager_->GetTheme<T>(themeScopeId);
717         }
718         return {};
719     }
720 
721     template<typename T>
GetDraggable()722     bool GetDraggable()
723     {
724         if (isJsCard_ || isFormRender_) {
725             return false;
726         }
727         auto theme = GetTheme<T>();
728         CHECK_NULL_RETURN(theme, false);
729         return theme->GetDraggable();
730     }
731 
GetTextFieldManager()732     const RefPtr<ManagerInterface>& GetTextFieldManager()
733     {
734         return textFieldManager_;
735     }
736     void SetTextFieldManager(const RefPtr<ManagerInterface>& manager);
737 
GetFontManager()738     const RefPtr<FontManager>& GetFontManager() const
739     {
740         return fontManager_;
741     }
742 
GetDataProviderManager()743     const RefPtr<DataProviderManagerInterface>& GetDataProviderManager() const
744     {
745         return dataProviderManager_;
746     }
SetDataProviderManager(const RefPtr<DataProviderManagerInterface> & dataProviderManager)747     void SetDataProviderManager(const RefPtr<DataProviderManagerInterface>& dataProviderManager)
748     {
749         dataProviderManager_ = dataProviderManager;
750     }
751 
GetMessageBridge()752     const RefPtr<PlatformBridge>& GetMessageBridge() const
753     {
754         return messageBridge_;
755     }
SetMessageBridge(const RefPtr<PlatformBridge> & messageBridge)756     void SetMessageBridge(const RefPtr<PlatformBridge>& messageBridge)
757     {
758         messageBridge_ = messageBridge;
759     }
760 
SetIsJsCard(bool isJsCard)761     void SetIsJsCard(bool isJsCard)
762     {
763         isJsCard_ = isJsCard;
764     }
765 
SetIsJsPlugin(bool isJsPlugin)766     void SetIsJsPlugin(bool isJsPlugin)
767     {
768         isJsPlugin_ = isJsPlugin;
769     }
770 
SetDrawDelegate(std::unique_ptr<DrawDelegate> delegate)771     void SetDrawDelegate(std::unique_ptr<DrawDelegate> delegate)
772     {
773         drawDelegate_ = std::move(delegate);
774     }
775 
IsJsCard()776     bool IsJsCard() const
777     {
778         return isJsCard_;
779     }
780 
IsJsPlugin()781     bool IsJsPlugin() const
782     {
783         return isJsPlugin_;
784     }
785 
SetIsFormRender(bool isEtsCard)786     void SetIsFormRender(bool isEtsCard)
787     {
788         isFormRender_ = isEtsCard;
789     }
790 
IsFormRender()791     bool IsFormRender() const
792     {
793         return isFormRender_;
794     }
795 
IsFormRenderExceptDynamicComponent()796     bool IsFormRenderExceptDynamicComponent() const
797     {
798         return isFormRender_ && !isDynamicRender_;
799     }
800 
SetIsDynamicRender(bool isDynamicRender)801     void SetIsDynamicRender(bool isDynamicRender)
802     {
803         isDynamicRender_ = isDynamicRender;
804     }
805 
IsDynamicRender()806     bool IsDynamicRender() const
807     {
808         return isDynamicRender_;
809     }
810 
811     // Get the dp scale which used to covert dp to logic px.
GetDipScale()812     double GetDipScale() const
813     {
814         return dipScale_;
815     }
816 
817     // Get the window design scale used to covert lpx to logic px.
GetLogicScale()818     double GetLogicScale() const
819     {
820         return designWidthScale_;
821     }
822 
GetFontScale()823     float GetFontScale() const
824     {
825         return fontScale_;
826     }
827     void SetFontScale(float fontScale);
828 
GetFontWeightScale()829     float GetFontWeightScale() const
830     {
831         return fontWeightScale_;
832     }
833     void SetFontWeightScale(float fontWeightScale);
834 
GetWindowId()835     uint32_t GetWindowId() const
836     {
837         return windowId_;
838     }
839 
SetWindowId(uint32_t windowId)840     void SetWindowId(uint32_t windowId)
841     {
842         windowId_ = windowId;
843     }
844 
845     bool NeedTouchInterpolation();
846 
SetFocusWindowId(uint32_t windowId)847     void SetFocusWindowId(uint32_t windowId)
848     {
849         focusWindowId_ = windowId;
850     }
851 
GetFocusWindowId()852     uint32_t GetFocusWindowId() const
853     {
854         return focusWindowId_.value_or(windowId_);
855     }
856 
IsFocusWindowIdSetted()857     bool IsFocusWindowIdSetted() const
858     {
859         return focusWindowId_.has_value();
860     }
861 
SetRealHostWindowId(uint32_t realHostWindowId)862     void SetRealHostWindowId(uint32_t realHostWindowId)
863     {
864         realHostWindowId_ = realHostWindowId;
865     }
866 
GetRealHostWindowId()867     uint32_t GetRealHostWindowId() const
868     {
869         return realHostWindowId_.value_or(GetFocusWindowId());
870     }
871 
IsRealHostWindowIdSetted()872     bool IsRealHostWindowIdSetted() const
873     {
874         return realHostWindowId_.has_value();
875     }
876 
GetViewScale()877     float GetViewScale() const
878     {
879         return viewScale_;
880     }
881 
GetRootWidth()882     double GetRootWidth() const
883     {
884         return rootWidth_;
885     }
886 
GetRootHeight()887     double GetRootHeight() const
888     {
889         return rootHeight_;
890     }
891 
SetWindowModal(WindowModal modal)892     void SetWindowModal(WindowModal modal)
893     {
894         windowModal_ = modal;
895     }
896 
GetWindowModal()897     WindowModal GetWindowModal() const
898     {
899         return windowModal_;
900     }
901 
IsFullScreenModal()902     bool IsFullScreenModal() const
903     {
904         return windowModal_ == WindowModal::NORMAL || windowModal_ == WindowModal::SEMI_MODAL_FULL_SCREEN ||
905                windowModal_ == WindowModal::CONTAINER_MODAL || isFullWindow_;
906     }
907 
SetIsRightToLeft(bool isRightToLeft)908     void SetIsRightToLeft(bool isRightToLeft)
909     {
910         isRightToLeft_ = isRightToLeft;
911     }
912 
IsRightToLeft()913     bool IsRightToLeft() const
914     {
915         return isRightToLeft_;
916     }
917 
SetEventManager(const RefPtr<EventManager> & eventManager)918     void SetEventManager(const RefPtr<EventManager>& eventManager)
919     {
920         eventManager_ = eventManager;
921     }
922 
GetEventManager()923     RefPtr<EventManager> GetEventManager() const
924     {
925         return eventManager_;
926     }
927 
GetWindowManager()928     const RefPtr<WindowManager>& GetWindowManager() const
929     {
930         return windowManager_;
931     }
932 
933     bool HasFloatTitle() const;
934 
IsRebuildFinished()935     bool IsRebuildFinished() const
936     {
937         return isRebuildFinished_;
938     }
939 
940     void RequestFrame();
941 
942     void RegisterFont(const std::string& familyName, const std::string& familySrc, const std::string& bundleName = "",
943         const std::string& moduleName = "");
944 
945     void GetSystemFontList(std::vector<std::string>& fontList);
946 
947     bool GetSystemFont(const std::string& fontName, FontInfo& fontInfo);
948 
949     void GetUIFontConfig(FontConfigJsonInfo& fontConfigJsonInfo);
950 
951     void TryLoadImageInfo(const std::string& src, std::function<void(bool, int32_t, int32_t)>&& loadCallback);
952 
953     RefPtr<OffscreenCanvas> CreateOffscreenCanvas(int32_t width, int32_t height);
954 
955     void PostAsyncEvent(TaskExecutor::Task&& task, const std::string& name,
956         TaskExecutor::TaskType type = TaskExecutor::TaskType::UI);
957 
958     void PostAsyncEvent(const TaskExecutor::Task& task, const std::string& name,
959         TaskExecutor::TaskType type = TaskExecutor::TaskType::UI);
960 
961     void PostSyncEvent(const TaskExecutor::Task& task, const std::string& name,
962         TaskExecutor::TaskType type = TaskExecutor::TaskType::UI);
963 
964     virtual void FlushReload(const ConfigurationChange& configurationChange, bool fullUpdate = true) {}
965 
FlushBuild()966     virtual void FlushBuild() {}
967 
FlushReloadTransition()968     virtual void FlushReloadTransition() {}
RebuildFontNode()969     virtual void RebuildFontNode() {}
GetFrontendType()970     FrontendType GetFrontendType() const
971     {
972         return frontendType_;
973     }
974 
GetDensity()975     double GetDensity() const
976     {
977         return density_;
978     }
979 
GetPlatformResRegister()980     RefPtr<PlatformResRegister> GetPlatformResRegister() const
981     {
982         return platformResRegister_;
983     }
984 
985     void SetTouchPipeline(const WeakPtr<PipelineBase>& context);
986     void RemoveTouchPipeline(const WeakPtr<PipelineBase>& context);
987 
988     void OnVirtualKeyboardAreaChange(Rect keyboardArea,
989         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, const float safeHeight = 0.0f,
990         bool supportAvoidance = false, bool forceChange = false);
991     void OnVirtualKeyboardAreaChange(Rect keyboardArea, double positionY, double height,
992         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, bool forceChange = false);
993 
994     void OnFoldStatusChanged(FoldStatus foldStatus);
995 
996     using foldStatusChangedCallback = std::function<bool(FoldStatus)>;
SetFoldStatusChangeCallback(foldStatusChangedCallback && listener)997     void SetFoldStatusChangeCallback(foldStatusChangedCallback&& listener)
998     {
999         foldStatusChangedCallback_.emplace_back(std::move(listener));
1000     }
1001 
1002     void OnFoldDisplayModeChanged(FoldDisplayMode foldDisplayMode);
1003 
1004     using virtualKeyBoardCallback = std::function<bool(int32_t, int32_t, double, bool)>;
SetVirtualKeyBoardCallback(virtualKeyBoardCallback && listener)1005     void SetVirtualKeyBoardCallback(virtualKeyBoardCallback&& listener)
1006     {
1007         static std::atomic<int32_t> pseudoId(-1); // -1 will not be conflict with real node ids.
1008         auto nodeId = pseudoId.fetch_sub(1, std::memory_order_relaxed);
1009         virtualKeyBoardCallback_.emplace(std::make_pair(nodeId, std::move(listener)));
1010     }
SetVirtualKeyBoardCallback(int32_t nodeId,virtualKeyBoardCallback && listener)1011     void SetVirtualKeyBoardCallback(int32_t nodeId, virtualKeyBoardCallback&& listener)
1012     {
1013         virtualKeyBoardCallback_.emplace(std::make_pair(nodeId, std::move(listener)));
1014     }
RemoveVirtualKeyBoardCallback(int32_t nodeId)1015     void RemoveVirtualKeyBoardCallback(int32_t nodeId)
1016     {
1017         virtualKeyBoardCallback_.erase(nodeId);
1018     }
NotifyVirtualKeyBoard(int32_t width,int32_t height,double keyboard,bool isCustomKeyboard)1019     bool NotifyVirtualKeyBoard(int32_t width, int32_t height, double keyboard, bool isCustomKeyboard) const
1020     {
1021         bool isConsume = false;
1022         for (const auto& [nodeId, iterVirtualKeyBoardCallback] : virtualKeyBoardCallback_) {
1023             if (iterVirtualKeyBoardCallback && iterVirtualKeyBoardCallback(width, height, keyboard, isCustomKeyboard)) {
1024                 isConsume = true;
1025             }
1026         }
1027         return isConsume;
1028     }
1029 
1030     using configChangedCallback = std::function<void()>;
SetConfigChangedCallback(int32_t nodeId,configChangedCallback && listener)1031     void SetConfigChangedCallback(int32_t nodeId, configChangedCallback&& listener)
1032     {
1033         configChangedCallback_.emplace(make_pair(nodeId, std::move(listener)));
1034     }
RemoveConfigChangedCallback(int32_t nodeId)1035     void RemoveConfigChangedCallback(int32_t nodeId)
1036     {
1037         configChangedCallback_.erase(nodeId);
1038     }
1039 
NotifyConfigurationChange()1040     void NotifyConfigurationChange()
1041     {
1042         for (const auto& [nodeId, callback] : configChangedCallback_) {
1043             if (callback) {
1044                 callback();
1045             }
1046         }
1047     }
1048 
1049     using PostRTTaskCallback = std::function<void(std::function<void()>&&)>;
SetPostRTTaskCallBack(PostRTTaskCallback && callback)1050     void SetPostRTTaskCallBack(PostRTTaskCallback&& callback)
1051     {
1052         postRTTaskCallback_ = std::move(callback);
1053     }
1054 
PostTaskToRT(std::function<void ()> && task)1055     void PostTaskToRT(std::function<void()>&& task)
1056     {
1057         if (postRTTaskCallback_) {
1058             postRTTaskCallback_(std::move(task));
1059         }
1060     }
1061 
1062     void SetGetWindowRectImpl(std::function<Rect()>&& callback);
1063 
1064     Rect GetCurrentWindowRect() const;
1065 
1066     using SafeAreaInsets = NG::SafeAreaInsets;
1067 
1068     virtual void UpdateSystemSafeArea(const SafeAreaInsets& systemSafeArea, bool checkSceneBoardWindow = false) {}
1069 
1070     virtual void UpdateCutoutSafeArea(const SafeAreaInsets& cutoutSafeArea, bool checkSceneBoardWindow = false) {}
1071 
1072     virtual void UpdateNavSafeArea(const SafeAreaInsets& navSafeArea, bool checkSceneBoardWindow = false) {}
1073 
UpdateOriginAvoidArea(const Rosen::AvoidArea & avoidArea,uint32_t type)1074     virtual void UpdateOriginAvoidArea(const Rosen::AvoidArea& avoidArea, uint32_t type) {}
1075 
SetEnableKeyBoardAvoidMode(KeyBoardAvoidMode value)1076     virtual void SetEnableKeyBoardAvoidMode(KeyBoardAvoidMode value) {}
1077 
GetEnableKeyBoardAvoidMode()1078     virtual KeyBoardAvoidMode GetEnableKeyBoardAvoidMode() {
1079         return KeyBoardAvoidMode::OFFSET;
1080     }
1081 
IsEnableKeyBoardAvoidMode()1082     virtual bool IsEnableKeyBoardAvoidMode() {
1083         return false;
1084     }
1085 
SetPixelRoundMode(PixelRoundMode pixelRoundMode)1086     void SetPixelRoundMode(PixelRoundMode pixelRoundMode)
1087     {
1088         pixelRoundMode_ = pixelRoundMode;
1089     }
1090 
GetPixelRoundMode()1091     PixelRoundMode GetPixelRoundMode() const
1092     {
1093         return pixelRoundMode_;
1094     }
1095 
RequireSummary()1096     virtual void RequireSummary() {}
1097 
SetPluginOffset(const Offset & offset)1098     void SetPluginOffset(const Offset& offset)
1099     {
1100         pluginOffset_ = offset;
1101     }
1102 
GetPluginOffset()1103     Offset GetPluginOffset() const
1104     {
1105         return pluginOffset_;
1106     }
1107 
SetPluginEventOffset(const Offset & offset)1108     void SetPluginEventOffset(const Offset& offset)
1109     {
1110         pluginEventOffset_ = offset;
1111     }
1112 
GetPluginEventOffset()1113     Offset GetPluginEventOffset() const
1114     {
1115         return pluginEventOffset_;
1116     }
NotifyMemoryLevel(int32_t level)1117     virtual void NotifyMemoryLevel(int32_t level) {}
1118 
SetDisplayWindowRectInfo(const Rect & displayWindowRectInfo)1119     virtual void SetDisplayWindowRectInfo(const Rect& displayWindowRectInfo)
1120     {
1121         displayWindowRectInfo_ = displayWindowRectInfo;
1122     }
1123 
SetWindowSizeChangeReason(WindowSizeChangeReason reason)1124     virtual void SetWindowSizeChangeReason(WindowSizeChangeReason reason) {}
1125 
1126     // This method can get the coordinates and size of the current window,
1127     // which can be added to the return value of the GetGlobalOffset method to get the window coordinates of the node.
GetDisplayWindowRectInfo()1128     const Rect& GetDisplayWindowRectInfo() const
1129     {
1130         return displayWindowRectInfo_;
1131     }
FlushModifier()1132     virtual void FlushModifier() {}
1133     virtual void FlushMessages() = 0;
SetGSVsyncCallback(std::function<void (void)> && callback)1134     void SetGSVsyncCallback(std::function<void(void)>&& callback)
1135     {
1136         gsVsyncCallback_ = std::move(callback);
1137     }
1138 
1139     virtual void FlushUITasks(bool triggeredByImplicitAnimation = false) = 0;
1140 
FlushAfterLayoutCallbackInImplicitAnimationTask()1141     virtual void FlushAfterLayoutCallbackInImplicitAnimationTask() {}
1142 
1143     virtual void FlushPipelineImmediately() = 0;
1144 
1145     virtual void FlushOnceVsyncTask() = 0;
1146 
1147     // get animateTo closure option
GetSyncAnimationOption()1148     AnimationOption GetSyncAnimationOption()
1149     {
1150         return animationOption_;
1151     }
1152 
SetSyncAnimationOption(const AnimationOption & option)1153     void SetSyncAnimationOption(const AnimationOption& option)
1154     {
1155         animationOption_ = option;
1156     }
1157 
SetKeyboardAnimationConfig(const KeyboardAnimationConfig & config)1158     void SetKeyboardAnimationConfig(const KeyboardAnimationConfig& config)
1159     {
1160         keyboardAnimationConfig_ = config;
1161     }
1162 
GetKeyboardAnimationConfig()1163     KeyboardAnimationConfig GetKeyboardAnimationConfig() const
1164     {
1165         return keyboardAnimationConfig_;
1166     }
1167 
SetNextFrameLayoutCallback(std::function<void ()> && callback)1168     void SetNextFrameLayoutCallback(std::function<void()>&& callback)
1169     {
1170         nextFrameLayoutCallback_ = std::move(callback);
1171     }
1172 
SetForegroundCalled(bool isForegroundCalled)1173     void SetForegroundCalled(bool isForegroundCalled)
1174     {
1175         isForegroundCalled_ = isForegroundCalled;
1176     }
1177 
SetIsSubPipeline(bool isSubPipeline)1178     void SetIsSubPipeline(bool isSubPipeline)
1179     {
1180         isSubPipeline_ = isSubPipeline;
1181     }
1182 
IsSubPipeline()1183     bool IsSubPipeline() const
1184     {
1185         return isSubPipeline_;
1186     }
1187 
SetParentPipeline(const WeakPtr<PipelineBase> & pipeline)1188     void SetParentPipeline(const WeakPtr<PipelineBase>& pipeline)
1189     {
1190         parentPipeline_ = pipeline;
1191     }
1192 
1193     void SetSubWindowVsyncCallback(AceVsyncCallback&& callback, int32_t subWindowId);
1194 
1195     void SetJsFormVsyncCallback(AceVsyncCallback&& callback, int32_t subWindowId);
1196 
1197     void RemoveSubWindowVsyncCallback(int32_t subWindowId);
1198 
1199     void RemoveJsFormVsyncCallback(int32_t subWindowId);
1200 
SetIsLayoutFullScreen(bool isLayoutFullScreen)1201     virtual void SetIsLayoutFullScreen(bool isLayoutFullScreen) {}
SetIsNeedAvoidWindow(bool isLayoutFullScreen)1202     virtual void SetIsNeedAvoidWindow(bool isLayoutFullScreen) {}
SetIgnoreViewSafeArea(bool ignoreViewSafeArea)1203     virtual void SetIgnoreViewSafeArea(bool ignoreViewSafeArea) {}
OnFoldStatusChange(FoldStatus foldStatus)1204     virtual void OnFoldStatusChange(FoldStatus foldStatus) {}
OnFoldDisplayModeChange(FoldDisplayMode foldDisplayMode)1205     virtual void OnFoldDisplayModeChange(FoldDisplayMode foldDisplayMode) {}
1206 
SetIsAppWindow(bool isAppWindow)1207     void SetIsAppWindow(bool isAppWindow)
1208     {
1209         isAppWindow_ = isAppWindow;
1210     }
1211 
GetIsAppWindow()1212     bool GetIsAppWindow() const
1213     {
1214         return isAppWindow_;
1215     }
1216 
SetFormAnimationStartTime(int64_t time)1217     void SetFormAnimationStartTime(int64_t time)
1218     {
1219         formAnimationStartTime_ = time;
1220     }
1221 
GetFormAnimationStartTime()1222     int64_t GetFormAnimationStartTime() const
1223     {
1224         return formAnimationStartTime_;
1225     }
1226 
SetIsFormAnimation(bool isFormAnimation)1227     void SetIsFormAnimation(bool isFormAnimation)
1228     {
1229         isFormAnimation_ = isFormAnimation;
1230     }
1231 
IsFormAnimation()1232     bool IsFormAnimation() const
1233     {
1234         return isFormAnimation_;
1235     }
1236 
SetFormAnimationFinishCallback(bool isFormAnimationFinishCallback)1237     void SetFormAnimationFinishCallback(bool isFormAnimationFinishCallback)
1238     {
1239         isFormAnimationFinishCallback_ = isFormAnimationFinishCallback;
1240     }
1241 
IsFormAnimationFinishCallback()1242     bool IsFormAnimationFinishCallback() const
1243     {
1244         return isFormAnimationFinishCallback_;
1245     }
1246 
1247     // restore
RestoreNodeInfo(std::unique_ptr<JsonValue> nodeInfo)1248     virtual void RestoreNodeInfo(std::unique_ptr<JsonValue> nodeInfo) {}
1249 
GetStoredNodeInfo()1250     virtual std::unique_ptr<JsonValue> GetStoredNodeInfo()
1251     {
1252         return nullptr;
1253     }
1254 
GetLastTouchTime()1255     uint64_t GetLastTouchTime() const
1256     {
1257         return lastTouchTime_;
1258     }
1259 
AddFormLinkInfo(int32_t id,const std::string & info)1260     void AddFormLinkInfo(int32_t id, const std::string& info)
1261     {
1262         LOGI("AddFormLinkInfo is %{public}s, id is %{public}d", info.c_str(), id);
1263         formLinkInfoMap_[id] = info;
1264     }
1265 
IsLayouting()1266     virtual bool IsLayouting() const
1267     {
1268         return false;
1269     }
1270 
SetHalfLeading(bool halfLeading)1271     void SetHalfLeading(bool halfLeading)
1272     {
1273         halfLeading_ = halfLeading;
1274     }
1275 
GetHalfLeading()1276     bool GetHalfLeading() const
1277     {
1278         return halfLeading_;
1279     }
1280 
SetHasPreviewTextOption(bool hasOption)1281     void SetHasPreviewTextOption(bool hasOption)
1282     {
1283         hasPreviewTextOption_ = hasOption;
1284     }
1285 
GetHasPreviewTextOption()1286     bool GetHasPreviewTextOption() const
1287     {
1288         return hasPreviewTextOption_;
1289     }
1290 
SetSupportPreviewText(bool changeSupported)1291     void SetSupportPreviewText(bool changeSupported)
1292     {
1293         hasSupportedPreviewText_ = !changeSupported;
1294     }
1295 
GetSupportPreviewText()1296     bool GetSupportPreviewText() const
1297     {
1298         return hasSupportedPreviewText_;
1299     }
1300 
GetOnFoucs()1301     bool GetOnFoucs() const
1302     {
1303         return onFocus_;
1304     }
1305 
GetOnActive()1306     bool GetOnActive() const
1307     {
1308         return onActive_;
1309     }
1310 
GetVsyncTime()1311     uint64_t GetVsyncTime() const
1312     {
1313         return vsyncTime_;
1314     }
1315 
SetVsyncTime(uint64_t time)1316     void SetVsyncTime(uint64_t time)
1317     {
1318         vsyncTime_ = time;
1319     }
1320 
UpdateCurrentActiveNode(const WeakPtr<NG::FrameNode> & node)1321     virtual void UpdateCurrentActiveNode(const WeakPtr<NG::FrameNode>& node) {}
1322 
GetCurrentExtraInfo()1323     virtual std::string GetCurrentExtraInfo() { return ""; }
1324     virtual void UpdateTitleInTargetPos(bool isShow = true, int32_t height = 0) {}
1325 
SetCursor(int32_t cursorValue)1326     virtual void SetCursor(int32_t cursorValue) {}
1327 
1328     virtual void RestoreDefault(int32_t windowId = 0) {}
1329 
SetOnFormRecycleCallback(std::function<std::string ()> && onFormRecycle)1330     void SetOnFormRecycleCallback(std::function<std::string()>&& onFormRecycle)
1331     {
1332         onFormRecycle_ = std::move(onFormRecycle);
1333     }
1334 
1335     std::string OnFormRecycle();
1336 
SetOnFormRecoverCallback(std::function<void (std::string)> && onFormRecover)1337     void SetOnFormRecoverCallback(std::function<void(std::string)>&& onFormRecover)
1338     {
1339         onFormRecover_ = std::move(onFormRecover);
1340     }
1341 
1342     void OnFormRecover(const std::string& statusData);
1343 
IsDragging()1344     virtual bool IsDragging() const
1345     {
1346         return false;
1347     }
1348 
SetIsDragging(bool isDragging)1349     virtual void SetIsDragging(bool isDragging) {}
1350 
ResetDragging()1351     virtual void ResetDragging() {}
1352 
GetSerializedGesture()1353     virtual const SerializedGesture& GetSerializedGesture() const
1354     {
1355         return serializedGesture_;
1356     }
1357 
PrintVsyncInfoIfNeed()1358     virtual bool PrintVsyncInfoIfNeed() const
1359     {
1360         return false;
1361     }
1362 
StartWindowAnimation()1363     virtual void StartWindowAnimation() {}
1364 
StopWindowAnimation()1365     virtual void StopWindowAnimation() {}
1366 
AddSyncGeometryNodeTask(std::function<void ()> && task)1367     virtual void AddSyncGeometryNodeTask(std::function<void()>&& task) {}
1368 
FlushSyncGeometryNodeTasks()1369     virtual void FlushSyncGeometryNodeTasks() {}
1370 
ChangeSensitiveNodes(bool flag)1371     virtual void ChangeSensitiveNodes(bool flag) {}
1372 
IsContainerModalVisible()1373     virtual bool IsContainerModalVisible()
1374     {
1375         return false;
1376     }
1377 
GetFrameCount()1378     uint32_t GetFrameCount() const
1379     {
1380         return frameCount_;
1381     }
1382 
CheckAndLogLastReceivedTouchEventInfo(int32_t eventId,TouchType type)1383     virtual void CheckAndLogLastReceivedTouchEventInfo(int32_t eventId, TouchType type) {}
1384 
CheckAndLogLastConsumedTouchEventInfo(int32_t eventId,TouchType type)1385     virtual void CheckAndLogLastConsumedTouchEventInfo(int32_t eventId, TouchType type) {}
1386 
CheckAndLogLastReceivedMouseEventInfo(int32_t eventId,MouseAction action)1387     virtual void CheckAndLogLastReceivedMouseEventInfo(int32_t eventId, MouseAction action) {}
1388 
CheckAndLogLastConsumedMouseEventInfo(int32_t eventId,MouseAction action)1389     virtual void CheckAndLogLastConsumedMouseEventInfo(int32_t eventId, MouseAction action) {}
1390 
CheckAndLogLastReceivedAxisEventInfo(int32_t eventId,AxisAction action)1391     virtual void CheckAndLogLastReceivedAxisEventInfo(int32_t eventId, AxisAction action) {}
1392 
CheckAndLogLastConsumedAxisEventInfo(int32_t eventId,AxisAction action)1393     virtual void CheckAndLogLastConsumedAxisEventInfo(int32_t eventId, AxisAction action) {}
1394 
GetPageAvoidOffset()1395     virtual float GetPageAvoidOffset()
1396     {
1397         return 0.0f;
1398     }
1399 
CheckNeedAvoidInSubWindow()1400     virtual bool CheckNeedAvoidInSubWindow()
1401     {
1402         return false;
1403     }
1404 
1405     virtual bool IsDensityChanged() const = 0;
1406 
1407     virtual bool IsNeedReloadDensity() const = 0;
1408 
1409     virtual void SetIsNeedReloadDensity(bool isNeedReloadDensity) = 0;
1410 
GetResponseRegion(const RefPtr<NG::FrameNode> & rootNode)1411     virtual std::string GetResponseRegion(const RefPtr<NG::FrameNode>& rootNode)
1412     {
1413         return "";
1414     };
1415 
NotifyResponseRegionChanged(const RefPtr<NG::FrameNode> & rootNode)1416     virtual void NotifyResponseRegionChanged(const RefPtr<NG::FrameNode>& rootNode) {};
1417 
SetTHPExtraManager(const RefPtr<NG::THPExtraManager> & thpExtraMgr)1418     void SetTHPExtraManager(const RefPtr<NG::THPExtraManager>& thpExtraMgr)
1419     {
1420         thpExtraMgr_ = thpExtraMgr;
1421     }
1422 
GetTHPExtraManager()1423     const RefPtr<NG::THPExtraManager>& GetTHPExtraManager() const
1424     {
1425         return thpExtraMgr_;
1426     }
1427 
1428     void SetUiDvsyncSwitch(bool on);
1429     virtual bool GetOnShow() const = 0;
1430     bool IsDestroyed();
1431 
1432     void SetDestroyed();
1433 
1434 #if defined(SUPPORT_TOUCH_TARGET_TEST)
1435     // Called by hittest to find touch node is equal target.
1436     virtual bool OnTouchTargetHitTest(const TouchEvent& point, bool isSubPipe = false,
1437         const std::string& target = "") = 0;
1438 #endif
IsWindowFocused()1439     virtual bool IsWindowFocused() const
1440     {
1441         return GetOnFoucs();
1442     }
1443 
IsWindowActivated()1444     virtual bool IsWindowActivated() const
1445     {
1446         return GetOnActive();
1447     }
1448 
SetDragNodeGrayscale(float dragNodeGrayscale)1449     void SetDragNodeGrayscale(float dragNodeGrayscale)
1450     {
1451         dragNodeGrayscale_ = dragNodeGrayscale;
1452     }
1453 
GetDragNodeGrayscale()1454     float GetDragNodeGrayscale() const
1455     {
1456         return dragNodeGrayscale_;
1457     }
1458 
IsDirtyNodesEmpty()1459     virtual bool IsDirtyNodesEmpty() const
1460     {
1461         return true;
1462     }
1463 
IsDirtyLayoutNodesEmpty()1464     virtual bool IsDirtyLayoutNodesEmpty() const
1465     {
1466         return true;
1467     }
1468 
IsDirtyPropertyNodesEmpty()1469     virtual bool IsDirtyPropertyNodesEmpty() const
1470     {
1471         return true;
1472     }
1473 
1474     void SetUIExtensionEventCallback(std::function<void(uint32_t)>&& callback);
1475     void AddUIExtensionCallbackEvent(NG::UIExtCallbackEventId eventId);
1476     void FireAllUIExtensionEvents();
1477     void FireUIExtensionEventOnceImmediately(NG::UIExtCallbackEventId eventId);
1478     void FireUIExtensionEventInner(uint32_t eventId);
1479 
SetOpenInvisibleFreeze(bool isOpenInvisibleFreeze)1480     void SetOpenInvisibleFreeze(bool isOpenInvisibleFreeze)
1481     {
1482         isOpenInvisibleFreeze_ = isOpenInvisibleFreeze;
1483     }
1484 
IsOpenInvisibleFreeze()1485     bool IsOpenInvisibleFreeze() const
1486     {
1487         return isOpenInvisibleFreeze_;
1488     }
1489 
SetVisibleAreaRealTime(bool visibleAreaRealTime)1490     void SetVisibleAreaRealTime(bool visibleAreaRealTime)
1491     {
1492         visibleAreaRealTime_ = visibleAreaRealTime;
1493     }
1494 
GetVisibleAreaRealTime()1495     bool GetVisibleAreaRealTime() const
1496     {
1497         return visibleAreaRealTime_;
1498     }
1499 
1500     // Prints out the count of the unexecuted finish callback
1501     std::string GetUnexecutedFinishCount() const;
1502 
1503     void SetAccessibilityEventCallback(std::function<void(uint32_t, int64_t)>&& callback);
1504 
1505     void AddAccessibilityCallbackEvent(AccessibilityCallbackEventId event, int64_t parameter);
1506 
1507     void FireAccessibilityEvents();
1508     void FireAccessibilityEventInner(uint32_t event, int64_t parameter);
1509 
SetTouchAccelarate(bool isEnable)1510     virtual void SetTouchAccelarate(bool isEnable) {}
SetTouchPassThrough(bool isEnable)1511     virtual void SetTouchPassThrough(bool isEnable) {}
SetEnableSwipeBack(bool isEnable)1512     virtual void SetEnableSwipeBack(bool isEnable) {}
1513 
1514     /**
1515      * @description: Set the target api version of the application.
1516      * @param: The target api version of the application.
1517      */
SetApiTargetVersion(int32_t apiTargetVersion)1518     void SetApiTargetVersion(int32_t apiTargetVersion)
1519     {
1520         apiTargetVersion_ = apiTargetVersion;
1521     }
1522 
1523     /**
1524      * @description: Get the target api version of the application.
1525      * @return: The target api version of the application.
1526      */
GetApiTargetVersion()1527     int32_t GetApiTargetVersion() const
1528     {
1529         return apiTargetVersion_;
1530     }
1531 
1532     /**
1533      * @description: Compare whether the target api version of the application is greater than or equal to the incoming
1534      * target. If it is possible to obtain the pipeline without using GetCurrentContext, GetCurrentContextSafely, and
1535      * GetCurrentContextSafelyWithCheck, the performance will be better than Container::GreatOrEqualApiTargetVersion.
1536      * @param: Target version to be isolated.
1537      * @return: return the compare result.
1538      */
GreatOrEqualAPITargetVersion(PlatformVersion version)1539     bool GreatOrEqualAPITargetVersion(PlatformVersion version) const
1540     {
1541         return apiTargetVersion_ >= static_cast<int32_t>(version);
1542     }
1543 
1544     /**
1545      * @description: Compare whether the target api version of the application is less than the incoming target
1546      * version. If it is possible to obtain the pipeline without using GetCurrentContext, GetCurrentContextSafely, and
1547      * GetCurrentContextSafelyWithCheck, the performance will be better than Container::LessThanAPITargetVersion.
1548      * @param: Target version to be isolated.
1549      * @return: return the compare result.
1550      */
LessThanAPITargetVersion(PlatformVersion version)1551     bool LessThanAPITargetVersion(PlatformVersion version) const
1552     {
1553         return apiTargetVersion_ < static_cast<int32_t>(version);
1554     }
1555 
1556 protected:
1557     virtual bool MaybeRelease() override;
TryCallNextFrameLayoutCallback()1558     void TryCallNextFrameLayoutCallback()
1559     {
1560         if (isForegroundCalled_ && nextFrameLayoutCallback_) {
1561             isForegroundCalled_ = false;
1562             nextFrameLayoutCallback_();
1563             LOGI("nextFrameLayoutCallback called");
1564         }
1565     }
1566 
OnDumpInfo(const std::vector<std::string> & params)1567     virtual bool OnDumpInfo(const std::vector<std::string>& params) const
1568     {
1569         return false;
1570     }
1571     virtual void FlushVsync(uint64_t nanoTimestamp, uint32_t frameCount) = 0;
1572     virtual void SetRootRect(double width, double height, double offset = 0.0) = 0;
1573     virtual void FlushPipelineWithoutAnimation() = 0;
1574 
1575     virtual void OnVirtualKeyboardHeightChange(float keyboardHeight,
1576         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, const float safeHeight = 0.0f,
1577         const bool supportAvoidance = false, bool forceChange = false)
1578     {}
1579     virtual void OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height,
1580         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, bool forceChange = false)
1581     {}
1582 
1583     void UpdateRootSizeAndScale(int32_t width, int32_t height);
1584 
SetIsReloading(bool isReloading)1585     void SetIsReloading(bool isReloading)
1586     {
1587         isReloading_ = isReloading;
1588     }
1589     bool FireUIExtensionEventValid();
1590 
1591     std::function<void()> GetWrappedAnimationCallback(const AnimationOption& option,
1592         const std::function<void()>& finishCallback, const std::optional<int32_t>& count = std::nullopt);
1593 
1594     bool MarkUpdateSubwindowKeyboardInsert(int32_t instanceId, double keyboardHeight, int32_t type);
1595 
1596     std::map<int32_t, configChangedCallback> configChangedCallback_;
1597     std::map<int32_t, virtualKeyBoardCallback> virtualKeyBoardCallback_;
1598     std::list<foldStatusChangedCallback> foldStatusChangedCallback_;
1599 
1600     bool isRebuildFinished_ = false;
1601     bool isJsCard_ = false;
1602     bool isFormRender_ = false;
1603     bool isDynamicRender_ = false;
1604     bool isRightToLeft_ = false;
1605     bool isFullWindow_ = false;
1606     bool isAppWindow_ = true;
1607     bool installationFree_ = false;
1608     bool isSubPipeline_ = false;
1609     bool isReloading_ = false;
1610 
1611     bool isJsPlugin_ = false;
1612     bool isOpenInvisibleFreeze_ = false;
1613     PixelRoundMode pixelRoundMode_ = PixelRoundMode::PIXEL_ROUND_ON_LAYOUT_FINISH;
1614 
1615     std::unordered_map<int32_t, AceVsyncCallback> subWindowVsyncCallbacks_;
1616     std::unordered_map<int32_t, AceVsyncCallback> jsFormVsyncCallbacks_;
1617     int32_t minPlatformVersion_ = 0;
1618     uint32_t windowId_ = 0;
1619     // UIExtensionAbility need component windowID
1620     std::optional<uint32_t> focusWindowId_;
1621     std::optional<uint32_t> realHostWindowId_;
1622 
1623     int32_t appLabelId_ = 0;
1624     float fontScale_ = 1.0f;
1625     float fontWeightScale_ = 1.0f;
1626     float designWidthScale_ = 1.0f;
1627     float viewScale_ = 1.0f;
1628     double density_ = 1.0;
1629     double dipScale_ = 1.0;
1630     double rootHeight_ = 0.0;
1631     double rootWidth_ = 0.0;
1632     int32_t width_ = 0;
1633     int32_t height_ = 0;
1634     FrontendType frontendType_;
1635     WindowModal windowModal_ = WindowModal::NORMAL;
1636 
1637     Offset pluginOffset_ { 0, 0 };
1638     Offset pluginEventOffset_ { 0, 0 };
1639     Color appBgColor_ = Color::WHITE;
1640     int8_t renderingMode_ = 0;
1641     bool enableBlurBackground_ = false;
1642 
1643     std::unique_ptr<DrawDelegate> drawDelegate_;
1644     std::stack<bool> pendingImplicitLayout_;
1645     std::stack<bool> pendingImplicitRender_;
1646     std::stack<bool> pendingFrontendAnimation_;
1647     std::shared_ptr<Window> window_;
1648     RefPtr<TaskExecutor> taskExecutor_;
1649     RefPtr<AssetManager> assetManager_;
1650     WeakPtr<Frontend> weakFrontend_;
1651     int32_t instanceId_ = 0;
1652     RefPtr<EventManager> eventManager_;
1653     RefPtr<ImageCache> imageCache_;
1654     RefPtr<SharedImageManager> sharedImageManager_;
1655     mutable std::shared_mutex imageMtx_;
1656     mutable std::shared_mutex themeMtx_;
1657     mutable std::mutex destructMutex_;
1658     RefPtr<ThemeManager> themeManager_;
1659     RefPtr<DataProviderManagerInterface> dataProviderManager_;
1660     RefPtr<FontManager> fontManager_;
1661     RefPtr<ManagerInterface> textFieldManager_;
1662     RefPtr<PlatformBridge> messageBridge_;
1663     RefPtr<WindowManager> windowManager_;
1664     OnPageShowCallBack onPageShowCallBack_;
1665     AnimationCallback animationCallback_;
1666     ProfilerCallback onVsyncProfiler_;
1667     FinishEventHandler finishEventHandler_;
1668     StartAbilityHandler startAbilityHandler_;
1669     StartAbilityOnQueryHandler startAbilityOnQueryHandler_;
1670     ActionEventHandler actionEventHandler_;
1671     FormLinkInfoUpdateHandler formLinkInfoUpdateHandler_;
1672     RefPtr<PlatformResRegister> platformResRegister_;
1673 
1674     WeakPtr<PipelineBase> parentPipeline_;
1675 
1676     std::vector<WeakPtr<PipelineBase>> touchPluginPipelineContext_;
1677     RefPtr<Clipboard> clipboard_;
1678     std::function<void(const std::string&)> clipboardCallback_ = nullptr;
1679     Rect displayWindowRectInfo_;
1680     AnimationOption animationOption_;
1681     KeyboardAnimationConfig keyboardAnimationConfig_;
1682 
1683     std::function<void()> nextFrameLayoutCallback_ = nullptr;
1684     SharePanelCallback sharePanelCallback_ = nullptr;
1685     std::atomic<bool> isForegroundCalled_ = false;
1686     std::atomic<bool> onFocus_ = false;
1687     std::atomic<bool> onActive_ = false;
1688     uint64_t lastTouchTime_ = 0;
1689     uint64_t lastMouseTime_ = 0;
1690     uint64_t lastDragTime_ = 0;
1691     std::map<int32_t, std::string> formLinkInfoMap_;
1692     struct FunctionHash {
operatorFunctionHash1693         std::size_t operator()(const std::shared_ptr<std::function<void()>>& functionPtr) const
1694         {
1695             return std::hash<std::function<void()>*>()(functionPtr.get());
1696         }
1697     };
1698     std::function<std::string()> onFormRecycle_;
1699     std::function<void(std::string)> onFormRecover_;
1700 
1701     uint64_t compensationValue_ = 0;
1702     int64_t recvTime_ = 0;
1703     std::once_flag displaySyncFlag_;
1704     RefPtr<UIDisplaySyncManager> uiDisplaySyncManager_;
1705 
1706     SerializedGesture serializedGesture_;
1707     RefPtr<NG::THPExtraManager> thpExtraMgr_;
1708 private:
1709     void DumpFrontend() const;
1710     double ModifyKeyboardHeight(double keyboardHeight) const;
1711     StatusBarEventHandler statusBarBgColorEventHandler_;
1712     PopupEventHandler popupEventHandler_;
1713     MenuEventHandler menuEventHandler_;
1714     ContextMenuEventHandler contextMenuEventHandler_;
1715     RouterBackEventHandler routerBackEventHandler_;
1716     std::list<PopPageSuccessEventHandler> popPageSuccessEventHandler_;
1717     std::list<IsPagePathInvalidEventHandler> isPagePathInvalidEventHandler_;
1718     std::list<DestroyEventHandler> destroyEventHandler_;
1719     std::list<DispatchTouchEventHandler> dispatchTouchEventHandler_;
1720     GetViewScaleCallback getViewScaleCallback_;
1721     // OnRouterChangeCallback is function point, need to be initialized.
1722     OnRouterChangeCallback onRouterChangeCallback_ = nullptr;
1723     PostRTTaskCallback postRTTaskCallback_;
1724     std::function<void(void)> gsVsyncCallback_;
1725     std::unordered_set<std::shared_ptr<std::function<void()>>, FunctionHash> finishFunctions_;
1726     std::unordered_set<int32_t> finishCount_;
1727     bool isFormAnimationFinishCallback_ = false;
1728     int64_t formAnimationStartTime_ = 0;
1729     bool isFormAnimation_ = false;
1730     bool halfLeading_ = false;
1731     bool hasSupportedPreviewText_ = true;
1732     bool hasPreviewTextOption_ = false;
1733     // whether visible area need to be calculate at each vsync after approximate timeout.
1734     bool visibleAreaRealTime_ = false;
1735     uint64_t vsyncTime_ = 0;
1736 
1737     bool destroyed_ = false;
1738     uint32_t frameCount_ = 0;
1739     bool followSystem_ = false;
1740     float maxAppFontScale_ = static_cast<float>(INT32_MAX);
1741     float dragNodeGrayscale_ = 0.0f;
1742     int32_t apiTargetVersion_ = 0;
1743 
1744     // To avoid the race condition caused by the offscreen canvas get density from the pipeline in the worker thread.
1745     std::mutex densityChangeMutex_;
1746     int32_t densityChangeCallbackId_ = 0;
1747     std::unordered_map<int32_t, std::function<void(double)>> densityChangedCallbacks_;
1748     std::function<double()> windowDensityCallback_;
1749     std::function<void(uint32_t)> uiExtensionEventCallback_;
1750     std::set<NG::UIExtCallbackEvent> uiExtensionEvents_;
1751     std::function<void(uint32_t, int64_t)> accessibilityCallback_;
1752     std::set<AccessibilityCallbackEvent> accessibilityEvents_;
1753 
1754     ACE_DISALLOW_COPY_AND_MOVE(PipelineBase);
1755 };
1756 
1757 } // namespace OHOS::Ace
1758 
1759 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_PIPELINE_PIPELINE_BASE_H
1760