1 /* 2 * Copyright (c) 2023 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 OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H 17 #define OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H 18 19 #include "screen_session_manager_interface.h" 20 21 #include "iremote_proxy.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 26 class ScreenSessionManagerProxy : public IRemoteProxy<IScreenSessionManager> { 27 public: ScreenSessionManagerProxy(const sptr<IRemoteObject> & impl)28 explicit ScreenSessionManagerProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy(impl) {} 29 30 ~ScreenSessionManagerProxy() = default; 31 32 virtual sptr<DisplayInfo> GetDefaultDisplayInfo() override; 33 virtual DMError SetScreenActiveMode(ScreenId screenId, uint32_t modeId) override; 34 virtual DMError SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio) override; 35 virtual DMError SetVirtualPixelRatioSystem(ScreenId screenId, float virtualPixelRatio) override; 36 virtual DMError SetResolution(ScreenId screenId, uint32_t width, uint32_t height, float virtualPixelRatio) override; 37 virtual DMError GetDensityInCurResolution(ScreenId screenId, float& virtualPixelRatio) override; 38 39 virtual DMError GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut) override; 40 virtual DMError SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx) override; 41 virtual DMError GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap) override; 42 virtual DMError SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap) override; 43 virtual DMError SetScreenColorTransform(ScreenId screenId) override; 44 45 DMError GetPixelFormat(ScreenId screenId, GraphicPixelFormat& pixelFormat) override; 46 DMError SetPixelFormat(ScreenId screenId, GraphicPixelFormat pixelFormat) override; 47 DMError GetSupportedHDRFormats(ScreenId screenId, std::vector<ScreenHDRFormat>& hdrFormats) override; 48 DMError GetScreenHDRFormat(ScreenId screenId, ScreenHDRFormat& hdrFormat) override; 49 DMError SetScreenHDRFormat(ScreenId screenId, int32_t modeIdx) override; 50 DMError GetSupportedColorSpaces(ScreenId screenId, std::vector<GraphicCM_ColorSpaceType>& colorSpaces) override; 51 DMError GetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType& colorSpace) override; 52 DMError SetScreenColorSpace(ScreenId screenId, GraphicCM_ColorSpaceType colorSpace) override; 53 54 virtual DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent, 55 DisplayManagerAgentType type) override; 56 57 virtual DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent, 58 DisplayManagerAgentType type) override; 59 60 virtual void NotifyDisplayEvent(DisplayEvent event) override; 61 virtual bool WakeUpBegin(PowerStateChangeReason reason) override; 62 virtual bool WakeUpEnd() override; 63 virtual bool SuspendBegin(PowerStateChangeReason reason) override; 64 virtual bool SuspendEnd() override; 65 virtual bool SetSpecifiedScreenPower(ScreenId, ScreenPowerState, PowerStateChangeReason) override; 66 virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) override; 67 virtual ScreenPowerState GetScreenPower(ScreenId dmsScreenId) override; 68 virtual bool SetDisplayState(DisplayState state) override; 69 virtual DisplayState GetDisplayState(DisplayId displayId) override; 70 virtual bool TryToCancelScreenOff() override; 71 virtual ScreenId CreateVirtualScreen(VirtualScreenOption option, 72 const sptr<IRemoteObject>& displayManagerAgent) override; 73 74 virtual DMError DestroyVirtualScreen(ScreenId screenId) override; 75 76 virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<IBufferProducer> surface) override; 77 78 virtual DMError ResizeVirtualScreen(ScreenId screenId, uint32_t width, uint32_t height) override; 79 80 virtual DMError SetVirtualMirrorScreenCanvasRotation(ScreenId screenId, bool autoRotate) override; 81 82 virtual DMError SetVirtualMirrorScreenScaleMode(ScreenId screenId, ScreenScaleMode scaleMode) override; 83 84 virtual DMError MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds, 85 ScreenId& screenGroupId) override; 86 virtual DMError StopMirror(const std::vector<ScreenId>& mirrorScreenIds) override; 87 DMError DisableMirror(bool disableOrNot) override; 88 89 virtual DMError MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint, 90 ScreenId& screenGroupId) override; 91 virtual DMError StopExpand(const std::vector<ScreenId>& expandScreenIds) override; 92 93 virtual sptr<ScreenGroupInfo> GetScreenGroupInfoById(ScreenId screenId) override; 94 95 virtual void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens) override; 96 97 virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, 98 DmErrorCode* errorCode, bool isUseDma) override; 99 virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) override; 100 101 virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override; 102 virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override; 103 virtual std::vector<DisplayId> GetAllDisplayIds() override; 104 105 virtual sptr<ScreenInfo> GetScreenInfoById(ScreenId screenId) override; 106 107 virtual DMError GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos) override; 108 109 virtual DMError GetScreenSupportedColorGamuts(ScreenId screenId, 110 std::vector<ScreenColorGamut>& colorGamuts) override; 111 112 virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) override; 113 virtual DMError SetScreenRotationLocked(bool isLocked) override; 114 virtual DMError SetScreenRotationLockedFromJs(bool isLocked) override; 115 virtual DMError IsScreenRotationLocked(bool& isLocked) override; 116 virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) override; 117 virtual DMError HasImmersiveWindow(bool& immersive) override; 118 119 virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow) override; 120 virtual bool ConvertScreenIdToRsScreenId(ScreenId screenId, ScreenId& rsScreenId) override; 121 virtual void UpdateDisplayHookInfo(int32_t uid, bool enable, const DMHookInfo& hookInfo) override; 122 123 virtual void DumpAllScreensInfo(std::string& dumpInfo) override; 124 virtual void DumpSpecialScreenInfo(ScreenId id, std::string& dumpInfo) override; 125 //Fold Screen 126 void SetFoldDisplayMode(const FoldDisplayMode displayMode) override; 127 DMError SetFoldDisplayModeFromJs(const FoldDisplayMode displayMode) override; 128 129 void SetDisplayScale(ScreenId screenId, float scaleX, float scaleY, 130 float pivotX, float pivotY) override; 131 132 void SetFoldStatusLocked(bool locked) override; 133 DMError SetFoldStatusLockedFromJs(bool locked) override; 134 135 FoldDisplayMode GetFoldDisplayMode() override; 136 137 bool IsFoldable() override; 138 bool IsCaptured() override; 139 140 FoldStatus GetFoldStatus() override; 141 142 sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override; 143 144 void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) override; 145 146 // unique screen 147 DMError MakeUniqueScreen(const std::vector<ScreenId>& screenIds) override; 148 149 void SetClient(const sptr<IScreenSessionManagerClient>& client) override; 150 ScreenProperty GetScreenProperty(ScreenId screenId) override; 151 std::shared_ptr<RSDisplayNode> GetDisplayNode(ScreenId screenId) override; 152 void UpdateScreenRotationProperty(ScreenId screenId, const RRectT<float>& bounds, float rotation, 153 ScreenPropertyChangeType screenPropertyChangeType) override; 154 void UpdateScreenDirectionInfo(ScreenId screenId, float screenComponentRotation, float rotation, 155 float phyRotation, ScreenPropertyChangeType screenPropertyChangeType) override; 156 void UpdateAvailableArea(ScreenId ScreenId, DMRect area) override; 157 int32_t SetScreenOffDelayTime(int32_t delay) override; 158 uint32_t GetCurvedCompressionArea() override; 159 ScreenProperty GetPhyScreenProperty(ScreenId screenId) override; 160 void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info) override; 161 void SetScreenPrivacyState(bool hasPrivate) override; 162 void SetPrivacyStateByDisplayId(DisplayId id, bool hasPrivate) override; 163 void SetScreenPrivacyWindowList(DisplayId id, std::vector<std::string> privacyWindowList) override; 164 virtual DMError GetAvailableArea(DisplayId displayId, DMRect& area) override; 165 void NotifyFoldToExpandCompletion(bool foldToExpand) override; 166 void SwitchUser() override; 167 VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId) override; 168 DMError SetVirtualScreenFlag(ScreenId screenId, VirtualScreenFlag screenFlag) override; 169 DMError SetVirtualScreenRefreshRate(ScreenId screenId, uint32_t refreshInterval) override; 170 DeviceScreenConfig GetDeviceScreenConfig() override; 171 DMError ProxyForFreeze(const std::set<int32_t>& pidList, bool isProxy) override; 172 DMError ResetAllFreezeStatus() override; 173 void SetVirtualScreenBlackList(ScreenId screenId, std::vector<uint64_t>& windowIdList) override; 174 void DisablePowerOffRenderControl(ScreenId screenId) override; 175 std::vector<DisplayPhysicalResolution> GetAllDisplayPhysicalResolution() override; 176 DMError SetVirtualScreenSecurityExemption(ScreenId screenId, uint32_t pid, 177 std::vector<uint64_t>& windowIdList) override; 178 DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate, 179 uint32_t& actualRefreshRate) override; 180 std::shared_ptr<Media::PixelMap> GetScreenCapture(const CaptureOption& captureOption, 181 DmErrorCode* errorCode = nullptr) override; 182 std::shared_ptr<Media::PixelMap> GetDisplaySnapshotWithOption(const CaptureOption& captureOption, 183 DmErrorCode* errorCode) override; 184 sptr<DisplayInfo> GetPrimaryDisplayInfo() override; 185 private: 186 static inline BrokerDelegator<ScreenSessionManagerProxy> delegator_; 187 }; 188 189 } // namespace Rosen 190 } // namespace OHOS 191 192 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_PROXY_H