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_INTERFACE_H
17 #define OHOS_ROSEN_SCREEN_SESSION_MANAGER_INTERFACE_H
18 
19 #include <ui/rs_display_node.h>
20 
21 #include "display_manager_interface.h"
22 #include "dm_common.h"
23 #include "interfaces/include/ws_common.h"
24 #include "session/screen/include/screen_property.h"
25 #include "zidl/screen_session_manager_client_interface.h"
26 
27 namespace OHOS {
28 namespace Rosen {
29 template<typename T>
30 class RRectT;
31 
32 class IScreenSessionManager : public IDisplayManager {
33 public:
34     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IScreenSessionManager");
35 
GetDefaultDisplayInfo()36     virtual sptr<DisplayInfo> GetDefaultDisplayInfo() override { return nullptr; }
GetDisplayInfoById(DisplayId displayId)37     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override { return nullptr; }
GetDisplayInfoByScreen(ScreenId screenId)38     virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override {return nullptr; }
HasPrivateWindow(DisplayId displayId,bool & hasPrivateWindow)39     virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override { return DMError::DM_OK; }
ConvertScreenIdToRsScreenId(ScreenId screenId,ScreenId & rsScreenId)40     virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override { return true; }
UpdateDisplayHookInfo(int32_t uid,bool enable,const DMHookInfo & hookInfo)41     virtual void UpdateDisplayHookInfo(int32_t uid, bool enable, const DMHookInfo& hookInfo) override {};
42 
CreateVirtualScreen(VirtualScreenOption option,const sptr<IRemoteObject> & displayManagerAgent)43     virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
44         const sptr<IRemoteObject>& displayManagerAgent) override { return -1; }
DestroyVirtualScreen(ScreenId screenId)45     virtual DMError DestroyVirtualScreen(ScreenId screenId) override { return DMError::DM_OK; }
SetVirtualScreenSurface(ScreenId screenId,sptr<IBufferProducer> surface)46     virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<IBufferProducer> surface) override
47     {
48         return DMError::DM_OK;
49     }
SetVirtualMirrorScreenCanvasRotation(ScreenId screenId,bool autoRotate)50     virtual DMError SetVirtualMirrorScreenCanvasRotation(ScreenId screenId, bool autoRotate) override
51     {
52         return DMError::DM_OK;
53     }
SetOrientation(ScreenId screenId,Orientation orientation)54     virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) override { return DMError::DM_OK; }
55     virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId,
56         DmErrorCode* errorCode = nullptr, bool isUseDma = false) override { return nullptr; }
57     virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect,
58         DmErrorCode* errorCode = nullptr) override
59     {
60         *errorCode = DmErrorCode::DM_ERROR_DEVICE_NOT_SUPPORT;
61         return nullptr;
62     }
SetScreenRotationLocked(bool isLocked)63     virtual DMError SetScreenRotationLocked(bool isLocked) override { return DMError::DM_OK; }
SetScreenRotationLockedFromJs(bool isLocked)64     virtual DMError SetScreenRotationLockedFromJs(bool isLocked) override { return DMError::DM_OK; }
IsScreenRotationLocked(bool & isLocked)65     virtual DMError IsScreenRotationLocked(bool& isLocked) override { return DMError::DM_OK; }
66 
67     // colorspace, gamut
GetScreenSupportedColorGamuts(ScreenId screenId,std::vector<ScreenColorGamut> & colorGamuts)68     virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId,
69         std::vector<ScreenColorGamut>& colorGamuts) override
70     {
71         return DMError::DM_OK;
72     }
GetScreenColorGamut(ScreenId screenId,ScreenColorGamut & colorGamut)73     virtual DMError GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut) override
74     {
75         return DMError::DM_OK;
76     }
SetScreenColorGamut(ScreenId screenId,int32_t colorGamutIdx)77     virtual DMError SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx) override { return DMError::DM_OK; }
GetScreenGamutMap(ScreenId screenId,ScreenGamutMap & gamutMap)78     virtual DMError GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap) override { return DMError::DM_OK; }
SetScreenGamutMap(ScreenId screenId,ScreenGamutMap gamutMap)79     virtual DMError SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap) override { return DMError::DM_OK; }
SetScreenColorTransform(ScreenId screenId)80     virtual DMError SetScreenColorTransform(ScreenId screenId) override { return DMError::DM_OK; }
81 
RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent> & displayManagerAgent,DisplayManagerAgentType type)82     virtual DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
83         DisplayManagerAgentType type) override { return DMError::DM_OK; }
UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent> & displayManagerAgent,DisplayManagerAgentType type)84     virtual DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
85         DisplayManagerAgentType type) override { return DMError::DM_OK; }
WakeUpBegin(PowerStateChangeReason reason)86     virtual bool WakeUpBegin(PowerStateChangeReason reason) override { return false; }
WakeUpEnd()87     virtual bool WakeUpEnd() override { return false; }
SuspendBegin(PowerStateChangeReason reason)88     virtual bool SuspendBegin(PowerStateChangeReason reason) override { return false; }
SuspendEnd()89     virtual bool SuspendEnd() override { return false; }
SetSpecifiedScreenPower(ScreenId,ScreenPowerState,PowerStateChangeReason)90     virtual bool SetSpecifiedScreenPower(ScreenId, ScreenPowerState, PowerStateChangeReason) override { return false; }
SetScreenPowerForAll(ScreenPowerState state,PowerStateChangeReason reason)91     virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) override { return false; }
GetScreenPower(ScreenId dmsScreenId)92     virtual ScreenPowerState GetScreenPower(ScreenId dmsScreenId) override { return ScreenPowerState::INVALID_STATE; }
SetDisplayState(DisplayState state)93     virtual bool SetDisplayState(DisplayState state) override { return false; }
GetDisplayState(DisplayId displayId)94     virtual DisplayState GetDisplayState(DisplayId displayId) override {return DisplayState::UNKNOWN; }
TryToCancelScreenOff()95     virtual bool TryToCancelScreenOff() override { return false; }
SetScreenBrightness(uint64_t screenId,uint32_t level)96     virtual bool SetScreenBrightness(uint64_t screenId, uint32_t level) override { return false; }
GetScreenBrightness(uint64_t screenId)97     virtual uint32_t GetScreenBrightness(uint64_t screenId) override { return 0; }
GetAllDisplayIds()98     virtual std::vector<DisplayId> GetAllDisplayIds() override { return std::vector<DisplayId>{}; }
GetCutoutInfo(DisplayId displayId)99     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override { return nullptr; }
NotifyDisplayEvent(DisplayEvent event)100     virtual void NotifyDisplayEvent(DisplayEvent event) override {}
SetFreeze(std::vector<DisplayId> displayIds,bool isFreeze)101     virtual bool SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze) override { return false; }
GetScreenInfoById(ScreenId screenId)102     virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override { return nullptr; }
GetScreenGroupInfoById(ScreenId screenId)103     virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override { return nullptr; }
GetAllScreenInfos(std::vector<sptr<ScreenInfo>> & screenInfos)104     virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override { return DMError::DM_OK; }
MakeMirror(ScreenId mainScreenId,std::vector<ScreenId> mirrorScreenIds,ScreenId & screenGroupId)105     virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds,
106         ScreenId& screenGroupId) override { return DMError::DM_OK; }
MakeExpand(std::vector<ScreenId> screenId,std::vector<Point> startPoints,ScreenId & screenGroupId)107     virtual DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoints,
108         ScreenId& screenGroupId) override { return DMError::DM_OK; }
StopMirror(const std::vector<ScreenId> & mirrorScreenIds)109     virtual DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override { return DMError::DM_OK; }
StopExpand(const std::vector<ScreenId> & expandScreenIds)110     virtual DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override { return DMError::DM_OK; }
RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens)111     virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override {}
SetScreenActiveMode(ScreenId screenId,uint32_t modeId)112     virtual DMError SetScreenActiveMode(ScreenId screenId, uint32_t modeId) override { return DMError::DM_OK; }
SetVirtualPixelRatio(ScreenId screenId,float virtualPixelRatio)113     virtual DMError SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio) override { return DMError::DM_OK; }
SetVirtualPixelRatioSystem(ScreenId screenId,float virtualPixelRatio)114     virtual DMError SetVirtualPixelRatioSystem(ScreenId screenId, float virtualPixelRatio) override
115     {
116         return DMError::DM_OK;
117     }
SetResolution(ScreenId screenId,uint32_t width,uint32_t height,float virtualPixelRatio)118     virtual DMError SetResolution(ScreenId screenId, uint32_t width, uint32_t height,
119         float virtualPixelRatio) override { return DMError::DM_OK; }
GetDensityInCurResolution(ScreenId screenId,float & virtualPixelRatio)120     virtual DMError GetDensityInCurResolution(ScreenId screenId,
121         float& virtualPixelRatio) override { return DMError::DM_OK; }
ResizeVirtualScreen(ScreenId screenId,uint32_t width,uint32_t height)122     virtual DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width,
123         uint32_t height) override { return DMError::DM_OK; }
124     virtual DMError AddSurfaceNodeToDisplay(DisplayId displayId,
125         std::shared_ptr<class RSSurfaceNode>& surfaceNode, bool onTop = true) override { return DMError::DM_OK; }
RemoveSurfaceNodeFromDisplay(DisplayId displayId,std::shared_ptr<class RSSurfaceNode> & surfaceNode)126     virtual DMError RemoveSurfaceNodeFromDisplay(DisplayId displayId,
127         std::shared_ptr<class RSSurfaceNode>& surfaceNode) override { return DMError::DM_OK; }
DumpAllScreensInfo(std::string & dumpInfo)128     virtual void DumpAllScreensInfo(std::string& dumpInfo) {}
DumpSpecialScreenInfo(ScreenId id,std::string & dumpInfo)129     virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) {}
130     // Fold Screen
SetFoldDisplayMode(const FoldDisplayMode displayMode)131     void SetFoldDisplayMode(const FoldDisplayMode displayMode) override {}
SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode)132     DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode) override { return DMError::DM_OK; }
133 
SetDisplayScale(ScreenId screenId,float scaleX,float scaleY,float pivotX,float pivotY)134     void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY, float pivotX, float pivotY) override {}
135 
SetFoldStatusLocked(bool locked)136     void SetFoldStatusLocked(bool locked) override {}
SetFoldStatusLockedFromJs(bool locked)137     DMError SetFoldStatusLockedFromJs(bool locked) override { return DMError::DM_OK; }
138 
GetFoldDisplayMode()139     FoldDisplayMode GetFoldDisplayMode() override { return FoldDisplayMode::UNKNOWN; }
140 
IsFoldable()141     bool IsFoldable() override { return false; };
IsCaptured()142     bool IsCaptured() override { return false; };
143 
GetFoldStatus()144     FoldStatus GetFoldStatus() override { return FoldStatus::UNKNOWN; };
145 
GetCurrentFoldCreaseRegion()146     sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override { return nullptr; };
147 
MakeUniqueScreen(const std::vector<ScreenId> & screenIds)148     virtual DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds) override { return DMError::DM_OK; };
149 
SetClient(const sptr<IScreenSessionManagerClient> & client)150     virtual void SetClient(const sptr<IScreenSessionManagerClient>& client) {}
SwitchUser()151     virtual void SwitchUser() {}
GetScreenProperty(ScreenId screenId)152     virtual ScreenProperty GetScreenProperty(ScreenId screenId) { return ScreenProperty(); }
GetDisplayNode(ScreenId screenId)153     virtual std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) { return nullptr; }
UpdateScreenRotationProperty(ScreenId screenId,const RRectT<float> & bounds,float rotation,ScreenPropertyChangeType screenPropertyChangeType)154     virtual void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation,
155         ScreenPropertyChangeType screenPropertyChangeType) {}
UpdateScreenDirectionInfo(ScreenId screenId,float screenComponentRotation,float rotation,float phyRotation,ScreenPropertyChangeType screenPropertyChangeType)156     virtual void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation,
157         float phyRotation, ScreenPropertyChangeType screenPropertyChangeType) {}
UpdateAvailableArea(ScreenId screenId,DMRect area)158     virtual void UpdateAvailableArea(ScreenId screenId, DMRect area) {}
SetScreenOffDelayTime(int32_t delay)159     virtual int32_t SetScreenOffDelayTime(int32_t delay) { return 0; }
SetCameraStatus(int32_t cameraStatus,int32_t cameraPosition)160     virtual void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) {}
GetCurvedCompressionArea()161     virtual uint32_t GetCurvedCompressionArea() { return 0; }
GetPhyScreenProperty(ScreenId screenId)162     virtual ScreenProperty GetPhyScreenProperty(ScreenId screenId) { return ScreenProperty(); }
NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo> & info)163     virtual void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) {}
SetScreenPrivacyState(bool hasPrivate)164     virtual void SetScreenPrivacyState(bool hasPrivate) {}
SetPrivacyStateByDisplayId(DisplayId id,bool hasPrivate)165     virtual void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) {}
SetScreenPrivacyWindowList(DisplayId id,std::vector<std::string> privacyWindowList)166     virtual void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) {}
NotifyFoldToExpandCompletion(bool foldToExpand)167     virtual void NotifyFoldToExpandCompletion(bool foldToExpand) {}
168 
SetVirtualScreenRefreshRate(ScreenId screenId,uint32_t refreshInterval)169     DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override
170     {
171         return DMError::DM_OK;
172     }
ProxyForFreeze(const std::set<int32_t> & pidList,bool isProxy)173     virtual DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override
174     {
175         return DMError::DM_OK;
176     }
ResetAllFreezeStatus()177     virtual DMError ResetAllFreezeStatus() override
178     {
179         return DMError::DM_OK;
180     }
GetDeviceScreenConfig()181     virtual DeviceScreenConfig GetDeviceScreenConfig() { return {}; }
SetVirtualScreenMaxRefreshRate(ScreenId id,uint32_t refreshRate,uint32_t & actualRefreshRate)182     virtual DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate,
183         uint32_t& actualRefreshRate) override { return DMError::DM_OK; }
SetVirtualScreenBlackList(ScreenId screenId,std::vector<uint64_t> & windowIdList)184     virtual void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList) override {}
DisablePowerOffRenderControl(ScreenId screenId)185     virtual void DisablePowerOffRenderControl(ScreenId screenId) override {}
186 
GetAllDisplayPhysicalResolution()187     virtual std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override
188     {
189         return std::vector<DisplayPhysicalResolution> {};
190     }
SetVirtualScreenSecurityExemption(ScreenId screenId,uint32_t pid,std::vector<uint64_t> & windowIdList)191     virtual DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid,
192         std::vector<uint64_t>& windowIdList) override
193     {
194         return DMError::DM_ERROR_DEVICE_NOT_SUPPORT;
195     }
196     virtual std::shared_ptr<Media::PixelMap> GetScreenCapture(const CaptureOption& captureOption,
197         DmErrorCode* errorCode = nullptr) override
198     {
199         *errorCode = DmErrorCode::DM_ERROR_DEVICE_NOT_SUPPORT;
200         return nullptr;
201     }
202 };
203 } // namespace Rosen
204 } // namespace OHOS
205 
206 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_INTERFACE_H
207