• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_PROXY_H
17 #define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_PROXY_H
18 
19 #include <iremote_proxy.h>
20 #include <platform/ohos/rs_irender_service_connection.h>
21 #include "sandbox_utils.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class RSRenderServiceConnectionProxy : public IRemoteProxy<RSIRenderServiceConnection> {
26 public:
27     explicit RSRenderServiceConnectionProxy(const sptr<IRemoteObject>& impl);
28     virtual ~RSRenderServiceConnectionProxy() noexcept = default;
29 
30     void CommitTransaction(std::unique_ptr<RSTransactionData>& transactionData) override;
31     bool FillParcelWithTransactionData(
32         std::unique_ptr<RSTransactionData>& transactionData, std::shared_ptr<MessageParcel>& data);
33 
34     void ExecuteSynchronousTask(const std::shared_ptr<RSSyncTask>& task) override;
35 
36     int32_t SetRenderModeChangeCallback(sptr<RSIRenderModeChangeCallback> callback) override;
37     void UpdateRenderMode(bool isUniRender) override;
38     bool GetUniRenderEnabled() override;
39     bool QueryIfRTNeedRender() override;
40     bool CreateNode(const RSSurfaceRenderNodeConfig& config) override;
41     sptr<Surface> CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config) override;
42 
43     virtual sptr<IVSyncConnection> CreateVSyncConnection(const std::string& name) override;
44 
45     int32_t SetFocusAppInfo(
46         int32_t pid, int32_t uid, const std::string &bundleName, const std::string &abilityName) override;
47 
48     ScreenId GetDefaultScreenId() override;
49 
50     std::vector<ScreenId> GetAllScreenIds() override;
51 
52     // mirrorId: decide which screen id to mirror, INVALID_SCREEN_ID means do not mirror any screen.
53     ScreenId CreateVirtualScreen(
54         const std::string &name,
55         uint32_t width,
56         uint32_t height,
57         sptr<Surface> surface,
58         ScreenId mirrorId = 0,
59         int32_t flags = 0) override;
60 
61     int32_t SetVirtualScreenSurface(ScreenId id, sptr<Surface> surface) override;
62 
63     void RemoveVirtualScreen(ScreenId id) override;
64 
65     int32_t SetScreenChangeCallback(sptr<RSIScreenChangeCallback> callback) override;
66 
67     void SetScreenActiveMode(ScreenId id, uint32_t modeId) override;
68 
69     int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) override;
70 
71     void SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) override;
72 
73     void RegisterApplicationAgent(uint32_t pid, sptr<IApplicationAgent> app) override;
74 
75     void TakeSurfaceCapture(NodeId id, sptr<RSISurfaceCaptureCallback> callback, float scaleX, float scaleY) override;
76 
77     RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) override;
78 
79     RSScreenModeInfo GetScreenActiveMode(ScreenId id) override;
80 
81     std::vector<RSScreenModeInfo> GetScreenSupportedModes(ScreenId id) override;
82 
83     RSScreenCapability GetScreenCapability(ScreenId id) override;
84 
85     ScreenPowerStatus GetScreenPowerStatus(ScreenId id) override;
86 
87     RSScreenData GetScreenData(ScreenId id) override;
88 
89     int32_t GetScreenBacklight(ScreenId id) override;
90 
91     void SetScreenBacklight(ScreenId id, uint32_t level) override;
92 
93     void RegisterBufferAvailableListener(
94         NodeId id, sptr<RSIBufferAvailableCallback> callback, bool isFromRenderThread) override;
95 
96     int32_t GetScreenSupportedColorGamuts(ScreenId id, std::vector<ScreenColorGamut>& mode) override;
97 
98     int32_t GetScreenSupportedMetaDataKeys(ScreenId id, std::vector<ScreenHDRMetadataKey>& keys) override;
99 
100     int32_t GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) override;
101 
102     int32_t SetScreenColorGamut(ScreenId id, int32_t modeIdx) override;
103 
104     int32_t SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) override;
105 
106     int32_t GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) override;
107 
108     int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) override;
109 
110     int32_t GetScreenType(ScreenId id, RSScreenType& screenType) override;
111 
112     int32_t SetScreenSkipFrameInterval(ScreenId id, uint32_t skipFrameInterval) override;
113 
114     int32_t RegisterOcclusionChangeCallback(sptr<RSIOcclusionChangeCallback> callback) override;
115 
116     void SetAppWindowNum(uint32_t num) override;
117 private:
118     static inline BrokerDelegator<RSRenderServiceConnectionProxy> delegator_;
119 
120     pid_t pid_ = GetRealPid();
121     uint32_t transactionDataIndex_ = 0;
122 };
123 } // namespace Rosen
124 } // namespace OHOS
125 
126 #endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_PROXY_H
127