• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H
17 #define OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H
18 
19 #include "screen_session_manager_interface.h"
20 
21 #include "iremote_proxy.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 
26 class ScreenSessionManagerProxy : public IRemoteProxy<IScreenSessionManager> {
27 public:
ScreenSessionManagerProxy(const sptr<IRemoteObject> & impl)28     explicit ScreenSessionManagerProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy(impl) {}
29 
30     ~ScreenSessionManagerProxy() = default;
31 
32     virtual sptr<DisplayInfo> GetDefaultDisplayInfo() override;
33     virtual DMError SetScreenActiveMode(ScreenId screenId, uint32_t modeId) override;
34     virtual DMError SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio) override;
35     virtual DMError SetVirtualPixelRatioSystem(ScreenId screenId, float virtualPixelRatio) override;
36     virtual DMError SetResolution(ScreenId screenId, uint32_t width, uint32_t height, float virtualPixelRatio) override;
37     virtual DMError GetDensityInCurResolution(ScreenId screenId, float& virtualPixelRatio) override;
38 
39     virtual DMError GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut) override;
40     virtual DMError SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx) override;
41     virtual DMError GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap) override;
42     virtual DMError SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap) override;
43     virtual DMError SetScreenColorTransform(ScreenId screenId) override;
44 
45     DMError GetPixelFormat(ScreenId screenId, GraphicPixelFormat& pixelFormat) override;
46     DMError SetPixelFormat(ScreenId screenId, GraphicPixelFormat pixelFormat) override;
47     DMError GetSupportedHDRFormats(ScreenId screenId, std::vector<ScreenHDRFormat>& hdrFormats) override;
48     DMError GetScreenHDRFormat(ScreenId screenId, ScreenHDRFormat& hdrFormat) override;
49     DMError SetScreenHDRFormat(ScreenId screenId, int32_t modeIdx) override;
50     DMError GetSupportedColorSpaces(ScreenId screenId, std::vector<GraphicCM_ColorSpaceType>& colorSpaces) override;
51     DMError GetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType& colorSpace) override;
52     DMError SetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType colorSpace) override;
53 
54     virtual DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
55         DisplayManagerAgentType type) override;
56 
57     virtual DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
58         DisplayManagerAgentType type) override;
59 
60     virtual void NotifyDisplayEvent(DisplayEvent event) override;
61     virtual bool WakeUpBegin(PowerStateChangeReason reason) override;
62     virtual bool WakeUpEnd() override;
63     virtual bool SuspendBegin(PowerStateChangeReason reason) override;
64     virtual bool SuspendEnd() override;
65     virtual bool SetSpecifiedScreenPower(ScreenId, ScreenPowerState, PowerStateChangeReason) override;
66     virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) override;
67     virtual ScreenPowerState GetScreenPower(ScreenId dmsScreenId) override;
68     virtual ScreenPowerState GetScreenPower() override;
69     virtual bool SetDisplayState(DisplayState state) override;
70     virtual DisplayState GetDisplayState(DisplayId displayId) override;
71     virtual bool TryToCancelScreenOff() override;
72     virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
73         const sptr<IRemoteObject>& displayManagerAgent) override;
74 
75     virtual DMError DestroyVirtualScreen(ScreenId screenId) override;
76 
77     virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<IBufferProducer> surface) override;
78 
79     virtual DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height) override;
80 
81     virtual DMError SetVirtualMirrorScreenCanvasRotation(ScreenId screenId, bool autoRotate) override;
82 
83     virtual DMError SetVirtualMirrorScreenScaleMode(ScreenId screenId, ScreenScaleMode scaleMode) override;
84 
85     virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
86         ScreenId& screenGroupId) override;
87     virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
88         DMRect mainScreenRegion, ScreenId& screenGroupId) override;
89     virtual DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override;
90     DMError DisableMirror(bool disableOrNot) override;
91 
92     virtual DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint,
93                                ScreenId& screenGroupId) override;
94     virtual DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override;
95 
96     virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override;
97 
98     virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override;
99 
100     virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId,
101         DmErrorCode* errorCode, bool isUseDma) override;
102     virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) override;
103 
104     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override;
105     virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override;
106     virtual std::vector<DisplayId> GetAllDisplayIds() override;
107 
108     virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override;
109 
110     virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override;
111 
112     virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId,
113         std::vector<ScreenColorGamut>& colorGamuts) override;
114 
115     virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) override;
116     virtual DMError SetScreenRotationLocked(bool isLocked) override;
117     virtual DMError SetScreenRotationLockedFromJs(bool isLocked) override;
118     virtual DMError IsScreenRotationLocked(bool& isLocked) override;
119     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override;
120     virtual DMError HasImmersiveWindow(bool& immersive) override;
121 
122     virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override;
123     virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override;
124     virtual void UpdateDisplayHookInfo(int32_t uid, bool enable, const DMHookInfo& hookInfo) override;
125 
126     virtual void DumpAllScreensInfo(std::string& dumpInfo) override;
127     virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) override;
128     //Fold Screen
129     void SetFoldDisplayMode(const FoldDisplayMode displayMode) override;
130     DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode, std::string reason = "") override;
131 
132     void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY,
133         float pivotX, float pivotY) override;
134 
135     void SetFoldStatusLocked(bool locked) override;
136     DMError SetFoldStatusLockedFromJs(bool locked) override;
137 
138     FoldDisplayMode GetFoldDisplayMode() override;
139 
140     bool IsFoldable() override;
141     bool IsCaptured() override;
142 
143     FoldStatus GetFoldStatus() override;
144 
145     sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override;
146 
147     void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) override;
148 
149     // unique screen
150     DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds) override;
151 
152     void SetClient(const sptr<IScreenSessionManagerClient>& client) override;
153     ScreenProperty GetScreenProperty(ScreenId screenId) override;
154     std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override;
155     void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
156         ScreenPropertyChangeType screenPropertyChangeType) override;
157     void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation,
158         float phyRotation, ScreenPropertyChangeType screenPropertyChangeType) override;
159     void UpdateAvailableArea(ScreenId ScreenId, DMRect area) override;
160     int32_t SetScreenOffDelayTime(int32_t delay) override;
161     uint32_t GetCurvedCompressionArea() override;
162     ScreenProperty GetPhyScreenProperty(ScreenId screenId) override;
163     void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) override;
164     void SetScreenPrivacyState(bool hasPrivate) override;
165     void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) override;
166     void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) override;
167     virtual DMError GetAvailableArea(DisplayId displayId, DMRect& area) override;
168     void NotifyFoldToExpandCompletion(bool foldToExpand) override;
169     void RecordEventFromScb(std::string description, bool needRecordEvent) override;
170     void SwitchUser() override;
171     VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId) override;
172     DMError SetVirtualScreenFlag(ScreenId screenId, VirtualScreenFlag screenFlag) override;
173     DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override;
174     DeviceScreenConfig GetDeviceScreenConfig() override;
175     DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override;
176     DMError ResetAllFreezeStatus() override;
177     void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList,
178         std::vector<uint64_t> surfaceIdList = {}) override;
179     void DisablePowerOffRenderControl(ScreenId screenId) override;
180     std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override;
181     std::string GetDisplayCapability() override;
182     DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid,
183         std::vector<uint64_t>& windowIdList) override;
184 
185     DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate,
186         uint32_t& actualRefreshRate) override;
187     std::shared_ptr<Media::PixelMap> GetScreenCapture(const CaptureOption& captureOption,
188         DmErrorCode* errorCode = nullptr) override;
189     std::shared_ptr<Media::PixelMap> GetDisplaySnapshotWithOption(const CaptureOption& captureOption,
190         DmErrorCode* errorCode) override;
191     sptr<DisplayInfo> GetPrimaryDisplayInfo() override;
192     ScreenCombination GetScreenCombination(ScreenId screenId) override;
193     DMError SetScreenSkipProtectedWindow(const std::vector<ScreenId>& screenIds, bool isEnable) override;
194 
195 private:
196     static inline BrokerDelegator<ScreenSessionManagerProxy> delegator_;
197 };
198 
199 } // namespace Rosen
200 } // namespace OHOS
201 
202 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H