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 RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent, 58 DisplayManagerAgentType type) override; 59 DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent, 60 DisplayManagerAgentType type) override; 61 bool WakeUpBegin(PowerStateChangeReason reason) override; 62 bool WakeUpEnd() override; 63 bool SuspendBegin(PowerStateChangeReason reason) override; 64 bool SuspendEnd() override; 65 bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) override; 66 ScreenPowerState GetScreenPower(ScreenId dmsScreenId) override; 67 bool SetDisplayState(DisplayState state) override; 68 std::vector<DisplayId> GetAllDisplayIds() override; 69 DisplayState GetDisplayState(DisplayId displayId) override; 70 sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override; 71 void NotifyDisplayEvent(DisplayEvent event) override; 72 bool SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze) override; 73 DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId, ScreenId& screenGroupId) override; 74 DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override; 75 sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override; 76 sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override; 77 DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screens) override; 78 DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint, ScreenId& screenGroupId) override; 79 DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override; 80 void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override; 81 DMError SetScreenActiveMode(ScreenId screenId, uint32_t modeId) override; 82 DMError SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio) override; 83 DMError AddSurfaceNodeToDisplay(DisplayId displayId, 84 std::shared_ptr<class RSSurfaceNode>& surfaceNode, bool onTop = true) override; 85 DMError RemoveSurfaceNodeFromDisplay(DisplayId displayId, 86 std::shared_ptr<class RSSurfaceNode>& surfaceNode) override; 87 88 private: 89 static inline BrokerDelegator<DisplayManagerProxy> delegator_; 90 }; 91 } // namespace OHOS::Rosen 92 93 #endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_PROXY_H