1 /* 2 * Copyright (c) 2021-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 /** 17 * @file rs_interfaces.h 18 * @brief API provided by the RS for internal components. 19 */ 20 21 #ifndef RENDER_SERVICE_CLIENT_CORE_TRANSACTION_RS_INTERFACES_H 22 #define RENDER_SERVICE_CLIENT_CORE_TRANSACTION_RS_INTERFACES_H 23 24 #include <memory> 25 #include <mutex> 26 27 #include "memory/rs_memory_graphic.h" 28 #include "transaction/rs_render_service_client.h" 29 #include "ui/rs_display_node.h" 30 #include "ui/rs_surface_node.h" 31 #include "ipc_callbacks/rs_iocclusion_change_callback.h" 32 33 namespace OHOS { 34 namespace Rosen { 35 36 class RSC_EXPORT RSInterfaces { 37 public: 38 static RSInterfaces &GetInstance(); 39 RSInterfaces(const RSInterfaces &) = delete; 40 void operator=(const RSInterfaces &) = delete; 41 42 /** 43 * @brief Set the focus window information to renderService. 44 * @param info Focus window information, Please refer to the definition for the specific content included. 45 * @return 0 means success, others failed. 46 */ 47 int32_t SetFocusAppInfo(const FocusAppInfo& info); 48 49 /** 50 * @brief Get the id of default screen. 51 * @return Default screen id. 52 */ 53 ScreenId GetDefaultScreenId(); 54 55 /** 56 * @brief Get the id of current screen, for bootAnimation only. 57 * @return current screen id. 58 */ 59 ScreenId GetActiveScreenId(); 60 61 /** 62 * @brief Get the id of all screen. 63 * @return A vector of screen id. 64 */ 65 std::vector<ScreenId> GetAllScreenIds(); 66 67 #ifndef ROSEN_CROSS_PLATFORM 68 /** 69 * @brief Create virtual screen with params. 70 * @param name Virtual screen name. 71 * @param width Virtual screen width, max: MAX_VIRTUAL_SCREEN_WIDTH. 72 * @param height Virtual screen height, max: MAX_VIRTUAL_SCREEN_HEIGHT. 73 * @param surface Virtual screen surface, if not nullptr, vote for 60Hz. 74 * @param mirrorId Decide which screen id to mirror, INVALID_SCREEN_ID means do not mirror any screen. 75 * @param flags Virtual screen security layer option, 0: screen level, 1: window level. 76 * @param whiteList List of surface node id, only these nodes can be drawn on this screen. 77 * @return Virtual screen id, INVALID_SCREEN_ID means failed. 78 */ 79 ScreenId CreateVirtualScreen( 80 const std::string &name, 81 uint32_t width, 82 uint32_t height, 83 sptr<Surface> surface, 84 ScreenId mirrorId = 0, 85 int flags = 0, 86 std::vector<NodeId> whiteList = {}); 87 88 /** 89 * @brief Set list of surface node id, these nodes will be excluded from this screen. 90 * @param id Valid screen id: set screen record black list; INVALID_SCREEN_ID: set screen cast black list. 91 * @param blackListVector List of surface node id. If the screen id is INVALID_SCREEN_ID, the blackListVector will 92 * apply to all virtual screens. 93 * @return 0 means success. 94 */ 95 int32_t SetVirtualScreenBlackList(ScreenId id, std::vector<NodeId>& blackListVector); 96 97 /** 98 * @brief Use nodeType to Set blackList for mirror screen. 99 * @param id Screen id. 100 * @param typeBlackListVector Vector of NodeType. 101 * @return 0 means success, others failed. 102 */ 103 int32_t SetVirtualScreenTypeBlackList(ScreenId id, std::vector<NodeType>& typeBlackListVector); 104 105 /** 106 * @brief Add list of surfaceNodeId excluded on virtual screen. 107 * @param id Screen id. 108 * @param blackListVector Vector of surfaceNodeId excluded on virtual screen. 109 * @return 0 means success, others failed. 110 */ 111 int32_t AddVirtualScreenBlackList(ScreenId id, std::vector<NodeId>& blackListVector); 112 113 /** 114 * @brief Remove list of surfaceNodeId excluded on virtual screen. 115 * @param id screen id. 116 * @param blackListVector Vector of surfaceNodeId excluded on virtual screen. 117 * @return 0 means success, others failed. 118 */ 119 int32_t RemoveVirtualScreenBlackList(ScreenId id, std::vector<NodeId>& blackListVector); 120 121 /** 122 * @brief Set security layer exemption list for mirror screen. 123 * @param id screen id. 124 * @param securityExemptionList exemption list for security layer. 125 * @return 0 means success, others failed. 126 */ 127 int32_t SetVirtualScreenSecurityExemptionList(ScreenId id, const std::vector<NodeId>& securityExemptionList); 128 129 /** 130 * @brief Set mask image displayed on virtual mirror screen when security layer is present. 131 * @param id Virtual screen id. 132 * @param securityMask Mask image to be set, nullptr means no mask. 133 * @return 0 means success. 134 */ 135 int32_t SetScreenSecurityMask(ScreenId id, std::shared_ptr<Media::PixelMap> securityMask); 136 137 /** 138 * @brief Set Visible Rect for mirror screen. 139 * @param id Virtual screen id. 140 * @param mainScreenRect visible rect. 141 * @param supportRotation if the value is true, rotation is supported. Otherwise, rotation is not supported. 142 * @return 0 means success, others failed. 143 */ 144 int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation = false); 145 146 /** 147 * @brief Set if cast screen black list is enabled, surface node in black list will not be drawn. 148 * @param id Virtual screen id. 149 * @param enable True means enable, false means disable. 150 * @return 0 means success, others failed. 151 */ 152 int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable); 153 154 /** 155 * @brief Set producer surface for virtual screen. 156 * @param id Virtual screen id. 157 * @param surface Producer surface. 158 * @return 0 means success, others failed. 159 */ 160 int32_t SetVirtualScreenSurface(ScreenId id, sptr<Surface> surface); 161 #endif 162 163 /** 164 * @brief Remove virtual screen. 165 * @param id Virtual screen id. 166 */ 167 void RemoveVirtualScreen(ScreenId id); 168 169 #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR 170 /** 171 * @brief Sets the parameters for inverting the color of the variable cursor. 172 * @param darkBuffer Dark buffer area. 173 * @param brightBuffer Bright color buffer area Enable cast black list for virtual screen or not. 174 * @param interval Cursor color obtaining interval. 175 * @return 0 means success, others failed. 176 */ 177 int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, int64_t interval, int32_t rangeSize); 178 179 /** 180 * @brief Indicates whether to enable color inversion of the variable cursor or not. 181 * @param enable enable color inversion of the variable cursor or not. 182 * @return 0 means success, others failed. 183 */ 184 int32_t SetPointerColorInversionEnabled(bool enable); 185 186 /** 187 * @brief Register the callback for changing the color of the cursor. 188 * @param callback callback for changing the color of the cursor. 189 * @return 0 means success, others failed. 190 */ 191 int32_t RegisterPointerLuminanceChangeCallback(const PointerLuminanceChangeCallback &callback); 192 193 /** 194 * @brief UnRegister the callback for changing the color of the cursor. 195 * @return 0 means success, others failed. 196 */ 197 int32_t UnRegisterPointerLuminanceChangeCallback(); 198 #endif 199 200 /** 201 * @brief Set screen connection status change callback. 202 * on the screen connection status is changed. 203 * @param callback Callback of the screen connection status changed. 204 * @return Returns int32_t, return value == 0 success, otherwise, failed. 205 */ 206 int32_t SetScreenChangeCallback(const ScreenChangeCallback &callback); 207 208 /** 209 * @brief Set screen switching status notify callback. 210 * on the screen switching status is changed. 211 * @param callback Callback of the screen switching status changed. 212 * @return Returns int32_t, return value == 0 success, otherwise, failed. 213 */ 214 int32_t SetScreenSwitchingNotifyCallback(const ScreenSwitchingNotifyCallback &callback); 215 216 /** 217 * @brief Set watermark for surfaceNode. 218 * @param name Watermark name. 219 * @param watermark Watermark pixelmap. 220 * @return set watermark success return true, else return false. 221 */ 222 bool SetWatermark(const std::string& name, std::shared_ptr<Media::PixelMap> watermark); 223 224 /** 225 * @brief Get pixelmaps generated by this selfDrawingNodes in the process. 226 * @param pixelMapInfoVector is a vector of PixelMapInfo. 227 * @param pid Indicates id of process. 228 * @return return value == 0 success, otherwise, failed. 229 */ 230 int32_t GetPixelMapByProcessId(std::vector<PixelMapInfo>& pixelMapInfoVector, pid_t pid); 231 232 /** 233 * @brief Get snapshot of surfaceNode. 234 * @param node Indicates which node, usually point to a window. 235 * @param callback When the snapshot is complete, the callback will be triggered. 236 * @param captureConfig Indicates the configuration items required for snapshot. 237 * @return return true if snaphot success, else return false. 238 */ 239 bool TakeSurfaceCapture(std::shared_ptr<RSSurfaceNode> node, std::shared_ptr<SurfaceCaptureCallback> callback, 240 RSSurfaceCaptureConfig captureConfig = {}); 241 242 /** 243 * @brief Get snapshot of surfaceNode, and security layer area is a drawn as a blur instead of white. 244 * @param node Indicates which node, usually point o a window. 245 * @param callback When the snapshot is complete, the callback will be triggered. 246 * @param blurRadius Indicates blur radius of blur area. 247 * @return return true if snaphot success, else return false. 248 */ 249 bool TakeSurfaceCaptureWithBlur(std::shared_ptr<RSSurfaceNode> node, 250 std::shared_ptr<SurfaceCaptureCallback> callback, RSSurfaceCaptureConfig captureConfig = {}, 251 float blurRadius = 1E-6); 252 253 /** 254 * @brief Take display node capture. 255 * @param node Display node. 256 * @param callback Callback to be called when capture is done. 257 * @param captureConfig Capture config, see RSSurfaceCaptureConfig. 258 * @return True if capture task is successfully created, false if failed. 259 */ 260 bool TakeSurfaceCapture(std::shared_ptr<RSDisplayNode> node, std::shared_ptr<SurfaceCaptureCallback> callback, 261 RSSurfaceCaptureConfig captureConfig = {}); 262 263 /** 264 * @brief Get snapshot of surfaceNode or displayNode by NodeId. 265 * @param id The id of surfaceNode or displayNode. 266 * @param callback When the snapshot is complete, the callback will be triggered. 267 * @param captureConfig Indicates the configuration items required for snapshot. 268 * @return return true if snaphot success, else return false. 269 */ 270 bool TakeSurfaceCapture(NodeId id, std::shared_ptr<SurfaceCaptureCallback> callback, 271 RSSurfaceCaptureConfig captureConfig = {}); 272 273 /** 274 * @brief Get component snapshot. 275 * @param node can be rootNode、surfaceNode、canvasNode、CanvasDrawingNode. 276 * @param callback When the snapshot is complete, the callback will be triggered. 277 * @param scaleX Indicates the scale of X-axis. 278 * @param scaleY Indicates the scale of Y-axis. 279 * @param isSync Indicates Whether wait until render is finished. 280 * @param specifiedAreaRect Indicates the range that user wants to clip the snapshot. 281 * @return return true if snaphot success, else return false. 282 */ 283 bool TakeSurfaceCaptureForUI(std::shared_ptr<RSNode> node, 284 std::shared_ptr<SurfaceCaptureCallback> callback, float scaleX = 1.f, float scaleY = 1.f, 285 bool isSync = false, const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f)); 286 287 /** 288 * @brief Get a list of pixelmap information, each node of the component node tree will have a pixelmap. 289 * @param node can be rootNode、surfaceNode、canvasNode、CanvasDrawingNode. 290 * @return return a vector of pair, the first element is the NodeId, the second element is the pixelmap. 291 */ 292 std::vector<std::pair<NodeId, std::shared_ptr<Media::PixelMap>>> 293 TakeSurfaceCaptureSoloNodeList(std::shared_ptr<RSNode> node); 294 295 /** 296 * @brief Get snapshot of surfaceNode, and security layer area is a drawn normally, not white. 297 * @param node Indicates which node, usually point to a window. 298 * @param callback When the snapshot is complete, the callback will be triggered. 299 * @param captureConfig Indicates the configuration items required for snapshot. 300 * @return return true if snaphot success, else return false. 301 */ 302 bool TakeSelfSurfaceCapture(std::shared_ptr<RSSurfaceNode> node, std::shared_ptr<SurfaceCaptureCallback> callback, 303 RSSurfaceCaptureConfig captureConfig = {}); 304 305 /** 306 * @brief Get snapshot of surfaceNode, and show the snapshot instead of surfaceNode. 307 * @param node Indicates which node, usually point to a window. 308 * @param isFreeze Indicates freeze or unfreeze this surfaceNode. 309 * @param callback When the snapshot is complete, the callback will be triggered. 310 * @param captureConfig Indicates the configuration items required for snapshot. 311 * @param blurRadius Indicates blur radius of blur area. 312 * @return return true if snaphot success, else return false. 313 */ 314 bool SetWindowFreezeImmediately(std::shared_ptr<RSSurfaceNode> node, bool isFreeze, 315 std::shared_ptr<SurfaceCaptureCallback> callback, RSSurfaceCaptureConfig captureConfig = {}, 316 float blurRadius = 1E-6); 317 318 /** 319 * @brief Take snapshot of displayNode. 320 * @param node Indicates a display node to be captured. 321 * @param callback Indicates callback to be triggered when snapshot is compeleted. 322 * @param captureConfig Indicates the configrutation items required for snapshot. 323 * @param checkDrmAndSurfaceLock Indicates the flag to check existing drm or surface lock window. 324 * @return return true if snaphot success, else return false. 325 */ 326 bool TaskSurfaceCaptureWithAllWindows(std::shared_ptr<RSDisplayNode> node, 327 std::shared_ptr<SurfaceCaptureCallback> callback, RSSurfaceCaptureConfig captureConfig, 328 bool checkDrmAndSurfaceLock); 329 330 /** 331 * @brief Freeze or unfreeze screen. 332 * @param node Indicates a display node to freeze or unfreeze. 333 * @param isFreeze Indicates freeze or unfreeze the specified display node. 334 * @return return true if freeze or unfreeze success, else return false. 335 */ 336 bool FreezeScreen(std::shared_ptr<RSDisplayNode> node, bool isFreeze); 337 338 /** 339 * @brief Get component snapshot Within the given node range. 340 * @param beginNode Indicates first child of snapshot. 341 * @param endNode Indicates end child of snapshot. 342 * @param useBeginNodeSize Indicates Whether use the size of begin node. 343 * @param callback When the snapshot is complete, the callback will be triggered. 344 * @param scaleX Indicates the scale of X-axis. 345 * @param scaleY Indicates the scale of Y-axis. 346 * @param isSync Indicates Whether wait until render is finished. 347 * @return return true if snaphot success, else return false. 348 */ 349 bool TakeUICaptureInRange(std::shared_ptr<RSNode> beginNode, std::shared_ptr<RSNode> endNode, bool useBeginNodeSize, 350 std::shared_ptr<SurfaceCaptureCallback> callback, float scaleX, float scaleY, bool isSync); 351 352 /** 353 * @brief Simplify the original interfaces set boundaries for cursor movemonet and reduce the workload. 354 * @param rsNodeId Indicates id of node. 355 * @param positionX Indicates x coordinate position. 356 * @param positionY Indicates Y coordinate position. 357 * @param positionZ Indicates z coordinate position. 358 * @param positionW Indicates w coordinate position. 359 * @return return true if set success, else return false. 360 */ 361 bool SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, float positionZ, float positionW); 362 363 /** 364 * @brief Register typeface. 365 * @param typeface font's typeface. 366 * @return return true if register success, else return false. 367 */ 368 bool RegisterTypeface(std::shared_ptr<Drawing::Typeface>& typeface); 369 370 /** 371 * @brief UnRegister typeface. 372 * @param typeface font's typeface. 373 * @return return true if unRegister success, else return false. 374 */ 375 bool UnRegisterTypeface(std::shared_ptr<Drawing::Typeface>& typeface); 376 #ifndef ROSEN_ARKUI_X 377 /** 378 * @brief Set active mode of the screen(The combination of resolution and refresh rate is a mode. 379 * the display calls back the mode set by the user and then set is to RS.) 380 * @param id id of screen. 381 * @param modeId the id of the active mode to set to the screen. 382 */ 383 void SetScreenActiveMode(ScreenId id, uint32_t modeId); 384 385 /** 386 * @brief Statistics of application GPU memory. 387 * @param pid Indicates id of process. 388 * @return MemoryGraphic, include the application memory info. 389 */ 390 MemoryGraphic GetMemoryGraphic(int pid); 391 392 /** 393 * @brief Statistics of all application GPU memory. 394 * @return a vector of MemoryGraphic, include all application GPU memory. 395 */ 396 std::vector<MemoryGraphic> GetMemoryGraphics(); 397 #endif // !ROSEN_ARKUI_X 398 /** 399 * @brief Get total App memory size. 400 * @param cpuMemSize cpu size of Total App. 401 * @param gpuMemSize gpu size of Total App. 402 * @return return true if get success. 403 */ 404 bool GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize); 405 406 #ifndef ROSEN_ARKUI_X 407 /** 408 * @brief Set render resolution of physical screen. 409 * @param id Id of the physical screen. 410 * @param width Width to set, and should be greater than physical width. 411 * @param height Height to set, and should be greater than physical height. 412 * @return StatusCode. Returns value, return value == 0 success, otherwise, failed. 413 */ 414 int32_t SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height); 415 416 /** 417 * @brief Set virtual screen resolution. 418 * @param id Virtual screen id. 419 * @param width Virtual screen width, max: MAX_VIRTUAL_SCREEN_WIDTH. 420 * @param height Virtual screen height, max: MAX_VIRTUAL_SCREEN_HEIGHT. 421 * @return 0 means success, others failed. 422 */ 423 int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height); 424 #endif // !ROSEN_ARKUI_X 425 426 /** 427 * @brief Set if auto rotation is enabled for virtual mirror screen, keep content always horizontal. 428 * @param id Virtual screen id. 429 * @param canvasRotation True means enable, false means disable. 430 * @return True if success, false if failed. 431 */ 432 bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation); 433 434 /** 435 * @brief Set if resize buffer and keep content horizontal while source is rotated. 436 * @param id Virtual screen id. 437 * @param isAutoRotation True means enable, false means disable. 438 * @return 0 means success, others failed. 439 */ 440 int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation); 441 442 /** 443 * @brief Set scale mode for virtual mirror screen. 444 * @param id Virtual screen id. 445 * @param scaleMode Scale mode, see ScreenScaleMode. 446 * @return True if success, false if failed. 447 */ 448 bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode); 449 450 // WMS set dark color display mode to RS 451 /** 452 * @brief Notify if system themes switch to dark mode. 453 * @param isDark whether is dark mode. 454 * @return True if success, false if failed. 455 */ 456 bool SetGlobalDarkColorMode(bool isDark); 457 #ifndef ROSEN_ARKUI_X 458 /** 459 * @brief Get virtual screen resolution. 460 * @param id Virtual screen id. 461 * @return Virtual screen resolution, see RSVirtualScreenResolution. 462 */ 463 RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id); 464 465 /** 466 * @brief RenderService will cease rendering when screen power is off. If necessary 467 * call this to refresh one moreframe. 468 */ 469 void MarkPowerOffNeedProcessOneFrame(); 470 471 /** 472 * @brief Call this to force refresh one more frame. 473 */ 474 void RepaintEverything(); 475 476 /** 477 * @brief RenderService will cease rendering when screen power is off. If necessary, call this disable such control 478 * in virtual screen cases. 479 */ 480 void DisablePowerOffRenderControl(ScreenId id); 481 482 /** 483 * @brief Set power of the screen. 484 * @param id Id of the screen to set power status. 485 * @param status The status to set to the screen. 486 */ 487 void SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status); 488 489 /** 490 * @brief Get active mode of the screen. 491 * @param id Id of the screen to get active mode. 492 * @return RSScreenModeInfo including the screen width, height, and refresh rates. 493 */ 494 RSScreenModeInfo GetScreenActiveMode(ScreenId id); 495 #endif // !ROSEN_ARKUI_X 496 497 /** 498 * @brief Set screen's RefreshRate. 499 * @param id Id of the screen. 500 * @param sceneId Id of the scene. 501 * @param rate refresh rate. 502 */ 503 void SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate); 504 505 /** 506 * @brief Set refresh mode. 507 * @param refreshRateMode refresh rate mode. 508 */ 509 void SetRefreshRateMode(int32_t refreshRateMode); 510 511 /** 512 * @brief Synchronize LTPO Expected RateRange. 513 * @param id Frame Rate Linker Id. 514 * @param range frame rate range. 515 * @param animatorExpectedFrameRate animator expected frame rate. 516 */ 517 void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, int32_t animatorExpectedFrameRate); 518 519 /** 520 * @brief Get screen current refresh rate. 521 * @param id id of screen. 522 * @return if success, return rate != 0, else return 0. 523 */ 524 uint32_t GetScreenCurrentRefreshRate(ScreenId id); 525 526 /** 527 * @brief Get screen current refresh mode. 528 * @return customFrameRate mode. 529 */ 530 int32_t GetCurrentRefreshRateMode(); 531 532 /** 533 * @brief Get screen supported refresh rate. 534 * @param id id of screen. 535 * @return Return supported refresh rate. 536 */ 537 std::vector<int32_t> GetScreenSupportedRefreshRates(ScreenId id); 538 539 /** 540 * @brief Get show refresh rate enabled. 541 * @return Return true, if get success. 542 */ 543 bool GetShowRefreshRateEnabled(); 544 545 /** 546 * @brief Set show refresh rate enabled. 547 * @param enabled 548 * @param type 549 */ 550 void SetShowRefreshRateEnabled(bool enabled, int32_t type = 1); 551 552 /** 553 * @brief Get realtime refresh rate by screen id. 554 * @param id id of screenled. 555 * @return Return realtime refresh rate. 556 */ 557 uint32_t GetRealtimeRefreshRate(ScreenId id); 558 559 /** 560 * @brief Get fps string by pid. 561 * @param pid indicates id of process. 562 * @return Return fps string if success. 563 */ 564 std::string GetRefreshInfo(pid_t pid); 565 std::string GetRefreshInfoToSP(NodeId id); 566 567 #ifndef ROSEN_ARKUI_X 568 /** 569 * @brief Get active mode of the screen. 570 * @param id Id of the screen to get supported modes. 571 * @return A list of RSScreenModeInfo. 572 */ 573 std::vector<RSScreenModeInfo> GetScreenSupportedModes(ScreenId id); 574 575 /** 576 * @brief Get capability of screen. 577 * @param id id of the screen. 578 * @return RSScreenCapability. 579 */ 580 RSScreenCapability GetScreenCapability(ScreenId id); 581 582 /** 583 * @brief Get power status of the screen. 584 * @param id id of the screen. 585 * @return ScreenPowerStatus. 586 */ 587 ScreenPowerStatus GetScreenPowerStatus(ScreenId id); 588 589 /** 590 * @brief Get date of screen. 591 * @param id id of the screen. 592 * @return RSScreenData. 593 */ 594 RSScreenData GetScreenData(ScreenId id); 595 #endif // !ROSEN_ARKUI_X 596 /** 597 * @brief Get blacklight values of the screen. 598 * @param id id of the screen. 599 * @return blacklight values. 600 */ 601 int32_t GetScreenBacklight(ScreenId id); 602 603 /** 604 * @brief Set backlight value of the screen. 605 * @param id Id of the screen to set its backlight value. 606 * @param level The value of backlight. 607 */ 608 void SetScreenBacklight(ScreenId id, uint32_t level); 609 610 int32_t GetScreenSupportedColorGamuts(ScreenId id, std::vector<ScreenColorGamut>& mode); 611 612 /** 613 * @brief Get the screen supported mock metaDataKeys. 614 * @param id Id of the screen. 615 * @param keys Output parameters, The screen supported mock metaDataKeys will insert to keys. 616 * @return 0 success, others failed. 617 */ 618 int32_t GetScreenSupportedMetaDataKeys(ScreenId id, std::vector<ScreenHDRMetadataKey>& keys); 619 620 /** 621 * @brief Get the screen supported mock metaDataKeys. 622 * @param id Id of the screen. 623 * @param keys Output parameters, The screen supported mock metaDataKeys will insert to keys. 624 * @return 0 success, others failed. 625 */ 626 int32_t GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode); 627 628 int32_t SetScreenColorGamut(ScreenId id, int32_t modeIdx); 629 630 /** 631 * @brief Set screen's gamut map mode. 632 * @param id Id of the screen. 633 * @param mode Gamut map mode to set for the screen. 634 * @return 0 success, others failed. 635 */ 636 int32_t SetScreenGamutMap(ScreenId id, ScreenGamutMap mode); 637 638 /** 639 * @brief Set screen correction, used to correct screen rotation. 640 * @param id Screen id. 641 * @param screenRotation Screen correction, see ScreenRotation. 642 * @return 0 means success, others failed. 643 */ 644 int32_t SetScreenCorrection(ScreenId id, ScreenRotation screenRotation); 645 646 /** 647 * @brief Get screen's gamut map mode. 648 * @param id Id of the screen. 649 * @param mode Gamut map mode to set for the screen. 650 * @return 0 success, others failed. 651 */ 652 int32_t GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode); 653 654 /** 655 * @brief Get the HDR Capability of the screen. 656 * @param id Id of the screen. 657 * @param screenHdrCapability The HDR Capability of the screen. 658 * @return 0 success, others failed. 659 */ 660 int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability); 661 662 /** 663 * @brief Get the pixel format of the screen. 664 * @param id Id of the screen. 665 * @param pixelFormat The pixel format of the screen. 666 * @return 0 success, others failed. 667 */ 668 int32_t GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat); 669 670 /** 671 * @brief Set the pixel format of the screen. 672 * @param id Id of the screen. 673 * @param pixelFormat This parameters will set to the pixel format of the screen. 674 * @return 0 success, others failed. 675 */ 676 int32_t SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat); 677 678 /** 679 * @brief Get the hardware supported HDR format. 680 * @param id Id of the screen. 681 * @param hdrFormats The hardware supported HDR format will set to this parameter. 682 * @return 0 success, others failed. 683 */ 684 int32_t GetScreenSupportedHDRFormats(ScreenId id, std::vector<ScreenHDRFormat>& hdrFormats); 685 686 /** 687 * @brief Get the HDR format of the current screen. 688 * @param id Id of the screen. 689 * @param hdrFormats The HDR format of the current screen will set to this parameter. 690 * @return 0 success, others failed. 691 */ 692 int32_t GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat); 693 694 /** 695 * @brief Get the HDR status of the current screen. 696 * @param id Id of the screen. 697 * @param hdrStatus The HDR status of the current screen. 698 * @return 0 success, others failed. 699 */ 700 int32_t GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus); 701 702 /** 703 * @brief Set the HDR format of the current screen. 704 * @param id Id of the screen. 705 * @param modeIdx This parameter will set to the currentHDRFormatIdx. 706 * @return 0 success, others failed. 707 */ 708 int32_t SetScreenHDRFormat(ScreenId id, int32_t modeIdx); 709 710 /** 711 * @brief Get the color space supported by the screen. 712 * @param id Id of the screen. 713 * @param colorSpaces Output parameters, records the color space supported by the screen. 714 * @return 0 success, others failed. 715 */ 716 int32_t GetScreenSupportedColorSpaces(ScreenId id, std::vector<GraphicCM_ColorSpaceType>& colorSpaces); 717 718 /** 719 * @brief Get the color space of the screen. 720 * @param id Id of the screen. 721 * @param colorSpace Output parameters, records the color space of the screen. 722 * @return 0 success, others failed. 723 */ 724 int32_t GetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType& colorSpace); 725 726 /** 727 * @brief Set screen's color space. 728 * @param id Id of the screen. 729 * @param colorSpace color space to set for the screen. 730 * @return 0 success, others failed. 731 */ 732 int32_t SetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType colorSpace); 733 734 /** 735 * @brief Get the type of the screen. 736 * @param id Id of the screen. 737 * @param screenType screen type of the screen. 738 * @return 0 success, others failed. 739 */ 740 int32_t GetScreenType(ScreenId id, RSScreenType& screenType); 741 742 int32_t GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector<uint8_t>& edidData); 743 744 /* skipFrameInterval : decide how many frames apart to refresh a frame, 745 DEFAULT_SKIP_FRAME_INTERVAL means refresh each frame, 746 change screen refresh rate finally */ 747 int32_t SetScreenSkipFrameInterval(ScreenId id, uint32_t skipFrameInterval); 748 749 /** 750 * @brief Set virtual screen refresh rate. 751 * @param id Id of the screen. 752 * @param maxRefreshRate Indicates max refresh rate. 753 * @param actualRefreshRate Indicates actual refresh rate. 754 * @return 0 success, others failed. 755 */ 756 int32_t SetVirtualScreenRefreshRate(ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate); 757 758 /** 759 * @brief Set screen active rect, part of screen that can be drawn. 760 * @param id Screen id. 761 * @param activeRect Screen active rect. 762 * @return 0 means success, others failed. 763 */ 764 uint32_t SetScreenActiveRect(ScreenId id, const Rect& activeRect); 765 766 /** 767 * @brief Set screen offset. 768 * @param id Screen id. 769 * @param offSetX The offset value of the screen drawing area on the X-axis. 770 * @param offSetY The offset value of the screen drawing area on the Y-axis. 771 */ 772 void SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY); 773 774 /** 775 * @brief Set frame gravity of screen node 776 * @param id Screen id. 777 * @param gravity The gravity value of the screen node. 778 */ 779 void SetScreenFrameGravity(ScreenId id, int32_t gravity); 780 781 /** 782 * @brief Create a VsyncReceiver instance. 783 * @param name Indicates the name of the VsyncReceiver instance. 784 * @param looper Indicates the pointer of a eventHandle instance. 785 * @param actualRefreshRate Indicates actual refresh rate. 786 * @return return VsyncReceiver instance pointer. 787 */ 788 std::shared_ptr<VSyncReceiver> CreateVSyncReceiver( 789 const std::string& name, 790 const std::shared_ptr<OHOS::AppExecFwk::EventHandler> &looper = nullptr); 791 792 /** 793 * @brief Create a VsyncReceiver instance. 794 * @param name Indicates the name of the VsyncReceiver instance. 795 * @param id Indicates the FrameRateLinker id. 796 * @param looper Indicates the pointer of a eventHandle instance. 797 * @param windowNodeId Indicates the windowNode id. 798 * @param fromXcomponent Indicates whether the source is from xcomponent. 799 * @return return VsyncReceiver instance pointer. 800 */ 801 std::shared_ptr<VSyncReceiver> CreateVSyncReceiver( 802 const std::string& name, 803 uint64_t id, 804 const std::shared_ptr<OHOS::AppExecFwk::EventHandler> &looper = nullptr, 805 NodeId windowNodeId = 0, 806 bool fromXcomponent = false); 807 808 /** 809 * @brief Create a pixelmap obeject from surface id. 810 * @param surfaceId Indicates the id of surface. 811 * @param srcRect Indicates the area that requires a rectangle. 812 * @return return a pixelmap obeject. 813 */ 814 std::shared_ptr<Media::PixelMap> CreatePixelMapFromSurfaceId(uint64_t surfaceId, const Rect &srcRect); 815 816 /** 817 * @brief Register window occlusion change callback. 818 * @param callback callback fuction. 819 * @return 0 success, else failed. 820 */ 821 int32_t RegisterOcclusionChangeCallback(const OcclusionChangeCallback& callback); 822 823 /** 824 * @brief Register web surface occlusion change callback. 825 * @param callback callback fuction. 826 * @param partitionPoints is a vector of area ratio. 827 * @return 0 success, else failed. 828 */ 829 int32_t RegisterSurfaceOcclusionChangeCallback( 830 NodeId id, const SurfaceOcclusionChangeCallback& callback, std::vector<float>& partitionPoints); 831 832 /** 833 * @brief UnRegister web surface occlusion change callback. 834 * @param id is the node id indicates which surface occlusion change callback needs to be unRegister. 835 * @return 0 success, else failed. 836 */ 837 int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id); 838 839 /** 840 * @brief Register HgmConfigChangeCallback. 841 * @param callback callback fuction. 842 * @return Register result, 0 success, else failed. 843 */ 844 int32_t RegisterHgmConfigChangeCallback(const HgmConfigChangeCallback& callback); 845 846 /** 847 * @brief Register HgmRefreshRateModeChangeCallback. 848 * @param callback callback fuction. 849 * @return Register result, 0 success, else failed. 850 */ 851 int32_t RegisterHgmRefreshRateModeChangeCallback(const HgmRefreshRateModeChangeCallback& callback); 852 853 /** 854 * @brief Register HgmRefreshRateUpdateCallback. 855 * @param callback callback fuction. 856 * @return Register result, 0 success, else failed. 857 */ 858 int32_t RegisterHgmRefreshRateUpdateCallback(const HgmRefreshRateUpdateCallback& callback); 859 860 /** 861 * @brief UnRegister HgmRefreshRateUpdateCallback. 862 * @return UnRegister result, 0 success, else failed. 863 */ 864 int32_t UnRegisterHgmRefreshRateUpdateCallback(); 865 866 /** 867 * @brief Register the first frame commit callback function. 868 * @param callback Indicates functions that need to be registered. 869 * @return Register result, 0 success, else failed. 870 */ 871 int32_t RegisterFirstFrameCommitCallback(const FirstFrameCommitCallback& callback); 872 873 /** 874 * @brief UnRegister the first frame commit callback function. 875 * @param callback Indicates functions that need to be Unregistered. 876 * @return UnRegister result, 0 success, else failed. 877 */ 878 int32_t UnRegisterFirstFrameCommitCallback(); 879 880 /** 881 * @brief Register FrameRateLinkerExpectedFpsUpdateCallback. 882 * @param callback Indicates functions that need to be registered. 883 * @return Register result, 0 success, else failed. 884 */ 885 int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, 886 const FrameRateLinkerExpectedFpsUpdateCallback& callback); 887 888 /** 889 * @brief UnRegister FrameRateLinkerExpectedFpsUpdateCallback. 890 * @param callback Indicates functions that need to be Unregistered. 891 * @return UnRegister result, 0 success, else failed. 892 */ 893 int32_t UnRegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid); 894 895 /** 896 * @brief Set appWindow number. 897 * @param num winodw number. 898 */ 899 void SetAppWindowNum(uint32_t num); 900 901 /* 902 * @brief Set the system overload Animated Scenes to RS for special load shedding. 903 * @param systemAnimatedScenes indicates the system animation scene. 904 * @param isRegularAnimation indicates irregular windows in the animation scene. 905 * @return true if succeed, otherwise false. 906 */ 907 bool SetSystemAnimatedScenes(SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation = false); 908 909 /** 910 * @brief Set display safe watermark. 911 * @param watermarkImg is an image displaying a water image. 912 * @param isShow is a flag that enable/disables watermark display. 913 */ 914 void ShowWatermark(const std::shared_ptr<Media::PixelMap> &watermarkImg, bool isShow); 915 916 /** 917 * @brief Resize virtual screen. 918 * @param id Virtual screen id. 919 * @param width Virtual screen width, max: MAX_VIRTUAL_SCREEN_WIDTH. 920 * @param height Virtual screen height, max: MAX_VIRTUAL_SCREEN_HEIGHT. 921 * @return 0 means success, others failed. 922 */ 923 int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height); 924 925 /** 926 * @brief Report jank statistics of render service. 927 */ 928 void ReportJankStats(); 929 930 void NotifyLightFactorStatus(int32_t lightFactorStatus); 931 932 /** 933 * @brief Notify package event list. 934 * @param listSize the size of list. 935 * @param packageList the list of package. 936 */ 937 void NotifyPackageEvent(uint32_t listSize, const std::vector<std::string>& packageList); 938 939 /** 940 * @brief Notify app strategy config change event. 941 * @param pkgName the name of package. 942 * @param listSize the size of list. 943 * @param newConfig new config. 944 */ 945 void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, 946 const std::vector<std::pair<std::string, std::string>>& newConfig); 947 948 /** 949 * @brief Notify Refresh rate event. 950 * @param eventInfo the information of event. 951 */ 952 void NotifyRefreshRateEvent(const EventInfo& eventInfo); 953 954 /* 955 * @brief Support setting softVsync frame rate through windowId. 956 * @param eventInfos a map,key is windowId, value is eventInfo 957 */ 958 void SetWindowExpectedRefreshRate(const std::unordered_map<uint64_t, EventInfo>& eventInfos); 959 960 /* 961 * @brief Support setting softVsync frame rate through vsyncName. 962 * @param eventInfos a map,key is vsyncName, value is eventInfo. 963 */ 964 void SetWindowExpectedRefreshRate(const std::unordered_map<std::string, EventInfo>& eventInfos); 965 966 /** 967 * @brief The game vsync is associated with linkerId. The vsync frequency is reduced to control frames. 968 * @param pid is the game process ID. 969 * @param name is the name of the game thread. 970 * @param rateDiscount Indicates the vsync frequency reduction rate. 971 * @return return bool, return true success, return false, failed. 972 */ 973 bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount); 974 975 /** 976 * @brief Notify touch event. 977 * @param touchStatus status of touch. 978 * @param touchCnt the count of touch. 979 */ 980 void NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt); 981 982 /** 983 * @brief Notify dynamic mode event. 984 * @param enableDynamicMode indicates whether enable dynamic mode. 985 */ 986 void NotifyDynamicModeEvent(bool enableDynamicMode); 987 988 /** 989 * @brief Notify dynamic switching HGM config. 990 * @param eventName event name. 991 * @param state event state. 992 */ 993 void NotifyHgmConfigEvent(const std::string &eventName, bool state); 994 995 /** 996 * @brief Notify xcomponet exported frame rate. 997 * @param id string id. 998 * @param expectedFrameRate expected frame rate. 999 */ 1000 void NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate); 1001 1002 /** 1003 * @brief Pre-processing phase of interaction jank statistics. 1004 * @param info database of render service. 1005 */ 1006 void ReportEventResponse(DataBaseRs info); 1007 1008 /** 1009 * @brief Post-processing phase of interaction jank statistics. 1010 * @param info database of render service. 1011 */ 1012 void ReportEventComplete(DataBaseRs info); 1013 1014 /** 1015 * @brief Report interaction jank statistics. 1016 * @param info database of render service. 1017 */ 1018 void ReportEventJankFrame(DataBaseRs info); 1019 1020 /** 1021 * @brief Report game state information. 1022 * @param info Include pid, uid, render thread id, and foreground or background state of game. 1023 */ 1024 void ReportGameStateData(GameStateData info); 1025 1026 /** 1027 * @brief Report jank state scene start. 1028 * @param info Include app info. 1029 */ 1030 void ReportRsSceneJankStart(AppInfo info); 1031 1032 /** 1033 * @brief Report jank state scene end. 1034 * @param info Include app info. 1035 */ 1036 void ReportRsSceneJankEnd(AppInfo info); 1037 1038 /** 1039 * @brief Enable cache for rotation. 1040 */ 1041 void EnableCacheForRotation(); 1042 1043 /** 1044 * @brief Disable cache for rotation. 1045 */ 1046 void DisableCacheForRotation(); 1047 1048 /** 1049 * @brief Register RenderService death callback. 1050 * @param callback callback function. 1051 */ 1052 void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback); 1053 1054 /** 1055 * @brief Set the system curtain screen status. 1056 * @param isCurtainScreenOn Specify the curtain screen status. 1057 */ 1058 void SetCurtainScreenUsingStatus(bool isCurtainScreenOn); 1059 1060 /** 1061 * @brief Set the process ID list requiring frame dropping. Next time RS triggers rending, 1062 * it will purge queued frames of corresponding self-rendering nodes in bufferQueue, and use the latest frame 1063 * buffer for screen display. 1064 * @param pidList Process ID list requiring frame dropping. 1065 */ 1066 void DropFrameByPid(const std::vector<int32_t> pidList); 1067 1068 /** 1069 * @brief Get active dirty region info. 1070 * @return ActiveDirtyRegionInfo, contains the dirty area, number of frames to be drawn, and window name. 1071 */ 1072 std::vector<ActiveDirtyRegionInfo> GetActiveDirtyRegionInfo() const; 1073 1074 /** 1075 * @brief Get global dirty region info. 1076 * @return GlobalDirtyRegionInfo, include the area of the global dirty, number of frames to be drawn, 1077 * and number of frames to be skipped to be drawn. 1078 */ 1079 GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() const; 1080 1081 /** 1082 * @brief Get Layer compose info. 1083 * @return LayerComposeInfo, include the total number of composite frames, 1084 * the number of uniformRenderFrame, and the number of redrawFrame. 1085 */ 1086 LayerComposeInfo GetLayerComposeInfo() const; 1087 1088 /** 1089 * @brief Get hwc disabled reason info. 1090 * @return HwcDisabledReasonInfos, include the number of times that the HWC is disabled. 1091 */ 1092 HwcDisabledReasonInfos GetHwcDisabledReasonInfo() const; 1093 1094 int64_t GetHdrOnDuration() const; 1095 1096 /** 1097 * @brief Set vma cache status. 1098 * @param flag wma cache status. 1099 */ 1100 void SetVmaCacheStatus(bool flag); 1101 1102 #ifdef TP_FEATURE_ENABLE 1103 /** 1104 * @brief Set touch config of screen. 1105 * @param feature Feature ID. 1106 * @param config Configuration string. 1107 * @param tpFeatureConfigType The type of TpFeatureConfigType. 1108 */ 1109 void SetTpFeatureConfig(int32_t feature, const char* config, 1110 TpFeatureConfigType tpFeatureConfigType = TpFeatureConfigType::DEFAULT_TP_FEATURE); 1111 #endif 1112 1113 /** 1114 * @brief Set virtual screen using status, vote for 60Hz if being used. 1115 * @param isVirtualScreenUsingStatus True means using virtual screen, false means not using. 1116 */ 1117 void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus); 1118 1119 /** 1120 * @brief Register UIExtension callback function. 1121 * @param userId the id of user. 1122 * @param callback Callback function. 1123 * @param unobscured Indicates whether is unobscured. 1124 */ 1125 int32_t RegisterUIExtensionCallback(uint64_t userId, const UIExtensionCallback& callback, bool unobscured = false); 1126 1127 /** 1128 * @brief Set virtual screen status. 1129 * @param id Virtual screen id. 1130 * @param screenStatus Virtual screen status, see VirtualScreenStatus. 1131 * @return True if success, false if failed. 1132 */ 1133 bool SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus); 1134 1135 /** 1136 * @brief Set all anco node ForceDoDirect. 1137 * @param direct is need to set ForceDoDirect. 1138 * @return the execution result successful. 1139 */ 1140 bool SetAncoForceDoDirect(bool direct); 1141 1142 /** 1143 * @brief Set free multi window status. 1144 * @param enable Indicates whether enable. 1145 */ 1146 void SetFreeMultiWindowStatus(bool enable); 1147 1148 bool RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, std::function<void()> callback); 1149 1150 /** 1151 * @brief Register a callback to listen for the state of the buffer held by the DrawSurfaceBuffer OpItem, 1152 * such as when acquire is complete ir drawing is finished. 1153 * @param pid Application process ID, which is usually the sequence id of the buffer. 1154 * @param uid Unique ID, corresponding one-to-one with the buffer. 1155 * @param callback It is triggered when buffer state changes. 1156 * @return bool Returns true if successfully send to RS, otherwise false. 1157 */ 1158 bool RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, 1159 std::shared_ptr<SurfaceBufferCallback> callback); 1160 1161 /** 1162 * @brief UnRegister the DrawSurfaceBuffer op callback that holds the buffer state. 1163 * @param pid Application process ID, which is usually the sequence id of the buffer. 1164 * @param uid Unique ID, corresponding one-to-one with the buffer. 1165 * @return bool Returns true if successfully send to RS, otherwise false. 1166 */ 1167 bool UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid); 1168 1169 void SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder); 1170 1171 // Make this node(nodeIdStr) should do DSS composition and set the layer to top. otherwise do GPU composition. 1172 /** 1173 * @brief Set selfdrawing component of stylus engine force use DSS. 1174 * @param nodeIdStr surfaceNode name. 1175 * @param isTop is function switch. 1176 */ 1177 void SetLayerTop(const std::string &nodeIdStr, bool isTop); 1178 1179 // Make this node(nodeIdStr) should do DSS composition and set the surface force refresh. 1180 /** 1181 * @brief Set selfdrawing component of stylus engine force refresh. 1182 * @param nodeIdStr surfaceNode name. 1183 * @param isForceRefresh is function switch. 1184 */ 1185 void SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh); 1186 1187 /** 1188 * @brief Configures the stylus engine's self-drawing component to skip gamut conversion during redering. 1189 * @param nodeIdStr The node name identifying which stylus engine's 1190 * self-drawing component should bypass gamut convesion. 1191 * @param isColorFollow is function switch. 1192 */ 1193 void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow); 1194 1195 /** 1196 * @brief Notify Screen Switched. 1197 */ 1198 void NotifyScreenSwitched(); 1199 1200 /** 1201 * @brief Call RequestNextVsync to force refresh one frame with the interface. 1202 */ 1203 void ForceRefreshOneFrameWithNextVSync(); 1204 1205 /** 1206 * @brief Register a canvasNode as a container for nodes on the desktop. 1207 * It is a child node of displayNode to achieve unified scalling and other effects. 1208 * @param nodeId The id of the canvasNode, which will be moved below the displayNode of its subtree 1209 * and marked as windowcontainer. 1210 * @param value Mark a node as windowContainer or not. 1211 */ 1212 void SetWindowContainer(NodeId nodeId, bool value); 1213 1214 /** 1215 * @brief Register selfdrawingNode rect change callback. 1216 * @param callback callback function. 1217 * @return return value == 0 success, return value == others, failed. 1218 */ 1219 int32_t RegisterSelfDrawingNodeRectChangeCallback( 1220 const RectConstraint& constraint, const SelfDrawingNodeRectChangeCallback& callback); 1221 1222 int32_t UnRegisterSelfDrawingNodeRectChangeCallback(); 1223 1224 #ifdef RS_ENABLE_OVERLAY_DISPLAY 1225 int32_t SetOverlayDisplayMode(int32_t mode); 1226 #endif 1227 1228 /** 1229 * @brief Notify pageName change. 1230 * @param packageName the name of package. 1231 * @param pageName the name of pageUrl. 1232 * @param isEnter is whether to enter the pageUrl. 1233 */ 1234 void NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter); 1235 1236 /** 1237 * @brief Get high contrast text state. 1238 * @return Return true if high contrast text enabled, otherwise false. 1239 */ 1240 bool GetHighContrastTextState(); 1241 1242 bool SetBehindWindowFilterEnabled(bool enabled); 1243 1244 bool GetBehindWindowFilterEnabled(bool& enabled); 1245 1246 int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB); 1247 1248 /** 1249 * @brief clear uifirst node cache 1250 * @param id surface node id 1251 */ 1252 void ClearUifirstCache(NodeId id); 1253 private: 1254 RSInterfaces(); 1255 ~RSInterfaces() noexcept; 1256 /** 1257 * @brief Component snapshot for divided render. 1258 * @param id The id of the component. 1259 * @param callback Callback function. 1260 * @param scaleX Indicates the scale of X-axis. 1261 * @param scaleY Indicates the scale of Y-axis. 1262 */ 1263 bool TakeSurfaceCaptureForUIWithoutUni(NodeId id, std::shared_ptr<SurfaceCaptureCallback> callback, 1264 float scaleX, float scaleY); 1265 1266 std::unique_ptr<RSRenderServiceClient> renderServiceClient_; 1267 }; 1268 } // namespace Rosen 1269 } // namespace OHOS 1270 1271 #endif // RENDER_SERVICE_CLIENT_CORE_TRANSACTION_RS_INTERFACES_H 1272