1 /* 2 * Copyright (c) 2021-2022 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 FOUNDATION_DMSERVER_DISPLAY_MANAGER_PROXY_H 17 #define FOUNDATION_DMSERVER_DISPLAY_MANAGER_PROXY_H 18 19 #include "display_manager_interface.h" 20 21 #include "dm_common.h" 22 23 #include "screen.h" 24 25 #include <iremote_proxy.h> 26 27 namespace OHOS::Rosen { 28 class DisplayManagerProxy : public IRemoteProxy<IDisplayManager> { 29 public: DisplayManagerProxy(const sptr<IRemoteObject> & impl)30 explicit DisplayManagerProxy(const sptr<IRemoteObject> &impl) 31 : IRemoteProxy<IDisplayManager>(impl) {}; ~DisplayManagerProxy()32 ~DisplayManagerProxy() {}; 33 34 sptr<DisplayInfo> GetDefaultDisplayInfo() override; 35 sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override; 36 sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override; 37 DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override; 38 39 ScreenId CreateVirtualScreen(VirtualScreenOption option, 40 const sptr<IRemoteObject>& displayManagerAgent) override; 41 DMError DestroyVirtualScreen(ScreenId screenId) override; 42 DMError SetVirtualScreenSurface(ScreenId screenId, sptr<IBufferProducer> surface) override; 43 DMError SetOrientation(ScreenId screenId, Orientation orientation) override; 44 std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, 45 DmErrorCode* errorCode = nullptr, bool isUseDma = false) override; 46 DMError IsScreenRotationLocked(bool& isLocked) override; 47 DMError SetScreenRotationLocked(bool isLocked) override; 48 DMError SetScreenRotationLockedFromJs(bool isLocked) override; 49 50 // colorspace, gamut 51 DMError GetScreenSupportedColorGamuts(ScreenId screenId, std::vector<ScreenColorGamut>& colorGamuts) override; 52 DMError GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut) override; 53 DMError SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx) override; 54 DMError GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap) override; 55 DMError SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap) override; 56 DMError SetScreenColorTransform(ScreenId screenId) override; 57 58 DMError GetPixelFormat(ScreenId screenId, GraphicPixelFormat& pixelFormat) override; 59 DMError SetPixelFormat(ScreenId screenId, GraphicPixelFormat pixelFormat) override; 60 DMError GetSupportedHDRFormats(ScreenId screenId, std::vector<ScreenHDRFormat>& hdrFormats) override; 61 DMError GetScreenHDRFormat(ScreenId screenId, ScreenHDRFormat& hdrFormat) override; 62 DMError SetScreenHDRFormat(ScreenId screenId, int32_t modeIdx) override; 63 DMError GetSupportedColorSpaces(ScreenId screenId, std::vector<GraphicCM_ColorSpaceType>& colorSpaces) override; 64 DMError GetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType& colorSpace) override; 65 DMError SetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType colorSpace) override; 66 67 DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent, 68 DisplayManagerAgentType type) override; 69 DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent, 70 DisplayManagerAgentType type) override; 71 bool WakeUpBegin(PowerStateChangeReason reason) override; 72 bool WakeUpEnd() override; 73 bool SuspendBegin(PowerStateChangeReason reason) override; 74 bool SuspendEnd() override; 75 bool SetSpecifiedScreenPower(ScreenId screenId, ScreenPowerState state, PowerStateChangeReason reason) override; 76 bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) override; 77 ScreenPowerState GetScreenPower(ScreenId dmsScreenId) override; 78 bool SetDisplayState(DisplayState state) override; 79 bool TryToCancelScreenOff() override; 80 std::vector<DisplayId> GetAllDisplayIds() override; 81 DisplayState GetDisplayState(DisplayId displayId) override; 82 sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override; 83 void NotifyDisplayEvent(DisplayEvent event) override; 84 bool SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze) override; 85 DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId, ScreenId& screenGroupId) override; 86 DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override; 87 sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override; 88 sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override; 89 DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screens) override; 90 DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint, ScreenId& screenGroupId) override; 91 DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override; 92 void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override; 93 DMError SetScreenActiveMode(ScreenId screenId, uint32_t modeId) override; 94 DMError SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio) override; 95 DMError SetResolution(ScreenId screenId, uint32_t width, uint32_t height, float virtualPixelRatio) override; 96 DMError GetDensityInCurResolution(ScreenId screenId, float& virtualPixelRatio) override; 97 DMError AddSurfaceNodeToDisplay(DisplayId displayId, 98 std::shared_ptr<class RSSurfaceNode>& surfaceNode, bool onTop = true) override; 99 DMError RemoveSurfaceNodeFromDisplay(DisplayId displayId, 100 std::shared_ptr<class RSSurfaceNode>& surfaceNode) override; 101 DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height) override; 102 DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds) override; 103 std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override; 104 private: 105 static inline BrokerDelegator<DisplayManagerProxy> delegator_; 106 }; 107 } // namespace OHOS::Rosen 108 109 #endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_PROXY_H