1 /* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_PATTERN_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_PATTERN_H 18 19 #include <optional> 20 #include <string> 21 #include <utility> 22 23 #include "base/geometry/dimension.h" 24 #include "base/geometry/ng/offset_t.h" 25 #include "base/geometry/ng/rect_t.h" 26 #include "base/geometry/ng/size_t.h" 27 #include "base/geometry/size.h" 28 #include "base/memory/referenced.h" 29 #include "base/utils/utils.h" 30 #include "core/common/thread_checker.h" 31 #include "core/components/common/layout/constants.h" 32 #include "core/components/xcomponent/native_interface_xcomponent_impl.h" 33 #include "core/components_ng/event/focus_hub.h" 34 #include "core/components_ng/event/input_event.h" 35 #include "core/components_ng/pattern/pattern.h" 36 #include "core/components_ng/pattern/xcomponent/inner_xcomponent_controller.h" 37 #include "core/components_ng/pattern/xcomponent/xcomponent_accessibility_provider.h" 38 #include "core/components_ng/pattern/xcomponent/xcomponent_event_hub.h" 39 #include "core/components_ng/pattern/xcomponent/xcomponent_layout_algorithm.h" 40 #include "core/components_ng/pattern/xcomponent/xcomponent_layout_property.h" 41 #include "core/components_ng/pattern/xcomponent/xcomponent_paint_method.h" 42 #include "core/components_ng/property/property.h" 43 #include "core/components_ng/render/render_surface.h" 44 #include "core/pipeline_ng/pipeline_context.h" 45 #include "core/components_ng/manager/display_sync/ui_display_sync.h" 46 #include "core/gestures/velocity.h" 47 48 namespace OHOS::Ace { 49 class ImageAnalyzerManager; 50 } 51 namespace OHOS::Ace::NG { 52 class XComponentExtSurfaceCallbackClient; 53 class XComponentPattern : public Pattern { 54 DECLARE_ACE_TYPE(XComponentPattern, Pattern); 55 56 public: 57 XComponentPattern() = default; 58 XComponentPattern(const std::optional<std::string>& id, XComponentType type, 59 const std::optional<std::string>& libraryname, 60 const std::shared_ptr<InnerXComponentController>& xcomponentController, float initWidth = 0.0f, 61 float initHeight = 0.0f, bool isTypedNode = false); 62 ~XComponentPattern() override = default; 63 IsEnableMatchParent()64 bool IsEnableMatchParent() override 65 { 66 return true; 67 } 68 IsEnableFix()69 bool IsEnableFix() override 70 { 71 return true; 72 } 73 IsAtomicNode()74 bool IsAtomicNode() const override 75 { 76 return type_ == XComponentType::SURFACE || type_ == XComponentType::TEXTURE || type_ == XComponentType::NODE; 77 } 78 CreateLayoutProperty()79 RefPtr<LayoutProperty> CreateLayoutProperty() override 80 { 81 return MakeRefPtr<XComponentLayoutProperty>(); 82 } 83 CreateEventHub()84 RefPtr<EventHub> CreateEventHub() override 85 { 86 return MakeRefPtr<XComponentEventHub>(); 87 } 88 CreateLayoutAlgorithm()89 RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override 90 { 91 return MakeRefPtr<XComponentLayoutAlgorithm>(); 92 } 93 CreateNodePaintMethod()94 RefPtr<NodePaintMethod> CreateNodePaintMethod() override 95 { 96 if (type_ == XComponentType::TEXTURE) { 97 auto paint = MakeRefPtr<XComponentPaintMethod>(renderSurface_, AceType::Claim(this)); 98 return paint; 99 } 100 return nullptr; 101 } 102 GetFocusPattern()103 FocusPattern GetFocusPattern() const override 104 { 105 if (type_ == XComponentType::NODE) { 106 return { FocusType::SCOPE, true }; 107 } 108 FocusPattern focusPattern = { FocusType::NODE, false }; 109 focusPattern.SetIsFocusActiveWhenFocused(true); 110 return focusPattern; 111 } 112 NeedSoftKeyboard()113 bool NeedSoftKeyboard() const override 114 { 115 return (nativeXComponentImpl_ ? nativeXComponentImpl_->IsNeedSoftKeyboard() : false) || isNeedSoftKeyboard_; 116 } 117 GetNativeXComponent()118 std::pair<RefPtr<OHOS::Ace::NativeXComponentImpl>, std::weak_ptr<OH_NativeXComponent>> GetNativeXComponent() 119 { 120 if (!nativeXComponent_ || !nativeXComponentImpl_) { 121 // for XComponentType::NODE 122 nativeXComponentImpl_ = AceType::MakeRefPtr<NativeXComponentImpl>(); 123 nativeXComponent_ = std::make_shared<OH_NativeXComponent>(AceType::RawPtr(nativeXComponentImpl_)); 124 } 125 return std::make_pair(nativeXComponentImpl_, nativeXComponent_); 126 } 127 128 void NativeXComponentDispatchTouchEvent(const OH_NativeXComponent_TouchEvent& touchEvent, 129 const std::vector<XComponentTouchPoint>& xComponentTouchPoints); 130 void NativeXComponentDispatchMouseEvent(const OH_NativeXComponent_MouseEvent& mouseEvent, 131 const OH_NativeXComponent_ExtraMouseEventInfo& extraMouseEventInfo); 132 void NativeXComponentDispatchAxisEvent(AxisEvent* axisEvent); 133 134 void InitXComponent(); 135 void InitNativeXComponent(); 136 void InitNativeWindow(float textureWidth, float textureHeight); 137 void XComponentSizeInit(); 138 void XComponentSizeChange(const RectF& surfaceRect, bool needFireNativeEvent); NativeXComponentInit()139 void NativeXComponentInit() 140 { 141 if (!isTypedNode_) { 142 OnSurfaceCreated(); 143 } 144 } 145 GetId()146 std::string GetId() const 147 { 148 if (id_.has_value()) { 149 return id_.value(); 150 } 151 return "nodeId_" + nodeId_; 152 } 153 SetId(const std::string & id)154 void SetId(const std::string& id) 155 { 156 id_ = id; 157 } 158 GetLibraryName()159 const std::optional<std::string>& GetLibraryName() const 160 { 161 return libraryname_; 162 } 163 SetLibraryName(const std::optional<std::string> & libraryname)164 void SetLibraryName(const std::optional<std::string>& libraryname) 165 { 166 libraryname_ = libraryname; 167 } 168 GetSoPath()169 const std::optional<std::string>& GetSoPath() const 170 { 171 return soPath_; 172 } 173 SetSoPath(const std::string & soPath)174 void SetSoPath(const std::string& soPath) 175 { 176 soPath_ = soPath; 177 } 178 GetType()179 XComponentType GetType() 180 { 181 return type_; 182 } 183 SetType(XComponentType type)184 void SetType(XComponentType type) 185 { 186 type_ = type; 187 } 188 GetDrawSize()189 const SizeF& GetDrawSize() const 190 { 191 return drawSize_; 192 } 193 GetSurfaceSize()194 const SizeF& GetSurfaceSize() const 195 { 196 return surfaceSize_; 197 } 198 GetSurfaceOffset()199 const OffsetF& GetSurfaceOffset() const 200 { 201 return surfaceOffset_; 202 } 203 204 OffsetF GetOffsetRelativeToWindow(); 205 GetRenderContextForSurface()206 const RefPtr<RenderContext>& GetRenderContextForSurface() 207 { 208 return renderContextForSurface_; 209 } 210 211 void SetSurfaceRotation(bool isLock); 212 GetSurfaceRotation()213 bool GetSurfaceRotation() 214 { 215 return isSurfaceLock_; 216 } 217 SetIsTypeNode(bool isTypeNode)218 void SetIsTypeNode(bool isTypeNode) 219 { 220 isTypedNode_ = isTypeNode; 221 } 222 GetXComponentController()223 std::shared_ptr<InnerXComponentController> GetXComponentController() 224 { 225 return xcomponentController_; 226 } 227 228 void SetHandlingRenderContextForSurface(const RefPtr<RenderContext>& otherRenderContext); 229 230 void RestoreHandlingRenderContextForSurface(); 231 232 XComponentControllerErrorCode SetExtController(const RefPtr<XComponentPattern>& extPattern); 233 XComponentControllerErrorCode ResetExtController(const RefPtr<XComponentPattern>& extPattern); 234 SetExpectedRateRangeInit()235 void SetExpectedRateRangeInit() 236 { 237 CHECK_NULL_VOID(nativeXComponentImpl_); 238 nativeXComponentImpl_->SetExpectedRateRangeEventCallback([weak = AceType::WeakClaim(this)]() { 239 auto xComponentPattern = weak.Upgrade(); 240 CHECK_NULL_VOID(xComponentPattern); 241 xComponentPattern->HandleSetExpectedRateRangeEvent(); 242 }); 243 } 244 OnFrameEventInit()245 void OnFrameEventInit() 246 { 247 CHECK_NULL_VOID(nativeXComponentImpl_); 248 nativeXComponentImpl_->SetOnFrameEventCallback([weak = AceType::WeakClaim(this)]() { 249 auto xComponentPattern = weak.Upgrade(); 250 CHECK_NULL_VOID(xComponentPattern); 251 xComponentPattern->HandleOnFrameEvent(); 252 }); 253 } 254 UnregisterOnFrameEventInit()255 void UnregisterOnFrameEventInit() 256 { 257 CHECK_NULL_VOID(nativeXComponentImpl_); 258 nativeXComponentImpl_->SetUnregisterOnFrameEventCallback([weak = AceType::WeakClaim(this)]() { 259 auto xComponentPattern = weak.Upgrade(); 260 CHECK_NULL_VOID(xComponentPattern); 261 xComponentPattern->HandleUnregisterOnFrameEvent(); 262 }); 263 } 264 SetXcomponentInit(bool isInit)265 void SetXcomponentInit(bool isInit) 266 { 267 hasXComponentInit_ = isInit; 268 } 269 270 bool ChangeRenderType(NodeRenderType renderType); 271 SetRenderType(NodeRenderType renderType)272 void SetRenderType(NodeRenderType renderType) 273 { 274 renderType_ = renderType; 275 } 276 UpdateTransformHintChangedCallbackId(std::optional<int32_t> id)277 void UpdateTransformHintChangedCallbackId(std::optional<int32_t> id) 278 { 279 transformHintChangedCallbackId_ = id; 280 } 281 HasTransformHintChangedCallbackId()282 bool HasTransformHintChangedCallbackId() 283 { 284 return transformHintChangedCallbackId_.has_value(); 285 } 286 NeedTriggerLoadEventImmediately()287 bool NeedTriggerLoadEventImmediately() const 288 { 289 return isTypedNode_ && isNativeXComponent_ && hasLoadNativeDone_; 290 } 291 HasGotSurfaceHolder()292 bool HasGotSurfaceHolder() const 293 { 294 return hasGotSurfaceHolder_; 295 } 296 HasGotNativeXComponent()297 bool HasGotNativeXComponent() const 298 { 299 return hasGotNativeXComponent_; 300 } 301 IsBindNative()302 virtual bool IsBindNative() 303 { 304 return false; 305 } 306 IsNativeXComponentDisabled()307 bool IsNativeXComponentDisabled() const 308 { 309 return isNativeXComponentDisabled_; 310 } 311 SetHasGotNativeXComponent(bool hasGotNativeXComponent)312 void SetHasGotNativeXComponent(bool hasGotNativeXComponent) 313 { 314 hasGotNativeXComponent_ = hasGotNativeXComponent; 315 } 316 317 void SetExportTextureSurfaceId(const std::string& surfaceId); 318 void FireExternalEvent(RefPtr<NG::PipelineContext> context, 319 const std::string& componentId, const uint32_t nodeId, const bool isDestroy); 320 void ConfigSurface(uint32_t surfaceWidth, uint32_t surfaceHeight); 321 322 // accessibility 323 void InitializeAccessibility(); 324 void UninitializeAccessibility(FrameNode* frameNode); 325 bool OnAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId); 326 bool OnAccessibilityChildTreeDeregister(); 327 void OnSetAccessibilityChildTree(int32_t childWindowId, int32_t childTreeId); SetAccessibilityState(bool state)328 void SetAccessibilityState(bool state) {} 329 RefPtr<AccessibilitySessionAdapter> GetAccessibilitySessionAdapter() override; 330 void InitializeAccessibilityCallback(); 331 void HandleRegisterAccessibilityEvent(bool isRegister); 332 333 void SetIdealSurfaceWidth(float surfaceWidth); 334 void SetIdealSurfaceHeight(float surfaceHeight); 335 void SetIdealSurfaceOffsetX(float offsetX); 336 void SetIdealSurfaceOffsetY(float offsetY); 337 void ClearIdealSurfaceOffset(bool isXAxis); 338 std::tuple<bool, bool, bool> UpdateSurfaceRect(); 339 void HandleSurfaceChangeEvent(bool needForceRender, bool offsetChanged, bool sizeChanged, bool needFireNativeEvent, 340 bool frameOffsetChange = false); 341 void EnableAnalyzer(bool enable); 342 void SetImageAIOptions(void* options); 343 void StartImageAnalyzer(void* config, OnAnalyzedCallback& onAnalyzed); 344 void StopImageAnalyzer(); 345 RectF AdjustPaintRect(float positionX, float positionY, float width, float height, bool isRound); 346 float RoundValueToPixelGrid(float value, bool isRound, bool forceCeil, bool forceFloor); 347 void OnSurfaceDestroyed(FrameNode* frameNode = nullptr); 348 void SetRenderFit(RenderFit renderFit); 349 void SetScreenId(uint64_t screenId); 350 void HandleSurfaceCreated(); 351 void HandleSurfaceDestroyed(FrameNode* frameNode = nullptr); ChangeSurfaceCallbackMode(SurfaceCallbackMode mode)352 void ChangeSurfaceCallbackMode(SurfaceCallbackMode mode) 353 { 354 if (surfaceCallbackModeChangeEvent_) { 355 surfaceCallbackModeChangeEvent_(mode); 356 } 357 } 358 void OnSurfaceCallbackModeChange(SurfaceCallbackMode mode); 359 void EnableSecure(bool isSecure); 360 void HdrBrightness(float hdrBrightness); 361 void EnableTransparentLayer(bool isTransparentLayer); 362 RenderFit GetSurfaceRenderFit() const; 363 bool GetEnableAnalyzer(); 364 void NativeStartImageAnalyzer(std::function<void(int32_t)>& callback); 365 RSCanvas* LockCanvas(); 366 void UnlockCanvasAndPost(RSCanvas* canvas); 367 ArkUI_AccessibilityProvider* GetNativeProvider(); 368 369 protected: 370 void OnAttachToMainTree() override; 371 void OnDetachFromMainTree() override; 372 void OnAttachToFrameNode() override; 373 void OnDetachFromFrameNode(FrameNode* frameNode) override; 374 void BeforeSyncGeometryProperties(const DirtySwapConfig& config) override; 375 void OnRebuildFrame() override; 376 void OnWindowHide() override; 377 void OnWindowShow() override; 378 void OnModifyDone() override; 379 void AddAfterLayoutTaskForExportTexture(); 380 void UpdateTransformHint(); 381 void DumpInfo() override; 382 static std::string XComponentTypeToString(XComponentType type); 383 static std::string XComponentNodeTypeToString(XComponentNodeType type); 384 void AdjustNativeWindowSize(float width, float height); 385 bool IsSupportImageAnalyzerFeature(); 386 void UpdateAnalyzerUIConfig(const RefPtr<NG::GeometryNode>& geometryNode); 387 void RegisterTransformHintCallback(PipelineContext* context); 388 389 std::optional<std::string> id_; 390 std::string nodeId_ = "-1"; 391 XComponentType type_; 392 bool hasGotSurfaceHolder_ = false; 393 bool hasGotNativeXComponent_ = false; 394 bool isNativeXComponentDisabled_ = false; 395 bool isCNode_ = false; 396 bool useNodeHandleAccessibilityProvider_ = false; 397 RefPtr<RenderSurface> renderSurface_; 398 OffsetF localPosition_; 399 OffsetF surfaceOffset_; 400 SizeF drawSize_; 401 SizeF surfaceSize_; 402 RectF paintRect_; 403 void* nativeWindow_ = nullptr; 404 bool hasReleasedSurface_ = false; 405 RefPtr<RenderContext> renderContextForSurface_; 406 std::optional<int32_t> transformHintChangedCallbackId_; 407 std::string surfaceId_; 408 bool isOnTree_ = false; 409 float hdrBrightness_ = 1.0f; 410 bool isTransparentLayer_ = false; 411 bool isEnableSecure_ = false; 412 bool isSurfaceLock_ = false; 413 RenderFit renderFit_ = RenderFit::RESIZE_FILL; 414 RefPtr<UIXComponentDisplaySync> displaySync_ = AceType::MakeRefPtr<UIXComponentDisplaySync>(); 415 bool needRecoverDisplaySync_ = false; 416 std::shared_ptr<AccessibilityChildTreeCallback> accessibilityChildTreeCallback_; 417 ArkUI_AccessibilityProvider* arkuiAccessibilityProvider_ = nullptr; 418 bool isNeedSoftKeyboard_ = false; 419 420 private: 421 void OnAreaChangedInner() override; DumpSimplifyInfo(std::shared_ptr<JsonValue> & json)422 void DumpSimplifyInfo(std::shared_ptr<JsonValue>& json) override {} 423 void DumpInfo(std::unique_ptr<JsonValue>& json) override; 424 void DumpAdvanceInfo() override; 425 void DumpAdvanceInfo(std::unique_ptr<JsonValue>& json) override; 426 void OnAttachContext(PipelineContext *context) override; 427 void OnDetachContext(PipelineContext *context) override; 428 void ToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const override; 429 430 void NativeXComponentOffset(double x, double y); 431 432 void LoadNative(); 433 void OnNativeLoad(FrameNode* frameNode); 434 void OnNativeUnload(FrameNode* frameNode); 435 436 void OnSurfaceCreated(); 437 void OnSurfaceChanged(const RectF& surfaceRect, bool needResizeNativeWindow); 438 439 void NativeSurfaceShow(); 440 void NativeSurfaceHide(); 441 442 void Initialize(); 443 void InitController(); 444 void InitSurface(); 445 void InitNativeNodeCallbacks(); 446 void InitEvent(); 447 void InitTouchEvent(const RefPtr<GestureEventHub>& gestureHub); 448 void InitOnTouchIntercept(const RefPtr<GestureEventHub>& gestureHub); 449 void InitAxisEvent(const RefPtr<InputEventHub>& inputHub); 450 void HandleTouchEvent(const TouchEventInfo& info); 451 void InitMouseEvent(const RefPtr<InputEventHub>& inputHub); 452 void HandleMouseEvent(const MouseInfo& info); 453 void HandleAxisEvent(const AxisInfo& info); 454 void InitMouseHoverEvent(const RefPtr<InputEventHub>& inputHub); 455 void HandleMouseHoverEvent(bool isHover); 456 void InitFocusEvent(const RefPtr<FocusHub>& focusHub); 457 void HandleFocusEvent(); 458 bool HandleKeyEvent(const KeyEvent& event); 459 void HandleBlurEvent(); 460 ExternalEvent CreateExternalEvent(); 461 462 void SetTouchPoint( 463 const std::list<TouchLocationInfo>& touchInfoList, int64_t timeStamp, const TouchType& touchType); 464 void HandleSetExpectedRateRangeEvent(); 465 void HandleOnFrameEvent(); 466 void HandleUnregisterOnFrameEvent(); 467 bool ExportTextureAvailable(); 468 bool DoTextureExport(); 469 bool StopTextureExport(); 470 void InitializeRenderContext(); 471 void SetSurfaceNodeToGraphic(); 472 void CreateAnalyzerOverlay(); 473 void DestroyAnalyzerOverlay(); 474 void UpdateAnalyzerOverlay(); 475 void ReleaseImageAnalyzer(); 476 void SetRotation(uint32_t rotation); 477 void RegisterSurfaceCallbackModeEvent(); 478 void RegisterSurfaceRenderContext(); 479 void UnregisterSurfaceRenderContext(); 480 std::shared_ptr<Rosen::RSUIContext> GetRSUIContext(const RefPtr<FrameNode>& frameNode); 481 void RegisterNode(); 482 void UnregisterNode(); 483 484 void InitSurfaceMultiThread(const RefPtr<FrameNode>& host); 485 void InitControllerMultiThread(); 486 void OnAttachToMainTreeMultiThread(const RefPtr<FrameNode>& host); 487 void RegisterContextEventMultiThread(const RefPtr<FrameNode>& host); 488 void OnDetachFromMainTreeMultiThread(const RefPtr<FrameNode>& host); 489 void OnDetachFromFrameNodeMultiThread(FrameNode* frameNode); 490 491 #ifdef RENDER_EXTRACT_SUPPORTED 492 RenderSurface::RenderSurfaceType CovertToRenderSurfaceType(const XComponentType& hostType); 493 void RegisterRenderContextCallBack(); 494 void RequestFocus(); 495 #endif 496 497 std::vector<OH_NativeXComponent_HistoricalPoint> SetHistoryPoint(const std::list<TouchLocationInfo>& touchInfoList); 498 std::optional<std::string> libraryname_; 499 std::shared_ptr<InnerXComponentController> xcomponentController_; 500 std::optional<std::string> soPath_; 501 std::optional<uint64_t> screenId_; 502 503 RefPtr<RenderContext> handlingSurfaceRenderContext_; 504 WeakPtr<XComponentPattern> extPattern_; 505 506 std::shared_ptr<OH_NativeXComponent> nativeXComponent_; 507 RefPtr<NativeXComponentImpl> nativeXComponentImpl_; 508 509 bool hasXComponentInit_ = false; 510 511 RefPtr<TouchEventImpl> touchEvent_; 512 OH_NativeXComponent_TouchEvent touchEventPoint_ = {}; 513 RefPtr<InputEvent> mouseEvent_; 514 RefPtr<InputEvent> axisEvent_; 515 RefPtr<InputEvent> mouseHoverEvent_; 516 std::vector<XComponentTouchPoint> nativeXComponentTouchPoints_; 517 RefPtr<XComponentExtSurfaceCallbackClient> extSurfaceClient_; 518 SizeF initSize_; 519 OffsetF globalPosition_; 520 521 std::optional<float> selfIdealSurfaceWidth_; 522 std::optional<float> selfIdealSurfaceHeight_; 523 std::optional<float> selfIdealSurfaceOffsetX_; 524 std::optional<float> selfIdealSurfaceOffsetY_; 525 526 uint32_t windowId_ = 0; 527 int32_t treeId_ = 0; 528 RefPtr<XComponentAccessibilityProvider> accessibilityProvider_; 529 RefPtr<AccessibilitySessionAdapter> accessibilitySessionAdapter_; 530 531 // for export texture 532 NodeRenderType renderType_ = NodeRenderType::RENDER_TYPE_DISPLAY; 533 uint64_t exportTextureSurfaceId_ = 0U; 534 std::shared_ptr<ImageAnalyzerManager> imageAnalyzerManager_; 535 bool isEnableAnalyzer_ = false; 536 uint32_t rotation_ = 0; 537 bool isTypedNode_ = false; 538 bool isNativeXComponent_ = false; 539 bool hasLoadNativeDone_ = false; 540 SurfaceCallbackMode surfaceCallbackMode_ = SurfaceCallbackMode::DEFAULT; 541 std::function<void(SurfaceCallbackMode)> surfaceCallbackModeChangeEvent_; 542 // record displaySync_->DelFromPipelineOnContainer() from OnDetachFromMainTree 543 bool isNativeImageAnalyzing_ = false; 544 WeakPtr<PipelineContext> initialContext_ = nullptr; 545 // record the initial surfaceId_ in InitSurface, this variable should not be modified after the initial assignment 546 std::string initialSurfaceId_; 547 }; 548 } // namespace OHOS::Ace::NG 549 550 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_XCOMPONENT_XCOMPONENT_PATTERN_H 551