1 /*
2  * Copyright (c) 2024 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_DISPLAY_MANAGER_LITE_PROXY_H
17 #define OHOS_ROSEN_DISPLAY_MANAGER_LITE_PROXY_H
18 
19 #include "display_manager_interface_code.h"
20 
21 #include <iremote_broker.h>
22 #include <iremote_proxy.h>
23 #include <cinttypes>
24 #include "dm_common.h"
25 #include "zidl/display_manager_agent_interface.h"
26 #include "display_info.h"
27 #include "fold_screen_info.h"
28 #include "screen_group_info.h"
29 
30 namespace OHOS {
31 namespace Rosen {
32 
33 class DisplayManagerLiteProxy : public IRemoteBroker {
34 public:
35 #ifdef SCENE_BOARD_ENABLED
36     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IScreenSessionManager");
37 #else
38     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IDisplayManager");
39 #endif
40 
DisplayManagerLiteProxy(const sptr<IRemoteObject> & impl)41     explicit DisplayManagerLiteProxy(const sptr<IRemoteObject>& impl) : remoteObject(impl) {}
42 
43     ~DisplayManagerLiteProxy() = default;
44 
AsObject()45     sptr<IRemoteObject> AsObject() { return remoteObject; };
46     virtual DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
47         DisplayManagerAgentType type);
48     virtual DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
49         DisplayManagerAgentType type);
50 
51     virtual FoldDisplayMode GetFoldDisplayMode();
52     virtual void SetFoldDisplayMode(const FoldDisplayMode displayMode);
53     virtual bool IsFoldable();
54     FoldStatus GetFoldStatus();
55     virtual sptr<DisplayInfo> GetDefaultDisplayInfo();
56     virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId);
57     virtual sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId);
58     virtual VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId);
59     /*
60      * used by powermgr
61      */
62     virtual bool WakeUpBegin(PowerStateChangeReason reason);
63     virtual bool WakeUpEnd();
64     virtual bool SuspendBegin(PowerStateChangeReason reason);
65     virtual bool SuspendEnd();
66     virtual bool SetSpecifiedScreenPower(ScreenId, ScreenPowerState, PowerStateChangeReason);
67     virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason);
68     virtual ScreenPowerState GetScreenPower(ScreenId dmsScreenId);
69     virtual bool SetDisplayState(DisplayState state);
70     virtual DisplayState GetDisplayState(DisplayId displayId);
71     virtual bool TryToCancelScreenOff();
72     virtual bool SetScreenBrightness(uint64_t screenId, uint32_t level);
73     virtual uint32_t GetScreenBrightness(uint64_t screenId);
74     virtual std::vector<DisplayId> GetAllDisplayIds();
75 private:
Remote()76     sptr<IRemoteObject> Remote() { return remoteObject; };
77     sptr<IRemoteObject> remoteObject = nullptr;
78 };
79 } // namespace Rosen
80 } // namespace OHOS
81 
82 #endif // OHOS_ROSEN_SCREEN_SESSION_MANAGER_LITE_PROXY_H