• 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 SetDefaultDensityDpi(ScreenId screenId, float virtualPixelRatio) override;
37     virtual DMError SetResolution(ScreenId screenId, uint32_t width, uint32_t height, float virtualPixelRatio) override;
38     virtual DMError GetDensityInCurResolution(ScreenId screenId, float& virtualPixelRatio) override;
39 
40     virtual DMError GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut) override;
41     virtual DMError SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx) override;
42     virtual DMError GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap) override;
43     virtual DMError SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap) override;
44     virtual DMError SetScreenColorTransform(ScreenId screenId) override;
45 
46     DMError GetPixelFormat(ScreenId screenId, GraphicPixelFormat& pixelFormat) override;
47     DMError SetPixelFormat(ScreenId screenId, GraphicPixelFormat pixelFormat) override;
48     DMError GetSupportedHDRFormats(ScreenId screenId, std::vector<ScreenHDRFormat>& hdrFormats) override;
49     DMError GetScreenHDRFormat(ScreenId screenId, ScreenHDRFormat& hdrFormat) override;
50     DMError SetScreenHDRFormat(ScreenId screenId, int32_t modeIdx) override;
51     DMError GetSupportedColorSpaces(ScreenId screenId, std::vector<GraphicCM_ColorSpaceType>& colorSpaces) override;
52     DMError GetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType& colorSpace) override;
53     DMError SetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType colorSpace) override;
54 
55     virtual DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
56         DisplayManagerAgentType type) override;
57 
58     virtual DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
59         DisplayManagerAgentType type) override;
60 
61     virtual void NotifyDisplayEvent(DisplayEvent event) override;
62     virtual bool WakeUpBegin(PowerStateChangeReason reason) override;
63     virtual bool WakeUpEnd() override;
64     virtual bool SuspendBegin(PowerStateChangeReason reason) override;
65     virtual bool SuspendEnd() override;
66     virtual ScreenId GetInternalScreenId() override;
67     virtual bool SetScreenPowerById(ScreenId screenId, ScreenPowerState state, PowerStateChangeReason reason) override;
68     virtual bool SetSpecifiedScreenPower(ScreenId, ScreenPowerState, PowerStateChangeReason) override;
69     virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) override;
70     virtual ScreenPowerState GetScreenPower(ScreenId dmsScreenId) override;
71     virtual ScreenPowerState GetScreenPower() override;
72     virtual bool SetDisplayState(DisplayState state) override;
73     virtual DisplayState GetDisplayState(DisplayId displayId) override;
74     virtual bool TryToCancelScreenOff() override;
75     virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
76         const sptr<IRemoteObject>& displayManagerAgent) override;
77 
78     virtual DMError DestroyVirtualScreen(ScreenId screenId) override;
79 
80     virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<IBufferProducer> surface) override;
81 
82     DMError AddVirtualScreenBlockList(const std::vector<int32_t>& persistentIds) override;
83 
84     DMError RemoveVirtualScreenBlockList(const std::vector<int32_t>& persistentIds) override;
85 
86     virtual DMError SetScreenPrivacyMaskImage(ScreenId screenId,
87         const std::shared_ptr<Media::PixelMap>& privacyMaskImg) override;
88 
89     virtual DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height) override;
90 
91     virtual DMError SetVirtualMirrorScreenCanvasRotation(ScreenId screenId, bool autoRotate) override;
92 
93     virtual DMError SetVirtualMirrorScreenScaleMode(ScreenId screenId, ScreenScaleMode scaleMode) override;
94 
95     virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
96         ScreenId& screenGroupId) override;
97     virtual DMError MakeMirrorForRecord(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
98         ScreenId& screenGroupId) override;
99     virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
100         DMRect mainScreenRegion, ScreenId& screenGroupId) override;
101     virtual DMError SetMultiScreenMode(ScreenId mainScreenId, ScreenId secondaryScreenId,
102         MultiScreenMode screenMode) override;
103     virtual DMError SetMultiScreenRelativePosition(MultiScreenPositionOptions mainScreenOptions,
104         MultiScreenPositionOptions secondScreenOption) override;
105     virtual DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override;
106     DMError DisableMirror(bool disableOrNot) override;
107 
108     virtual DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint,
109                                ScreenId& screenGroupId) override;
110     virtual DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override;
111 
112     virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override;
113 
114     virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override;
115 
116     virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId,
117         DmErrorCode* errorCode, bool isUseDma) override;
118     virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) override;
119 
120     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override;
121     virtual sptr<DisplayInfo> GetVisibleAreaDisplayInfoById(DisplayId displayId) override;
122     virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override;
123     virtual std::vector<DisplayId> GetAllDisplayIds() override;
124 
125     virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override;
126 
127     virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override;
128 
129     virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId,
130         std::vector<ScreenColorGamut>& colorGamuts) override;
131 
132     virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) override;
133     virtual DMError SetScreenRotationLocked(bool isLocked) override;
134     virtual DMError SetScreenRotationLockedFromJs(bool isLocked) override;
135     virtual DMError IsScreenRotationLocked(bool& isLocked) override;
136     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override;
137     virtual DMError HasImmersiveWindow(ScreenId screenId, bool& immersive) override;
138 
139     virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override;
140     virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override;
141     virtual void UpdateDisplayHookInfo(int32_t uid, bool enable, const DMHookInfo& hookInfo) override;
142     virtual void GetDisplayHookInfo(int32_t uid, DMHookInfo& hookInfo) override;
143 
144     virtual void DumpAllScreensInfo(std::string& dumpInfo) override;
145     virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) override;
146     //Fold Screen
147     void SetFoldDisplayMode(const FoldDisplayMode displayMode) override;
148     DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode, std::string reason = "") override;
149 
150     void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY,
151         float pivotX, float pivotY) override;
152 
153     void SetFoldStatusLocked(bool locked) override;
154     DMError SetFoldStatusLockedFromJs(bool locked) override;
155 
156     FoldDisplayMode GetFoldDisplayMode() override;
157 
158     bool IsFoldable() override;
159     bool IsCaptured() override;
160     bool IsOrientationNeedChanged() override;
161 
162     FoldStatus GetFoldStatus() override;
163     SuperFoldStatus GetSuperFoldStatus() override;
164     void SetLandscapeLockStatus(bool isLocked) override;
165     ExtendScreenConnectStatus GetExtendScreenConnectStatus() override;
166     sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override;
167 
168     void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) override;
169 
170     // unique screen
171     DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds, std::vector<DisplayId>& displayIds) override;
172 
173     void SetClient(const sptr<IScreenSessionManagerClient>& client) override;
174     ScreenProperty GetScreenProperty(ScreenId screenId) override;
175     std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override;
176     void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
177         ScreenPropertyChangeType screenPropertyChangeType) override;
178     void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation,
179         float phyRotation, ScreenPropertyChangeType screenPropertyChangeType) override;
180     void UpdateAvailableArea(ScreenId ScreenId, DMRect area) override;
181     void UpdateSuperFoldAvailableArea(ScreenId screenId, DMRect bArea, DMRect cArea) override;
182     void UpdateSuperFoldExpandAvailableArea(ScreenId screenId, DMRect area) override;
183     int32_t SetScreenOffDelayTime(int32_t delay) override;
184     int32_t SetScreenOnDelayTime(int32_t delay) override;
185     uint32_t GetCurvedCompressionArea() override;
186     ScreenProperty GetPhyScreenProperty(ScreenId screenId) override;
187     void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) override;
188     void SetScreenPrivacyState(bool hasPrivate) override;
189     void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) override;
190     void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) override;
191     virtual DMError GetAvailableArea(DisplayId displayId, DMRect& area) override;
192     virtual DMError GetExpandAvailableArea(DisplayId displayId, DMRect& area) override;
193     void NotifyFoldToExpandCompletion(bool foldToExpand) override;
194     void RecordEventFromScb(std::string description, bool needRecordEvent) override;
195     void SwitchUser() override;
196 
197     VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId) override;
198     DMError SetVirtualScreenFlag(ScreenId screenId, VirtualScreenFlag screenFlag) override;
199     DeviceScreenConfig GetDeviceScreenConfig() override;
200     DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override;
201     void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList,
202         std::vector<uint64_t> surfaceIdList = {}) override;
203     void SetVirtualDisplayMuteFlag(ScreenId screenId, bool muteFlag) override;
204     void DisablePowerOffRenderControl(ScreenId screenId) override;
205     DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override;
206     DMError ResetAllFreezeStatus() override;
207     std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override;
208     DMError GetDisplayCapability(std::string& capabilitInfo) override;
209     bool SetVirtualScreenStatus(ScreenId screenId, VirtualScreenStatus screenStatus) override;
210     DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid,
211         std::vector<uint64_t>& windowIdList) override;
212     DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate,
213         uint32_t& actualRefreshRate) override;
214     std::shared_ptr<Media::PixelMap> GetScreenCapture(const CaptureOption& captureOption,
215         DmErrorCode* errorCode = nullptr) override;
216     std::shared_ptr<Media::PixelMap> GetDisplaySnapshotWithOption(const CaptureOption& captureOption,
217         DmErrorCode* errorCode) override;
218     sptr<DisplayInfo> GetPrimaryDisplayInfo() override;
219     ScreenCombination GetScreenCombination(ScreenId screenId) override;
220     DMError SetScreenSkipProtectedWindow(const std::vector<ScreenId>& screenIds, bool isEnable) override;
221     bool GetIsRealScreen(ScreenId screenId) override;
222 
223 private:
224     static inline BrokerDelegator<ScreenSessionManagerProxy> delegator_;
225 };
226 
227 } // namespace Rosen
228 } // namespace OHOS
229 
230 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H
231