• 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 bool SetDisplayState(DisplayState state) override;
69     virtual DisplayState GetDisplayState(DisplayId displayId) override;
70     virtual bool TryToCancelScreenOff() override;
71     virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
72         const sptr<IRemoteObject>& displayManagerAgent) override;
73 
74     virtual DMError DestroyVirtualScreen(ScreenId screenId) override;
75 
76     virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<IBufferProducer> surface) override;
77 
78     virtual DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height) override;
79 
80     virtual DMError SetVirtualMirrorScreenCanvasRotation(ScreenId screenId, bool autoRotate) override;
81 
82     virtual DMError SetVirtualMirrorScreenScaleMode(ScreenId screenId, ScreenScaleMode scaleMode) override;
83 
84     virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
85         ScreenId& screenGroupId) override;
86     virtual DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override;
87     DMError DisableMirror(bool disableOrNot) override;
88 
89     virtual DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint,
90                                ScreenId& screenGroupId) override;
91     virtual DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override;
92 
93     virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override;
94 
95     virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override;
96 
97     virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, DmErrorCode* errorCode) override;
98     virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) override;
99 
100     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override;
101     virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override;
102     virtual std::vector<DisplayId> GetAllDisplayIds() override;
103 
104     virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override;
105 
106     virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override;
107 
108     virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId,
109         std::vector<ScreenColorGamut>& colorGamuts) override;
110 
111     virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) override;
112     virtual DMError SetScreenRotationLocked(bool isLocked) override;
113     virtual DMError SetScreenRotationLockedFromJs(bool isLocked) override;
114     virtual DMError IsScreenRotationLocked(bool& isLocked) override;
115     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override;
116     virtual DMError HasImmersiveWindow(bool& immersive) override;
117 
118     virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override;
119     virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override;
120     virtual void UpdateDisplayHookInfo(int32_t uid, bool enable, const DMHookInfo& hookInfo) override;
121 
122     virtual void DumpAllScreensInfo(std::string& dumpInfo) override;
123     virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) override;
124     //Fold Screen
125     void SetFoldDisplayMode(const FoldDisplayMode displayMode) override;
126     DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode) override;
127 
128     void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY,
129         float pivotX, float pivotY) override;
130 
131     void SetFoldStatusLocked(bool locked) override;
132     DMError SetFoldStatusLockedFromJs(bool locked) override;
133 
134     FoldDisplayMode GetFoldDisplayMode() override;
135 
136     bool IsFoldable() override;
137     bool IsCaptured() override;
138 
139     FoldStatus GetFoldStatus() override;
140 
141     sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override;
142 
143     // unique screen
144     DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds) override;
145 
146     void SetClient(const sptr<IScreenSessionManagerClient>& client) override;
147     ScreenProperty GetScreenProperty(ScreenId screenId) override;
148     std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override;
149     void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
150         ScreenPropertyChangeType screenPropertyChangeType) override;
151     void UpdateAvailableArea(ScreenId ScreenId, DMRect area) override;
152     int32_t SetScreenOffDelayTime(int32_t delay) override;
153     uint32_t GetCurvedCompressionArea() override;
154     ScreenProperty GetPhyScreenProperty(ScreenId screenId) override;
155     void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) override;
156     void SetScreenPrivacyState(bool hasPrivate) override;
157     void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) override;
158     void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) override;
159     virtual DMError GetAvailableArea(DisplayId displayId, DMRect& area) override;
160     void NotifyFoldToExpandCompletion(bool foldToExpand) override;
161     void SwitchUser() override;
162     VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId) override;
163     DMError SetVirtualScreenFlag(ScreenId screenId, VirtualScreenFlag screenFlag) override;
164     DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override;
165     DeviceScreenConfig GetDeviceScreenConfig() override;
166     DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override;
167     DMError ResetAllFreezeStatus() override;
168     void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList) override;
169     void DisablePowerOffRenderControl(ScreenId screenId) override;
170     std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override;
171     DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid,
172         std::vector<uint64_t>& windowIdList) override;
173 private:
174     static inline BrokerDelegator<ScreenSessionManagerProxy> delegator_;
175 };
176 
177 } // namespace Rosen
178 } // namespace OHOS
179 
180 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H