• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_CONNECTION_H
17 #define RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_CONNECTION_H
18 
19 #include <mutex>
20 #include <unordered_set>
21 
22 #include "hgm_config_callback_manager.h"
23 #include "ipc_callbacks/buffer_available_callback.h"
24 #include "ipc_callbacks/buffer_clear_callback.h"
25 #include "pipeline/hardware_thread/rs_hardware_thread.h"
26 #include "pipeline/render_thread/rs_uni_render_thread.h"
27 #include "pipeline/main_thread/rs_render_service.h"
28 #include "screen_manager/rs_screen_manager.h"
29 #include "transaction/rs_render_service_connection_stub.h"
30 #include "vsync_distributor.h"
31 
32 namespace OHOS {
33 namespace Rosen {
34 class HgmFrameRateManager;
35 class RSRenderServiceConnection : public RSRenderServiceConnectionStub {
36 public:
37     RSRenderServiceConnection(
38         pid_t remotePid,
39         wptr<RSRenderService> renderService,
40         RSMainThread* mainThread,
41         sptr<RSScreenManager> screenManager,
42         sptr<IRemoteObject> token,
43         sptr<VSyncDistributor> distributor);
44     ~RSRenderServiceConnection() noexcept;
45     RSRenderServiceConnection(const RSRenderServiceConnection&) = delete;
46     RSRenderServiceConnection& operator=(const RSRenderServiceConnection&) = delete;
47 
GetToken()48     sptr<IRemoteObject> GetToken() const
49     {
50         return token_;
51     }
52 
53 private:
54     void CleanVirtualScreens() noexcept;
55     void CleanRenderNodes() noexcept;
56     void CleanFrameRateLinkers() noexcept;
57     void CleanFrameRateLinkerExpectedFpsCallbacks() noexcept;
58     void CleanAll(bool toDelete = false) noexcept;
59 
60     // IPC RSIRenderServiceConnection Interfaces
61     ErrCode CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) override;
62     ErrCode ExecuteSynchronousTask(const std::shared_ptr<RSSyncTask>& task) override;
63     ErrCode GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) override;
64     ErrCode GetMemoryGraphics(std::vector<MemoryGraphic>& memoryGraphics) override;
65     ErrCode GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) override;
66     ErrCode GetUniRenderEnabled(bool& enable) override;
67 
68     ErrCode CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) override;
69     ErrCode CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) override;
70     ErrCode CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr<Surface>& sfc,
71         bool unobscured = false) override;
72 
73     ErrCode CreateVSyncConnection(sptr<IVSyncConnection>& vsyncConn,
74                                   const std::string& name,
75                                   const sptr<VSyncIConnectionToken>& token,
76                                   VSyncConnParam vsyncConnParam = {0, 0, false}) override;
77 
78     ErrCode GetPixelMapByProcessId(std::vector<PixelMapInfo>& pixelMapInfoVector, pid_t pid, int32_t& repCode) override;
79     float GetRotationInfoFromSurfaceBuffer(const sptr<SurfaceBuffer>& buffer);
80 
81     ErrCode CreatePixelMapFromSurface(sptr<Surface> surface,
82         const Rect &srcRect, std::shared_ptr<Media::PixelMap> &pixelMap) override;
83 
84     ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) override;
85 
86     ErrCode GetDefaultScreenId(uint64_t& screenId) override;
87 
88     ErrCode GetActiveScreenId(uint64_t& screenId) override;
89 
90     std::vector<ScreenId> GetAllScreenIds() override;
91 
92     ScreenId CreateVirtualScreen(
93         const std::string &name,
94         uint32_t width,
95         uint32_t height,
96         sptr<Surface> surface,
97         ScreenId mirrorId = 0,
98         int32_t flags = 0,
99         std::vector<NodeId> whiteList = {}) override;
100 
101     int32_t SetVirtualScreenBlackList(ScreenId id, std::vector<NodeId>& blackListVector) override;
102 
103     ErrCode SetVirtualScreenTypeBlackList(
104         ScreenId id, std::vector<NodeType>& typeBlackListVector, int32_t& repCode) override;
105 
106     ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector<NodeId>& blackListVector, int32_t& repCode) override;
107 
108     ErrCode RemoveVirtualScreenBlackList(ScreenId id, std::vector<NodeId>& blackListVector, int32_t& repCode) override;
109 
110     int32_t SetVirtualScreenSecurityExemptionList(
111         ScreenId id, const std::vector<NodeId>& securityExemptionList) override;
112 
113     int32_t SetScreenSecurityMask(ScreenId id,
114         std::shared_ptr<Media::PixelMap> securityMask) override;
115 
116     int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation = false) override;
117 
118     int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) override;
119 
120     int32_t SetVirtualScreenSurface(ScreenId id, sptr<Surface> surface) override;
121 
122     void RemoveVirtualScreen(ScreenId id) override;
123 
124 #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR
125     int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer,
126         int64_t interval, int32_t rangeSize) override;
127 
128     int32_t SetPointerColorInversionEnabled(bool enable) override;
129 
130     int32_t RegisterPointerLuminanceChangeCallback(sptr<RSIPointerLuminanceChangeCallback> callback) override;
131 
132     int32_t UnRegisterPointerLuminanceChangeCallback() override;
133 #endif
134 
135     int32_t SetScreenChangeCallback(sptr<RSIScreenChangeCallback> callback) override;
136 
137     int32_t SetScreenSwitchingNotifyCallback(sptr<RSIScreenSwitchingNotifyCallback> callback) override;
138 
139     void SetScreenActiveMode(ScreenId id, uint32_t modeId) override;
140 
141     void SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) override;
142 
143     void SetRefreshRateMode(int32_t refreshRateMode) override;
144 
145     void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range,
146         int32_t animatorExpectedFrameRate) override;
147 
148     void UnregisterFrameRateLinker(FrameRateLinkerId id) override;
149 
150     uint32_t GetScreenCurrentRefreshRate(ScreenId id) override;
151 
152     int32_t GetCurrentRefreshRateMode() override;
153 
154     std::vector<int32_t> GetScreenSupportedRefreshRates(ScreenId id) override;
155 
156     ErrCode GetShowRefreshRateEnabled(bool& enable) override;
157 
158     void SetShowRefreshRateEnabled(bool enabled, int32_t type) override;
159 
160     uint32_t GetRealtimeRefreshRate(ScreenId screenId) override;
161 
162     ErrCode GetRefreshInfo(pid_t pid, std::string& enable) override;
163     ErrCode GetRefreshInfoToSP(NodeId id, std::string& enable) override;
164 
165     int32_t SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) override;
166 
167     int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) override;
168 
169     ErrCode MarkPowerOffNeedProcessOneFrame() override;
170 
171     ErrCode RepaintEverything() override;
172 
173     ErrCode ForceRefreshOneFrameWithNextVSync() override;
174 
175     void DisablePowerOffRenderControl(ScreenId id) override;
176 
177     void SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) override;
178 
179     void TakeSurfaceCapture(NodeId id, sptr<RSISurfaceCaptureCallback> callback,
180         const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam,
181         const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f),
182         RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override;
183 
184     std::vector<std::pair<NodeId, std::shared_ptr<Media::PixelMap>>> TakeSurfaceCaptureSoloNode(
185         NodeId id, const RSSurfaceCaptureConfig& captureConfig,
186         RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override;
187 
188     void TakeSelfSurfaceCapture(
189         NodeId id, sptr<RSISurfaceCaptureCallback> callback, const RSSurfaceCaptureConfig& captureConfig) override;
190 
191     ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr<RSISurfaceCaptureCallback> callback,
192         const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) override;
193 
194     ErrCode TaskSurfaceCaptureWithAllWindows(NodeId id, sptr<RSISurfaceCaptureCallback> callback,
195         const RSSurfaceCaptureConfig& captureConfig, bool checkDrmAndSurfaceLock,
196         RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override;
197 
198     ErrCode FreezeScreen(NodeId id, bool isFreeze) override;
199 
200     void TakeUICaptureInRange(
201         NodeId id, sptr<RSISurfaceCaptureCallback> callback, const RSSurfaceCaptureConfig& captureConfig) override;
202 
203     ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY,
204         float positionZ, float positionW) override;
205 
206     ErrCode RegisterApplicationAgent(uint32_t pid, sptr<IApplicationAgent> app) override;
207 
208     void UnRegisterApplicationAgent(sptr<IApplicationAgent> app);
209 
210     RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) override;
211 
212     ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& info) override;
213 
214     std::vector<RSScreenModeInfo> GetScreenSupportedModes(ScreenId id) override;
215 
216     RSScreenCapability GetScreenCapability(ScreenId id) override;
217 
218     ErrCode GetScreenPowerStatus(uint64_t screenId, uint32_t& status) override;
219 
220     RSScreenData GetScreenData(ScreenId id) override;
221 
222     ErrCode GetScreenBacklight(uint64_t id, int32_t& level) override;
223 
224     void SetScreenBacklight(ScreenId id, uint32_t level) override;
225 
226     ErrCode RegisterBufferAvailableListener(
227         NodeId id, sptr<RSIBufferAvailableCallback> callback, bool isFromRenderThread) override;
228 
229     ErrCode RegisterBufferClearListener(
230         NodeId id, sptr<RSIBufferClearCallback> callback) override;
231 
232     int32_t GetScreenSupportedColorGamuts(ScreenId id, std::vector<ScreenColorGamut>& mode) override;
233 
234     int32_t GetScreenSupportedMetaDataKeys(ScreenId id, std::vector<ScreenHDRMetadataKey>& keys) override;
235 
236     int32_t GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) override;
237 
238     int32_t SetScreenColorGamut(ScreenId id, int32_t modeIdx) override;
239 
240     int32_t SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) override;
241 
242     int32_t SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) override;
243 
244     bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) override;
245 
246     int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) override;
247 
248     bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) override;
249 
250     ErrCode SetGlobalDarkColorMode(bool isDark) override;
251 
252     int32_t GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) override;
253 
254     int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) override;
255 
256     ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) override;
257 
258     ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) override;
259 
260     ErrCode GetScreenSupportedHDRFormats(
261         ScreenId id, std::vector<ScreenHDRFormat>& hdrFormats, int32_t& resCode) override;
262 
263     ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) override;
264 
265     ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) override;
266 
267     ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) override;
268 
269     ErrCode GetScreenSupportedColorSpaces(
270         ScreenId id, std::vector<GraphicCM_ColorSpaceType>& colorSpaces, int32_t& resCode) override;
271 
272     ErrCode GetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) override;
273 
274     ErrCode SetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) override;
275 
276     int32_t GetScreenType(ScreenId id, RSScreenType& screenType) override;
277 
278     ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) override;
279     ErrCode GetPixelmap(NodeId id, std::shared_ptr<Media::PixelMap> pixelmap,
280         const Drawing::Rect* rect, std::shared_ptr<Drawing::DrawCmdList> drawCmdList, bool& success) override;
281     bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr<Drawing::Typeface>& typeface) override;
282     bool UnRegisterTypeface(uint64_t globalUniqueId) override;
283 
284     int32_t GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector<uint8_t>& edidData) override;
285 
286     ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) override;
287 
288     ErrCode SetVirtualScreenRefreshRate(
289         ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) override;
290 
291     ErrCode SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) override;
292 
293     void SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) override;
294 
295     void SetScreenFrameGravity(ScreenId id, int32_t gravity) override;
296 
297     ErrCode RegisterOcclusionChangeCallback(sptr<RSIOcclusionChangeCallback> callback, int32_t& repCode) override;
298 
299     int32_t RegisterSurfaceOcclusionChangeCallback(
300         NodeId id, sptr<RSISurfaceOcclusionChangeCallback> callback, std::vector<float>& partitionPoints) override;
301 
302     int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) override;
303 
304     int32_t RegisterHgmConfigChangeCallback(sptr<RSIHgmConfigChangeCallback> callback) override;
305 
306     int32_t RegisterHgmRefreshRateModeChangeCallback(sptr<RSIHgmConfigChangeCallback> callback) override;
307 
308     int32_t RegisterHgmRefreshRateUpdateCallback(sptr<RSIHgmConfigChangeCallback> callback) override;
309 
310     int32_t RegisterFirstFrameCommitCallback(sptr<RSIFirstFrameCommitCallback> callback) override;
311 
312     int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid,
313         sptr<RSIFrameRateLinkerExpectedFpsUpdateCallback> callback) override;
314 
315     ErrCode SetAppWindowNum(uint32_t num) override;
316 
317     ErrCode SetSystemAnimatedScenes(
318         SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) override;
319 
320     void ShowWatermark(const std::shared_ptr<Media::PixelMap> &watermarkImg, bool isShow) override;
321 
322     ErrCode SetWatermark(const std::string& name, std::shared_ptr<Media::PixelMap> watermark, bool& success) override;
323 
324     int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) override;
325 
326     ErrCode ReportJankStats() override;
327 
328     ErrCode ReportEventResponse(DataBaseRs info) override;
329 
330     ErrCode ReportEventComplete(DataBaseRs info) override;
331 
332     ErrCode ReportEventJankFrame(DataBaseRs info) override;
333 
334     void ReportRsSceneJankStart(AppInfo info) override;
335 
336     void ReportRsSceneJankEnd(AppInfo info) override;
337 
338     ErrCode ReportGameStateData(GameStateData info) override;
339 
340     ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType,
341         bool dynamicHardwareEnable) override;
342 
343     ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) override;
344 
345     ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) override;
346 
347     void NotifyPackageEvent(uint32_t listSize, const std::vector<std::string>& packageList) override;
348 
349     void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize,
350         const std::vector<std::pair<std::string, std::string>>& newConfig) override;
351 
352     void NotifyRefreshRateEvent(const EventInfo& eventInfo) override;
353 
354     void SetWindowExpectedRefreshRate(const std::unordered_map<uint64_t, EventInfo>& eventInfos) override;
355 
356     void SetWindowExpectedRefreshRate(const std::unordered_map<std::string, EventInfo>& eventInfos) override;
357 
358     ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) override;
359 
360     bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) override;
361 
362     ErrCode NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) override;
363 
364     void NotifyDynamicModeEvent(bool enableDynamicModeEvent) override;
365 
366     ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) override;
367 
368     ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) override;
369 
370     ErrCode SetCacheEnabledForRotation(bool isEnabled) override;
371 
372     ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) override;
373 
374     std::vector<ActiveDirtyRegionInfo> GetActiveDirtyRegionInfo() override;
375 
376     GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() override;
377 
378     LayerComposeInfo GetLayerComposeInfo() override;
379 
380     HwcDisabledReasonInfos GetHwcDisabledReasonInfo() override;
381 
382     ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) override;
383 
384     ErrCode SetVmaCacheStatus(bool flag) override;
385 
386     int32_t RegisterUIExtensionCallback(uint64_t userId, sptr<RSIUIExtensionCallback> callback,
387         bool unobscured = false) override;
388 
389 #ifdef TP_FEATURE_ENABLE
390     ErrCode SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) override;
391 #endif
392 
393     void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) override;
394     ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) override;
395 
396     ErrCode DropFrameByPid(const std::vector<int32_t> pidList) override;
397 
398     ErrCode SetGpuCrcDirtyEnabledPidList(const std::vector<int32_t> pidList) override;
399 
400     ErrCode SetOptimizeCanvasDirtyPidList(const std::vector<int32_t>& pidList) override;
401 
402     ErrCode SetAncoForceDoDirect(bool direct, bool& res) override;
403 
404     void SetFreeMultiWindowStatus(bool enable) override;
405 
406     ErrCode SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) override;
407 
408     ErrCode SetLayerTop(const std::string &nodeIdStr, bool isTop) override;
409 
410     ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) override;
411 
412     void RegisterTransactionDataCallback(uint64_t token,
413         uint64_t timeStamp, sptr<RSITransactionDataCallback> callback) override;
414 
415     void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) override;
416 
417     ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid,
418         sptr<RSISurfaceBufferCallback> callback) override;
419     ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) override;
420 
421     ErrCode NotifyScreenSwitched() override;
422 
423     ErrCode SetWindowContainer(NodeId nodeId, bool value) override;
424 
425     int32_t RegisterSelfDrawingNodeRectChangeCallback(
426         const RectConstraint& constraint, sptr<RSISelfDrawingNodeRectChangeCallback> callback) override;
427 
428     int32_t UnRegisterSelfDrawingNodeRectChangeCallback() override;
429 
430 #ifdef RS_ENABLE_OVERLAY_DISPLAY
431     ErrCode SetOverlayDisplayMode(int32_t mode) override;
432 #endif
433 
434     ErrCode NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) override;
435 
436     bool GetHighContrastTextState() override;
437 
438     ErrCode SetBehindWindowFilterEnabled(bool enabled) override;
439 
440     ErrCode GetBehindWindowFilterEnabled(bool& enabled) override;
441 
442     ErrCode AvcodecVideoStart(uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) override;
443 
444     ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) override;
445 
446     int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) override;
447 
448     RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo,
449         const std::string& fileName, int32_t flags, int& outFd) override;
450     RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo,
451         uint32_t firstFileIndex, std::vector<HrpServiceFileInfo>& outFiles) override;
452     bool ProfilerIsSecureScreen() override;
453 
454     void ClearUifirstCache(NodeId id) override;
455 
456     pid_t remotePid_;
457     wptr<RSRenderService> renderService_;
458     RSMainThread* mainThread_ = nullptr;
459 #ifdef RS_ENABLE_GPU
460     RSUniRenderThread& renderThread_;
461 #endif
462     sptr<RSScreenManager> screenManager_;
463     sptr<IRemoteObject> token_;
464 
465     class RSConnectionDeathRecipient : public IRemoteObject::DeathRecipient {
466     public:
467         explicit RSConnectionDeathRecipient(wptr<RSRenderServiceConnection> conn);
468         virtual ~RSConnectionDeathRecipient() = default;
469 
470         void OnRemoteDied(const wptr<IRemoteObject>& token) override;
471 
472     private:
473         wptr<RSRenderServiceConnection> conn_;
474     };
475     friend class RSConnectionDeathRecipient;
476     sptr<RSConnectionDeathRecipient> connDeathRecipient_;
477 
478     class RSApplicationRenderThreadDeathRecipient : public IRemoteObject::DeathRecipient {
479     public:
480         explicit RSApplicationRenderThreadDeathRecipient(wptr<RSRenderServiceConnection> conn);
481         virtual ~RSApplicationRenderThreadDeathRecipient() = default;
482 
483         void OnRemoteDied(const wptr<IRemoteObject>& token) override;
484 
485     private:
486         wptr<RSRenderServiceConnection> conn_;
487     };
488     friend class RSApplicationRenderThreadDeathRecipient;
489     sptr<RSApplicationRenderThreadDeathRecipient> applicationDeathRecipient_ = nullptr;
490 
491     mutable std::mutex mutex_;
492     bool cleanDone_ = false;
493     const std::string VOTER_SCENE_BLUR = "VOTER_SCENE_BLUR";
494     const std::string VOTER_SCENE_GPU = "VOTER_SCENE_GPU";
495 
496     // save all virtual screenIds created by this connection.
497     std::unordered_set<ScreenId> virtualScreenIds_;
498     sptr<RSIScreenChangeCallback> screenChangeCallback_;
499     sptr<VSyncDistributor> appVSyncDistributor_;
500 
501 #ifdef RS_PROFILER_ENABLED
502     friend class RSProfiler;
503 #endif
504 };
505 } // namespace Rosen
506 } // namespace OHOS
507 
508 #endif // RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_CONNECTION_H
509