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