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