• 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_INTERFACE_H
17 #define FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_H
18 
19 #include <iremote_broker.h>
20 #include <pixel_map.h>
21 #include <surface.h>
22 
23 #include "dm_common.h"
24 #include "screen.h"
25 #include "display_info.h"
26 #include "screen_info.h"
27 #include "screen_group_info.h"
28 #include "zidl/display_manager_agent_interface.h"
29 
30 namespace OHOS::Rosen {
31 class IDisplayManager : public IRemoteBroker {
32 public:
33     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IDisplayManager");
34 
35     enum {
36         TRANS_ID_GET_DEFAULT_DISPLAY_ID = 0,
37         TRANS_ID_GET_DISPLAY_BY_ID,
38         TRANS_ID_GET_DISPLAY_BY_SCREEN,
39         TRANS_ID_GET_DISPLAY_SNAPSHOT,
40         TRANS_ID_REGISTER_DISPLAY_MANAGER_AGENT,
41         TRANS_ID_UNREGISTER_DISPLAY_MANAGER_AGENT,
42         TRANS_ID_WAKE_UP_BEGIN,
43         TRANS_ID_WAKE_UP_END,
44         TRANS_ID_SUSPEND_BEGIN,
45         TRANS_ID_SUSPEND_END,
46         TRANS_ID_SET_SCREEN_POWER_FOR_ALL,
47         TRANS_ID_GET_SCREEN_POWER,
48         TRANS_ID_SET_DISPLAY_STATE,
49         TRANS_ID_GET_DISPLAY_STATE,
50         TRANS_ID_GET_ALL_DISPLAYIDS,
51         TRANS_ID_NOTIFY_DISPLAY_EVENT,
52         TRANS_ID_SET_FREEZE_EVENT,
53         TRANS_ID_SCREEN_BASE = 1000,
54         TRANS_ID_CREATE_VIRTUAL_SCREEN = TRANS_ID_SCREEN_BASE,
55         TRANS_ID_DESTROY_VIRTUAL_SCREEN,
56         TRANS_ID_SET_VIRTUAL_SCREEN_SURFACE,
57         TRANS_ID_GET_SCREEN_INFO_BY_ID,
58         TRANS_ID_GET_SCREEN_GROUP_INFO_BY_ID,
59         TRANS_ID_SET_SCREEN_ACTIVE_MODE,
60         TRANS_ID_GET_ALL_SCREEN_INFOS,
61         TRANS_ID_SET_ORIENTATION,
62         TRANS_ID_SCREENGROUP_BASE = 1100,
63         TRANS_ID_SCREEN_MAKE_MIRROR = TRANS_ID_SCREENGROUP_BASE,
64         TRANS_ID_SCREEN_MAKE_EXPAND,
65         TRANS_ID_REMOVE_VIRTUAL_SCREEN_FROM_SCREEN_GROUP,
66         TRANS_ID_SCREEN_GAMUT_BASE = 1200,
67         TRANS_ID_SCREEN_GET_SUPPORTED_COLOR_GAMUTS = TRANS_ID_SCREEN_GAMUT_BASE,
68         TRANS_ID_SCREEN_GET_COLOR_GAMUT,
69         TRANS_ID_SCREEN_SET_COLOR_GAMUT,
70         TRANS_ID_SCREEN_GET_GAMUT_MAP,
71         TRANS_ID_SCREEN_SET_GAMUT_MAP,
72         TRANS_ID_SCREEN_SET_COLOR_TRANSFORM,
73     };
74 
75     virtual DisplayId GetDefaultDisplayId() = 0;
76     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) = 0;
77     virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) = 0;
78 
79     virtual ScreenId CreateVirtualScreen(VirtualScreenOption option) = 0;
80     virtual DMError DestroyVirtualScreen(ScreenId screenId) = 0;
81     virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface) = 0;
82     virtual bool SetOrientation(ScreenId screenId, Orientation orientation) = 0;
83     virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId) = 0;
84 
85     // colorspace, gamut
86     virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId, std::vector<ScreenColorGamut>& colorGamuts) = 0;
87     virtual DMError GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut) = 0;
88     virtual DMError SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx) = 0;
89     virtual DMError GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap) = 0;
90     virtual DMError SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap) = 0;
91     virtual DMError SetScreenColorTransform(ScreenId screenId) = 0;
92 
93     virtual bool RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
94         DisplayManagerAgentType type) = 0;
95     virtual bool UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
96         DisplayManagerAgentType type) = 0;
97     virtual bool WakeUpBegin(PowerStateChangeReason reason) = 0;
98     virtual bool WakeUpEnd() = 0;
99     virtual bool SuspendBegin(PowerStateChangeReason reason) = 0;
100     virtual bool SuspendEnd() = 0;
101     virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) = 0;
102     virtual ScreenPowerState GetScreenPower(ScreenId dmsScreenId) = 0;
103     virtual bool SetDisplayState(DisplayState state) = 0;
104     virtual DisplayState GetDisplayState(DisplayId displayId) = 0;
105     virtual std::vector<DisplayId> GetAllDisplayIds() = 0;
106     virtual void NotifyDisplayEvent(DisplayEvent event) = 0;
107     virtual bool SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze) = 0;
108     virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) = 0;
109     virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) = 0;
110     virtual std::vector<sptr<ScreenInfo>> GetAllScreenInfos() = 0;
111     virtual ScreenId MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId) = 0;
112     virtual ScreenId MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint) = 0;
113     virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) = 0;
114     virtual bool SetScreenActiveMode(ScreenId screenId, uint32_t modeId) = 0;
115 };
116 } // namespace OHOS::Rosen
117 
118 #endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_H