• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 #include <cinttypes>
17 #include "display_manager.h"
18 #include "dm_common.h"
19 #include "singleton_delegator.h"
20 #include "windowmanager/utils/include/display_info.h"
21 
22 namespace OHOS::Rosen {
23 WM_IMPLEMENT_SINGLE_INSTANCE(DisplayManager)
24 
25 class DisplayManager::Impl : public RefBase {
26 friend class DisplayManager;
27 private:
28     bool CheckRectValid(const Media::Rect& rect, int32_t oriHeight, int32_t oriWidth) const;
29     bool CheckSizeValid(const Media::Size& size, int32_t oriHeight, int32_t oriWidth) const;
30     void ClearDisplayStateCallback();
31 };
32 
CheckRectValid(const Media::Rect & rect,int32_t oriHeight,int32_t oriWidth) const33 bool DisplayManager::Impl::CheckRectValid(const Media::Rect& rect, int32_t oriHeight, int32_t oriWidth) const
34 {
35     return true;
36 }
37 
CheckSizeValid(const Media::Size & size,int32_t oriHeight,int32_t oriWidth) const38 bool DisplayManager::Impl::CheckSizeValid(const Media::Size& size, int32_t oriHeight, int32_t oriWidth) const
39 {
40     return true;
41 }
42 
ClearDisplayStateCallback()43 void DisplayManager::Impl::ClearDisplayStateCallback()
44 {
45 }
46 
DisplayManager()47 DisplayManager::DisplayManager()
48 {
49 }
50 
~DisplayManager()51 DisplayManager::~DisplayManager()
52 {
53 }
54 
GetDefaultDisplayId()55 DisplayId DisplayManager::GetDefaultDisplayId()
56 {
57     DisplayId id {0};
58     return id;
59 }
60 
GetDisplayById(DisplayId displayId)61 sptr<Display> DisplayManager::GetDisplayById(DisplayId displayId)
62 {
63     sptr<Display> display = new Display("display_mock", nullptr);
64     return display;
65 }
66 
GetScreenshot(DisplayId displayId)67 std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId displayId)
68 {
69     return nullptr;
70 }
71 
GetScreenshot(DisplayId displayId,const Media::Rect & rect,const Media::Size & size,int rotation)72 std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId displayId, const Media::Rect &rect,
73                                                                const Media::Size &size, int rotation)
74 {
75     return nullptr;
76 }
77 
GetDefaultDisplay()78 sptr<Display> DisplayManager::GetDefaultDisplay()
79 {
80     return GetDisplayById(GetDefaultDisplayId());
81 }
82 
GetAllDisplayIds()83 std::vector<DisplayId> DisplayManager::GetAllDisplayIds()
84 {
85     std::vector<DisplayId> res = {};
86     return res;
87 }
88 
GetAllDisplays()89 std::vector<sptr<Display>> DisplayManager::GetAllDisplays()
90 {
91     std::vector<sptr<Display>> res;
92     return res;
93 }
94 
RegisterDisplayListener(sptr<IDisplayListener> listener)95 bool DisplayManager::RegisterDisplayListener(sptr<IDisplayListener> listener)
96 {
97     return true;
98 }
99 
RegisterDisplayPowerEventListener(sptr<IDisplayPowerEventListener> listener)100 bool DisplayManager::RegisterDisplayPowerEventListener(sptr<IDisplayPowerEventListener> listener)
101 {
102     return true;
103 }
104 
UnregisterDisplayPowerEventListener(sptr<IDisplayPowerEventListener> listener)105 bool DisplayManager::UnregisterDisplayPowerEventListener(sptr<IDisplayPowerEventListener> listener)
106 {
107     return true;
108 }
109 
WakeUpBegin(PowerStateChangeReason reason)110 bool DisplayManager::WakeUpBegin(PowerStateChangeReason reason)
111 {
112     return true;
113 }
114 
WakeUpEnd()115 bool DisplayManager::WakeUpEnd()
116 {
117     return true;
118 }
119 
SuspendBegin(PowerStateChangeReason reason)120 bool DisplayManager::SuspendBegin(PowerStateChangeReason reason)
121 {
122     return true;
123 }
124 
SuspendEnd()125 bool DisplayManager::SuspendEnd()
126 {
127     return true;
128 }
129 
SetDisplayState(DisplayState state,DisplayStateCallback callback)130 bool DisplayManager::SetDisplayState(DisplayState state, DisplayStateCallback callback)
131 {
132     return true;
133 }
134 
GetDisplayState(DisplayId displayId)135 DisplayState DisplayManager::GetDisplayState(DisplayId displayId)
136 {
137     DisplayState state = DisplayState::UNKNOWN;
138     return state;
139 }
140 
SetScreenBrightness(uint64_t screenId,uint32_t level)141 bool DisplayManager::SetScreenBrightness(uint64_t screenId, uint32_t level)
142 {
143     return true;
144 }
145 
GetScreenBrightness(uint64_t screenId) const146 uint32_t DisplayManager::GetScreenBrightness(uint64_t screenId) const
147 {
148     return 0;
149 }
150 
NotifyDisplayEvent(DisplayEvent event)151 void DisplayManager::NotifyDisplayEvent(DisplayEvent event)
152 {
153 }
154 } // namespace OHOS::Rosen