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