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; } GetScreenPower()93 virtual ScreenPowerState GetScreenPower() override { return ScreenPowerState::INVALID_STATE; } SetDisplayState(DisplayState state)94 virtual bool SetDisplayState(DisplayState state) override { return false; } GetDisplayState(DisplayId displayId)95 virtual DisplayState GetDisplayState(DisplayId displayId) override {return DisplayState::UNKNOWN; } TryToCancelScreenOff()96 virtual bool TryToCancelScreenOff() override { return false; } SetScreenBrightness(uint64_t screenId,uint32_t level)97 virtual bool SetScreenBrightness(uint64_t screenId, uint32_t level) override { return false; } GetScreenBrightness(uint64_t screenId)98 virtual uint32_t GetScreenBrightness(uint64_t screenId) override { return 0; } GetAllDisplayIds()99 virtual std::vector<DisplayId> GetAllDisplayIds() override { return std::vector<DisplayId>{}; } GetCutoutInfo(DisplayId displayId)100 virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override { return nullptr; } NotifyDisplayEvent(DisplayEvent event)101 virtual void NotifyDisplayEvent(DisplayEvent event) override {} SetFreeze(std::vector<DisplayId> displayIds,bool isFreeze)102 virtual bool SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze) override { return false; } GetScreenInfoById(ScreenId screenId)103 virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override { return nullptr; } GetScreenGroupInfoById(ScreenId screenId)104 virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override { return nullptr; } GetAllScreenInfos(std::vector<sptr<ScreenInfo>> & screenInfos)105 virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override { return DMError::DM_OK; } MakeMirror(ScreenId mainScreenId,std::vector<ScreenId> mirrorScreenIds,ScreenId & screenGroupId)106 virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds, 107 ScreenId& screenGroupId) override { return DMError::DM_OK; } MakeMirror(ScreenId mainScreenId,std::vector<ScreenId> mirrorScreenIds,DMRect mainScreenRegion,ScreenId & screenGroupId)108 virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds, 109 DMRect mainScreenRegion, ScreenId& screenGroupId) override { return DMError::DM_OK; } MakeExpand(std::vector<ScreenId> screenId,std::vector<Point> startPoints,ScreenId & screenGroupId)110 virtual DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoints, 111 ScreenId& screenGroupId) override { return DMError::DM_OK; } StopMirror(const std::vector<ScreenId> & mirrorScreenIds)112 virtual DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override { return DMError::DM_OK; } StopExpand(const std::vector<ScreenId> & expandScreenIds)113 virtual DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override { return DMError::DM_OK; } RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens)114 virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override {} SetScreenActiveMode(ScreenId screenId,uint32_t modeId)115 virtual DMError SetScreenActiveMode(ScreenId screenId, uint32_t modeId) override { return DMError::DM_OK; } SetVirtualPixelRatio(ScreenId screenId,float virtualPixelRatio)116 virtual DMError SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio) override { return DMError::DM_OK; } SetVirtualPixelRatioSystem(ScreenId screenId,float virtualPixelRatio)117 virtual DMError SetVirtualPixelRatioSystem(ScreenId screenId, float virtualPixelRatio) override 118 { 119 return DMError::DM_OK; 120 } SetResolution(ScreenId screenId,uint32_t width,uint32_t height,float virtualPixelRatio)121 virtual DMError SetResolution(ScreenId screenId, uint32_t width, uint32_t height, 122 float virtualPixelRatio) override { return DMError::DM_OK; } GetDensityInCurResolution(ScreenId screenId,float & virtualPixelRatio)123 virtual DMError GetDensityInCurResolution(ScreenId screenId, 124 float& virtualPixelRatio) override { return DMError::DM_OK; } ResizeVirtualScreen(ScreenId screenId,uint32_t width,uint32_t height)125 virtual DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, 126 uint32_t height) override { return DMError::DM_OK; } 127 virtual DMError AddSurfaceNodeToDisplay(DisplayId displayId, 128 std::shared_ptr<class RSSurfaceNode>& surfaceNode, bool onTop = true) override { return DMError::DM_OK; } RemoveSurfaceNodeFromDisplay(DisplayId displayId,std::shared_ptr<class RSSurfaceNode> & surfaceNode)129 virtual DMError RemoveSurfaceNodeFromDisplay(DisplayId displayId, 130 std::shared_ptr<class RSSurfaceNode>& surfaceNode) override { return DMError::DM_OK; } DumpAllScreensInfo(std::string & dumpInfo)131 virtual void DumpAllScreensInfo(std::string& dumpInfo) {} DumpSpecialScreenInfo(ScreenId id,std::string & dumpInfo)132 virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) {} 133 // Fold Screen SetFoldDisplayMode(const FoldDisplayMode displayMode)134 void SetFoldDisplayMode(const FoldDisplayMode displayMode) override {} 135 DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode, 136 std::string reason = "") override { return DMError::DM_OK; } 137 SetDisplayScale(ScreenId screenId,float scaleX,float scaleY,float pivotX,float pivotY)138 void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY, float pivotX, float pivotY) override {} 139 SetFoldStatusLocked(bool locked)140 void SetFoldStatusLocked(bool locked) override {} SetFoldStatusLockedFromJs(bool locked)141 DMError SetFoldStatusLockedFromJs(bool locked) override { return DMError::DM_OK; } 142 GetFoldDisplayMode()143 FoldDisplayMode GetFoldDisplayMode() override { return FoldDisplayMode::UNKNOWN; } 144 IsFoldable()145 bool IsFoldable() override { return false; }; IsCaptured()146 bool IsCaptured() override { return false; }; 147 GetFoldStatus()148 FoldStatus GetFoldStatus() override { return FoldStatus::UNKNOWN; }; 149 GetCurrentFoldCreaseRegion()150 sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override { return nullptr; }; 151 MakeUniqueScreen(const std::vector<ScreenId> & screenIds)152 virtual DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds) override { return DMError::DM_OK; }; 153 SetClient(const sptr<IScreenSessionManagerClient> & client)154 virtual void SetClient(const sptr<IScreenSessionManagerClient>& client) {} SwitchUser()155 virtual void SwitchUser() {} GetScreenProperty(ScreenId screenId)156 virtual ScreenProperty GetScreenProperty(ScreenId screenId) { return ScreenProperty(); } GetDisplayNode(ScreenId screenId)157 virtual std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) { return nullptr; } UpdateScreenRotationProperty(ScreenId screenId,const RRectT<float> & bounds,float rotation,ScreenPropertyChangeType screenPropertyChangeType)158 virtual void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation, 159 ScreenPropertyChangeType screenPropertyChangeType) {} UpdateScreenDirectionInfo(ScreenId screenId,float screenComponentRotation,float rotation,float phyRotation,ScreenPropertyChangeType screenPropertyChangeType)160 virtual void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation, 161 float phyRotation, ScreenPropertyChangeType screenPropertyChangeType) {} UpdateAvailableArea(ScreenId screenId,DMRect area)162 virtual void UpdateAvailableArea(ScreenId screenId, DMRect area) {} SetScreenOffDelayTime(int32_t delay)163 virtual int32_t SetScreenOffDelayTime(int32_t delay) { return 0; } SetCameraStatus(int32_t cameraStatus,int32_t cameraPosition)164 virtual void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) {} GetCurvedCompressionArea()165 virtual uint32_t GetCurvedCompressionArea() { return 0; } GetPhyScreenProperty(ScreenId screenId)166 virtual ScreenProperty GetPhyScreenProperty(ScreenId screenId) { return ScreenProperty(); } NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo> & info)167 virtual void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) {} SetScreenPrivacyState(bool hasPrivate)168 virtual void SetScreenPrivacyState(bool hasPrivate) {} SetPrivacyStateByDisplayId(DisplayId id,bool hasPrivate)169 virtual void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) {} SetScreenPrivacyWindowList(DisplayId id,std::vector<std::string> privacyWindowList)170 virtual void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) {} NotifyFoldToExpandCompletion(bool foldToExpand)171 virtual void NotifyFoldToExpandCompletion(bool foldToExpand) {} RecordEventFromScb(std::string description,bool needRecordEvent)172 virtual void RecordEventFromScb(std::string description, bool needRecordEvent) {} SetVirtualScreenMaxRefreshRate(ScreenId id,uint32_t refreshRate,uint32_t & actualRefreshRate)173 virtual DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate, 174 uint32_t& actualRefreshRate) override { return DMError::DM_OK; } SetVirtualScreenRefreshRate(ScreenId screenId,uint32_t refreshInterval)175 DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override 176 { 177 return DMError::DM_OK; 178 } ProxyForFreeze(const std::set<int32_t> & pidList,bool isProxy)179 virtual DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override 180 { 181 return DMError::DM_OK; 182 } ResetAllFreezeStatus()183 virtual DMError ResetAllFreezeStatus() override 184 { 185 return DMError::DM_OK; 186 } GetDeviceScreenConfig()187 virtual DeviceScreenConfig GetDeviceScreenConfig() { return {}; } 188 virtual void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList, 189 std::vector<uint64_t> surfaceIdList = {}) override {} DisablePowerOffRenderControl(ScreenId screenId)190 virtual void DisablePowerOffRenderControl(ScreenId screenId) override {} 191 GetAllDisplayPhysicalResolution()192 virtual std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override 193 { 194 return std::vector<DisplayPhysicalResolution> {}; 195 } GetDisplayCapability()196 virtual std::string GetDisplayCapability() override 197 { 198 return std::string {}; 199 } SetVirtualScreenSecurityExemption(ScreenId screenId,uint32_t pid,std::vector<uint64_t> & windowIdList)200 virtual DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid, 201 std::vector<uint64_t>& windowIdList) override 202 { 203 return DMError::DM_ERROR_DEVICE_NOT_SUPPORT; 204 } 205 virtual std::shared_ptr<Media::PixelMap> GetScreenCapture(const CaptureOption& captureOption, 206 DmErrorCode* errorCode = nullptr) override 207 { 208 *errorCode = DmErrorCode::DM_ERROR_DEVICE_NOT_SUPPORT; 209 return nullptr; 210 } GetScreenCombination(ScreenId screenId)211 virtual ScreenCombination GetScreenCombination(ScreenId screenId) { return ScreenCombination::SCREEN_ALONE; } 212 }; 213 } // namespace Rosen 214 } // namespace OHOS 215 216 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_INTERFACE_H 217