• 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     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, bool isCaptureFullOfScreen) override;
118     virtual std::vector<std::shared_ptr<Media::PixelMap>> GetDisplayHDRSnapshot(DisplayId displayId,
119         DmErrorCode& errorCode, bool isUseDma, bool isCaptureFullOfScreen) override;
120     virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) override;
121 
122     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override;
123     virtual sptr<DisplayInfo> GetVisibleAreaDisplayInfoById(DisplayId displayId) override;
124     virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override;
125     virtual std::vector<DisplayId> GetAllDisplayIds() override;
126 
127     virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override;
128 
129     virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override;
130 
131     virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId,
132         std::vector<ScreenColorGamut>& colorGamuts) override;
133 
134     virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) override;
135     virtual DMError SetScreenRotationLocked(bool isLocked) override;
136     virtual DMError SetScreenRotationLockedFromJs(bool isLocked) override;
137     virtual DMError IsScreenRotationLocked(bool& isLocked) override;
138     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override;
139     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId, int32_t width,
140                                            int32_t height, Rotation rotation) override;
141     virtual DMError HasImmersiveWindow(ScreenId screenId, bool& immersive) override;
142 
143     virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override;
144     virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override;
145     virtual void UpdateDisplayHookInfo(int32_t uid, bool enable, const DMHookInfo& hookInfo) override;
146     void GetDisplayHookInfo(int32_t uid, DMHookInfo& hookInfo) override;
147 
148     virtual void DumpAllScreensInfo(std::string& dumpInfo) override;
149     virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) override;
150     //Fold Screen
151     void SetFoldDisplayMode(const FoldDisplayMode displayMode) override;
152     void SetFoldDisplayModeAsync(const FoldDisplayMode displayMode) override;
153     DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode, std::string reason = "") override;
154 
155     void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY,
156         float pivotX, float pivotY) override;
157 
158     void SetFoldStatusLocked(bool locked) override;
159     DMError SetFoldStatusLockedFromJs(bool locked) override;
160     void SetFoldStatusExpandAndLocked(bool locked) override;
161 
162     FoldDisplayMode GetFoldDisplayMode() override;
163     DMError GetPhysicalScreenIds(std::vector<ScreenId>& screenIds) override;
164 
165     bool IsFoldable() override;
166     bool IsCaptured() override;
167 
168     FoldStatus GetFoldStatus() override;
169     SuperFoldStatus GetSuperFoldStatus() override;
170     float GetSuperRotation() override;
171     void SetLandscapeLockStatus(bool isLocked) override;
172     ExtendScreenConnectStatus GetExtendScreenConnectStatus() override;
173     sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override;
174     DMError GetLiveCreaseRegion(FoldCreaseRegion& region) override;
175     void SetForceCloseHdr(ScreenId screenId, bool isForceCloseHdr) override;
176 
177     void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) override;
178 
179     // unique screen
180     DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds, std::vector<DisplayId>& displayIds) override;
181 
182     void SetClient(const sptr<IScreenSessionManagerClient>& client) override;
183     ScreenProperty GetScreenProperty(ScreenId screenId) override;
184     std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override;
185     void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
186         ScreenPropertyChangeType screenPropertyChangeType, bool isSwitchUser) override;
187     void UpdateScreenDirectionInfo(ScreenId screenId, const ScreenDirectionInfo& directionInfo,
188         ScreenPropertyChangeType screenPropertyChangeType, const RRect& bounds) override;
189     void UpdateAvailableArea(ScreenId ScreenId, DMRect area) override;
190     void UpdateSuperFoldAvailableArea(ScreenId screenId, DMRect bArea, DMRect cArea) override;
191     void UpdateSuperFoldExpandAvailableArea(ScreenId screenId, DMRect area) override;
192     int32_t SetScreenOffDelayTime(int32_t delay) override;
193     int32_t SetScreenOnDelayTime(int32_t delay) override;
194     uint32_t GetCurvedCompressionArea() override;
195     ScreenProperty GetPhyScreenProperty(ScreenId screenId) override;
196     void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) override;
197     void SetScreenPrivacyState(bool hasPrivate) override;
198     void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) override;
199     void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) override;
200     virtual DMError GetAvailableArea(DisplayId displayId, DMRect& area) override;
201     virtual DMError GetExpandAvailableArea(DisplayId displayId, DMRect& area) override;
202     void NotifyFoldToExpandCompletion(bool foldToExpand) override;
203     void NotifyScreenConnectCompletion(ScreenId screenId) override;
204     void RecordEventFromScb(std::string description, bool needRecordEvent) override;
205     void SwitchUser() override;
206 
207     VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId) override;
208     DMError SetVirtualScreenFlag(ScreenId screenId, VirtualScreenFlag screenFlag) override;
209     DeviceScreenConfig GetDeviceScreenConfig() override;
210     DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override;
211     void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList,
212         std::vector<uint64_t> surfaceIdList = {}, std::vector<uint8_t> typeBlackList = {}) override;
213     void SetVirtualDisplayMuteFlag(ScreenId screenId, bool muteFlag) override;
214     void DisablePowerOffRenderControl(ScreenId screenId) override;
215     DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override;
216     DMError ResetAllFreezeStatus() override;
217     std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override;
218     DMError GetDisplayCapability(std::string& capabilitInfo) override;
219     bool SetVirtualScreenStatus(ScreenId screenId, VirtualScreenStatus screenStatus) override;
220     DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid,
221         std::vector<uint64_t>& windowIdList) override;
222     DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate,
223         uint32_t& actualRefreshRate) override;
224     std::shared_ptr<Media::PixelMap> GetScreenCapture(const CaptureOption& captureOption,
225         DmErrorCode* errorCode = nullptr) override;
226     std::shared_ptr<Media::PixelMap> GetDisplaySnapshotWithOption(const CaptureOption& captureOption,
227         DmErrorCode* errorCode) override;
228     std::vector<std::shared_ptr<Media::PixelMap>> GetDisplayHDRSnapshotWithOption(const CaptureOption& captureOption,
229         DmErrorCode& errorCode) override;
230     sptr<DisplayInfo> GetPrimaryDisplayInfo() override;
231     ScreenCombination GetScreenCombination(ScreenId screenId) override;
232     DMError SetScreenSkipProtectedWindow(const std::vector<ScreenId>& screenIds, bool isEnable) override;
233     bool GetIsRealScreen(ScreenId screenId) override;
234     void SetDefaultMultiScreenModeWhenSwitchUser() override;
235     void NotifyExtendScreenCreateFinish() override;
236     void NotifyExtendScreenDestroyFinish() override;
237     void NotifyScreenMaskAppear() override;
238     DMError GetScreenAreaOfDisplayArea(DisplayId displayId, const DMRect& displayArea,
239         ScreenId& screenId, DMRect& screenArea) override;
240     DMError SetPrimaryDisplaySystemDpi(float dpi) override;
241     DMError SetVirtualScreenAutoRotation(ScreenId screenId, bool enable) override;
242     DMError SetScreenPrivacyWindowTagSwitch(ScreenId screenId, const std::vector<std::string>& privacyWindowTag,
243         bool enable) override;
244 
245 private:
246     static inline BrokerDelegator<ScreenSessionManagerProxy> delegator_;
247 };
248 
249 } // namespace Rosen
250 } // namespace OHOS
251 
252 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H
253