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 #include "abstract_display_controller.h"
17
18 #include <cinttypes>
19 #include <sstream>
20 #include <surface.h>
21
22 #include "display_manager_agent_controller.h"
23 #include "display_manager_service.h"
24 #include "screen_group.h"
25 #include "window_manager_hilog.h"
26 #include "wm_trace.h"
27
28 namespace OHOS::Rosen {
29 namespace {
30 constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "AbstractDisplayController"};
31 }
32
AbstractDisplayController(std::recursive_mutex & mutex,DisplayStateChangeListener listener)33 AbstractDisplayController::AbstractDisplayController(std::recursive_mutex& mutex, DisplayStateChangeListener listener)
34 : mutex_(mutex), rsInterface_(RSInterfaces::GetInstance()), displayStateChangeListener_(listener)
35 {
36 }
37
~AbstractDisplayController()38 AbstractDisplayController::~AbstractDisplayController()
39 {
40 abstractScreenController_ = nullptr;
41 }
42
Init(sptr<AbstractScreenController> abstractScreenController)43 void AbstractDisplayController::Init(sptr<AbstractScreenController> abstractScreenController)
44 {
45 WLOGFD("display controller init");
46 displayCount_ = 0;
47 abstractScreenController_ = abstractScreenController;
48 abstractScreenCallback_ = new AbstractScreenController::AbstractScreenCallback();
49 abstractScreenCallback_->onConnect_
50 = std::bind(&AbstractDisplayController::OnAbstractScreenConnect, this, std::placeholders::_1);
51 abstractScreenCallback_->onDisconnect_
52 = std::bind(&AbstractDisplayController::OnAbstractScreenDisconnect, this, std::placeholders::_1);
53 abstractScreenCallback_->onChange_
54 = std::bind(&AbstractDisplayController::OnAbstractScreenChange, this, std::placeholders::_1,
55 std::placeholders::_2);
56 abstractScreenController_->ScreenConnectionInDisplayInit(abstractScreenCallback_);
57 abstractScreenController->RegisterAbstractScreenCallback(abstractScreenCallback_);
58 }
59
GetDefaultScreenId()60 ScreenId AbstractDisplayController::GetDefaultScreenId()
61 {
62 return rsInterface_.GetDefaultScreenId();
63 }
64
GetScreenActiveMode(ScreenId id)65 RSScreenModeInfo AbstractDisplayController::GetScreenActiveMode(ScreenId id)
66 {
67 return rsInterface_.GetScreenActiveMode(id);
68 }
69
GetAbstractDisplay(DisplayId displayId) const70 sptr<AbstractDisplay> AbstractDisplayController::GetAbstractDisplay(DisplayId displayId) const
71 {
72 std::lock_guard<std::recursive_mutex> lock(mutex_);
73 auto iter = abstractDisplayMap_.find(displayId);
74 if (iter == abstractDisplayMap_.end()) {
75 WLOGFE("Failed to get AbstractDisplay %{public}" PRIu64", return nullptr!", displayId);
76 return nullptr;
77 }
78 return iter->second;
79 }
80
GetAbstractDisplayByScreen(ScreenId screenId) const81 sptr<AbstractDisplay> AbstractDisplayController::GetAbstractDisplayByScreen(ScreenId screenId) const
82 {
83 std::lock_guard<std::recursive_mutex> lock(mutex_);
84 for (auto iter : abstractDisplayMap_) {
85 sptr<AbstractDisplay> display = iter.second;
86 if (display->GetAbstractScreenId() == screenId) {
87 return display;
88 }
89 }
90 WLOGFE("fail to get AbstractDisplay %{public}" PRIu64"", screenId);
91 return nullptr;
92 }
93
GetAllDisplayIds() const94 std::vector<DisplayId> AbstractDisplayController::GetAllDisplayIds() const
95 {
96 std::lock_guard<std::recursive_mutex> lock(mutex_);
97 std::vector<DisplayId> res;
98 for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); ++iter) {
99 res.push_back(iter->first);
100 }
101 return res;
102 }
103
GetScreenSnapshot(DisplayId displayId)104 std::shared_ptr<Media::PixelMap> AbstractDisplayController::GetScreenSnapshot(DisplayId displayId)
105 {
106 sptr<AbstractDisplay> abstractDisplay = GetAbstractDisplay(displayId);
107 if (abstractDisplay == nullptr) {
108 WLOGFE("GetScreenSnapshot: GetAbstarctDisplay failed");
109 return nullptr;
110 }
111 ScreenId dmsScreenId = abstractDisplay->GetAbstractScreenId();
112 std::shared_ptr<RSDisplayNode> displayNode = abstractScreenController_->GetRSDisplayNodeByScreenId(dmsScreenId);
113 std::lock_guard<std::recursive_mutex> lock(mutex_);
114 std::shared_ptr<ScreenshotCallback> callback = std::make_shared<ScreenshotCallback>();
115 rsInterface_.TakeSurfaceCapture(displayNode, callback);
116 std::shared_ptr<Media::PixelMap> screenshot = callback->GetResult(2000); // wait for 2000ms
117 if (screenshot == nullptr) {
118 WLOGFE("Failed to get pixelmap from RS, return nullptr!");
119 }
120 return screenshot;
121 }
122
OnAbstractScreenConnect(sptr<AbstractScreen> absScreen)123 void AbstractDisplayController::OnAbstractScreenConnect(sptr<AbstractScreen> absScreen)
124 {
125 if (absScreen == nullptr) {
126 WLOGFE("absScreen is null");
127 return;
128 }
129 WLOGI("connect new screen. id:%{public}" PRIu64"", absScreen->dmsId_);
130 std::lock_guard<std::recursive_mutex> lock(mutex_);
131 sptr<AbstractScreenGroup> group = absScreen->GetGroup();
132 if (group == nullptr) {
133 WLOGE("the group information of the screen is wrong");
134 return;
135 }
136 if (group->combination_ == ScreenCombination::SCREEN_ALONE || group->GetChildCount() == 1) {
137 BindAloneScreenLocked(absScreen);
138 } else if (group->combination_ == ScreenCombination::SCREEN_MIRROR) {
139 WLOGI("OnAbstractScreenConnect, ScreenCombination::SCREEN_MIRROR, AddScreenToMirrorLocked");
140 AddScreenToMirrorLocked(absScreen);
141 } else if (group->combination_ == ScreenCombination::SCREEN_EXPAND) {
142 WLOGI("OnAbstractScreenConnect, ScreenCombination::SCREEN_EXPAND, AddScreenToExpandLocked");
143 AddScreenToExpandLocked(absScreen);
144 } else {
145 WLOGE("support in future. combination:%{public}u", group->combination_);
146 }
147 }
148
OnAbstractScreenDisconnect(sptr<AbstractScreen> absScreen)149 void AbstractDisplayController::OnAbstractScreenDisconnect(sptr<AbstractScreen> absScreen)
150 {
151 if (absScreen == nullptr) {
152 WLOGE("the information of the screen is wrong");
153 return;
154 }
155 WLOGI("disconnect screen. id:%{public}" PRIu64"", absScreen->dmsId_);
156 sptr<AbstractScreenGroup> screenGroup;
157 DisplayId absDisplayId = DISPLAY_ID_INVALID;
158 {
159 std::lock_guard<std::recursive_mutex> lock(mutex_);
160 screenGroup = absScreen->GetGroup();
161 if (screenGroup == nullptr) {
162 WLOGE("the group information of the screen is wrong");
163 return;
164 }
165 if (screenGroup->combination_ == ScreenCombination::SCREEN_ALONE
166 || screenGroup->combination_ == ScreenCombination::SCREEN_MIRROR) {
167 absDisplayId = ProcessNormalScreenDisconnected(absScreen, screenGroup);
168 } else if (screenGroup->combination_ == ScreenCombination::SCREEN_EXPAND) {
169 absDisplayId = ProcessExpandScreenDisconnected(absScreen, screenGroup);
170 } else {
171 WLOGE("support in future. combination:%{public}u", screenGroup->combination_);
172 }
173 }
174 if (absDisplayId == DISPLAY_ID_INVALID) {
175 WLOGE("the displayId of the disconnected expand screen was not found");
176 return;
177 }
178 if (screenGroup->combination_ == ScreenCombination::SCREEN_ALONE
179 || screenGroup->combination_ == ScreenCombination::SCREEN_MIRROR) {
180 if (screenGroup->GetChildCount() == 0) {
181 abstractDisplayMap_.erase(absDisplayId);
182 DisplayManagerAgentController::GetInstance().OnDisplayDestroy(absDisplayId);
183 }
184 } else if (screenGroup->combination_ == ScreenCombination::SCREEN_EXPAND) {
185 displayStateChangeListener_(absDisplayId, DisplayStateChangeType::DESTROY);
186 DisplayManagerAgentController::GetInstance().OnDisplayDestroy(absDisplayId);
187 abstractDisplayMap_.erase(absDisplayId);
188 } else {
189 WLOGE("support in future. combination:%{public}u", screenGroup->combination_);
190 }
191 }
192
ProcessNormalScreenDisconnected(sptr<AbstractScreen> absScreen,sptr<AbstractScreenGroup> screenGroup)193 DisplayId AbstractDisplayController::ProcessNormalScreenDisconnected(
194 sptr<AbstractScreen> absScreen, sptr<AbstractScreenGroup> screenGroup)
195 {
196 WLOGI("normal screen disconnect");
197 ScreenId defaultScreenId = abstractScreenController_->GetDefaultAbstractScreenId();
198 sptr<AbstractScreen> defaultScreen = abstractScreenController_->GetAbstractScreen(defaultScreenId);
199 for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); iter++) {
200 DisplayId displayId = iter->first;
201 sptr<AbstractDisplay> abstractDisplay = iter->second;
202 if (abstractDisplay->GetAbstractScreenId() == absScreen->dmsId_) {
203 WLOGI("normal screen disconnect, displayId: %{public}" PRIu64", screenId: %{public}" PRIu64"",
204 displayId, abstractDisplay->GetAbstractScreenId());
205 abstractDisplay->BindAbstractScreen(defaultScreen);
206 return displayId;
207 }
208 }
209 return DISPLAY_ID_INVALID;
210 }
211
ProcessExpandScreenDisconnected(sptr<AbstractScreen> absScreen,sptr<AbstractScreenGroup> screenGroup)212 DisplayId AbstractDisplayController::ProcessExpandScreenDisconnected(
213 sptr<AbstractScreen> absScreen, sptr<AbstractScreenGroup> screenGroup)
214 {
215 WLOGI("expand screen disconnect");
216 for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); iter++) {
217 DisplayId displayId = iter->first;
218 sptr<AbstractDisplay> abstractDisplay = iter->second;
219 if (abstractDisplay->GetAbstractScreenId() == absScreen->dmsId_) {
220 WLOGI("expand screen disconnect, displayId: %{public}" PRIu64", screenId: %{public}" PRIu64"",
221 displayId, abstractDisplay->GetAbstractScreenId());
222 return displayId;
223 }
224 }
225 return DISPLAY_ID_INVALID;
226 }
227
OnAbstractScreenChange(sptr<AbstractScreen> absScreen,DisplayChangeEvent event)228 void AbstractDisplayController::OnAbstractScreenChange(sptr<AbstractScreen> absScreen, DisplayChangeEvent event)
229 {
230 if (absScreen == nullptr) {
231 WLOGE("OnAbstractScreenChanged::the information of the screen is wrong");
232 return;
233 }
234 WLOGI("screen changes. id:%{public}" PRIu64"", absScreen->dmsId_);
235 if (event == DisplayChangeEvent::UPDATE_ORIENTATION) {
236 ProcessDisplayUpdateOrientation(absScreen);
237 } else if (event == DisplayChangeEvent::DISPLAY_SIZE_CHANGED) {
238 ProcessDisplaySizeChange(absScreen);
239 } else {
240 WLOGE("unknow screen change event. id:%{public}" PRIu64" event %{public}u", absScreen->dmsId_, event);
241 }
242 }
243
ProcessDisplayUpdateOrientation(sptr<AbstractScreen> absScreen)244 void AbstractDisplayController::ProcessDisplayUpdateOrientation(sptr<AbstractScreen> absScreen)
245 {
246 sptr<AbstractDisplay> abstractDisplay = nullptr;
247 {
248 std::lock_guard<std::recursive_mutex> lock(mutex_);
249 auto iter = abstractDisplayMap_.begin();
250 for (; iter != abstractDisplayMap_.end(); iter++) {
251 abstractDisplay = iter->second;
252 if (abstractDisplay->GetAbstractScreenId() == absScreen->dmsId_) {
253 WLOGFD("find abstract display of the screen. display %{public}" PRIu64", screen %{public}" PRIu64"",
254 abstractDisplay->GetId(), absScreen->dmsId_);
255 break;
256 }
257 }
258
259 sptr<AbstractScreenGroup> group = absScreen->GetGroup();
260 if (group == nullptr) {
261 WLOGFE("cannot get screen group");
262 return;
263 }
264 if (iter == abstractDisplayMap_.end()) {
265 if (group->combination_ == ScreenCombination::SCREEN_ALONE
266 || group->combination_ == ScreenCombination::SCREEN_EXPAND) {
267 WLOGFE("cannot find abstract display of the screen %{public}" PRIu64"", absScreen->dmsId_);
268 return;
269 } else if (group->combination_ == ScreenCombination::SCREEN_MIRROR) {
270 // If the screen cannot be found in 'abstractDisplayMap_', it means that the screen is the secondary
271 WLOGFI("It's the secondary screen of the mirrored.");
272 return;
273 } else {
274 WLOGFE("Unknow combination");
275 return;
276 }
277 }
278 }
279 abstractDisplay->SetOrientation(absScreen->orientation_);
280 if (abstractDisplay->RequestRotation(absScreen->rotation_)) {
281 // Notify rotation event to WMS
282 displayStateChangeListener_(abstractDisplay->GetId(), DisplayStateChangeType::UPDATE_ROTATION);
283 }
284 // Notify orientation event to DisplayManager
285 sptr<DisplayInfo> displayInfo = abstractDisplay->ConvertToDisplayInfo();
286 DisplayManagerAgentController::GetInstance().OnDisplayChange(displayInfo,
287 DisplayChangeEvent::UPDATE_ORIENTATION);
288 }
289
ProcessDisplaySizeChange(sptr<AbstractScreen> absScreen)290 void AbstractDisplayController::ProcessDisplaySizeChange(sptr<AbstractScreen> absScreen)
291 {
292 WM_SCOPED_TRACE("dms:ProcessDisplaySizeChange(%" PRIu64")", absScreen->dmsId_);
293 sptr<SupportedScreenModes> info = absScreen->GetActiveScreenMode();
294 if (info == nullptr) {
295 WLOGE("cannot get active screen info.");
296 return;
297 }
298
299 std::map<DisplayId, sptr<AbstractDisplay>> matchedDisplays;
300 {
301 std::lock_guard<std::recursive_mutex> lock(mutex_);
302 for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); ++iter) {
303 sptr<AbstractDisplay> absDisplay = iter->second;
304 if (absDisplay == nullptr || absDisplay->GetAbstractScreenId() != absScreen->dmsId_) {
305 continue;
306 }
307 if (UpdateDisplaySize(absDisplay, info)) {
308 matchedDisplays.insert(std::make_pair(iter->first, iter->second));
309 }
310 }
311 }
312
313 WLOGFI("Size of matchedDisplays %{public}zu", matchedDisplays.size());
314 for (auto iter = matchedDisplays.begin(); iter != matchedDisplays.end(); ++iter) {
315 WLOGFI("Notify display size change. Id %{public}" PRIu64"", iter->first);
316 displayStateChangeListener_(iter->first, DisplayStateChangeType::SIZE_CHANGE);
317 DisplayManagerAgentController::GetInstance().OnDisplayChange(
318 iter->second->ConvertToDisplayInfo(), DisplayChangeEvent::DISPLAY_SIZE_CHANGED);
319 }
320 }
321
UpdateDisplaySize(sptr<AbstractDisplay> absDisplay,sptr<SupportedScreenModes> info)322 bool AbstractDisplayController::UpdateDisplaySize(sptr<AbstractDisplay> absDisplay, sptr<SupportedScreenModes> info)
323 {
324 if (info->height_ == static_cast<uint32_t>(absDisplay->GetHeight()) &&
325 info->width_ == static_cast<uint32_t>(absDisplay->GetWidth())) {
326 WLOGI("keep display size. display:%{public}" PRIu64"", absDisplay->GetId());
327 return false;
328 }
329 absDisplay->SetHeight(info->height_);
330 absDisplay->SetWidth(info->width_);
331 WLOGI("update display size. id %{public}" PRIu64", size: %{public}d %{public}d",
332 absDisplay->GetId(), absDisplay->GetWidth(), absDisplay->GetHeight());
333 return true;
334 }
335
BindAloneScreenLocked(sptr<AbstractScreen> realAbsScreen)336 void AbstractDisplayController::BindAloneScreenLocked(sptr<AbstractScreen> realAbsScreen)
337 {
338 ScreenId defaultScreenId = abstractScreenController_->GetDefaultAbstractScreenId();
339 if (defaultScreenId != SCREEN_ID_INVALID) {
340 if (defaultScreenId != realAbsScreen->dmsId_) {
341 WLOGE("The first real screen should be default for Phone. %{public}" PRIu64"", realAbsScreen->dmsId_);
342 return;
343 }
344 sptr<SupportedScreenModes> info = realAbsScreen->GetActiveScreenMode();
345 if (info == nullptr) {
346 WLOGE("bind alone screen error, cannot get info.");
347 return;
348 }
349 if (dummyDisplay_ == nullptr) {
350 DisplayId displayId = displayCount_.fetch_add(1);
351 std::ostringstream buffer;
352 buffer<<"display_"<<displayId;
353 std::string name = buffer.str();
354 sptr<AbstractDisplay> display = new AbstractDisplay(displayId, realAbsScreen->dmsId_, name, info);
355 abstractDisplayMap_.insert((std::make_pair(display->GetId(), display)));
356 WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"",
357 realAbsScreen->dmsId_, display->GetId());
358 DisplayManagerAgentController::GetInstance().OnDisplayCreate(display->ConvertToDisplayInfo());
359 } else {
360 WLOGI("bind display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"",
361 realAbsScreen->dmsId_, dummyDisplay_->GetId());
362 bool updateFlag = dummyDisplay_->GetHeight() == info->height_ && dummyDisplay_->GetWidth() == info->width_;
363 dummyDisplay_->BindAbstractScreen(abstractScreenController_->GetAbstractScreen(realAbsScreen->dmsId_));
364 if (updateFlag) {
365 DisplayManagerAgentController::GetInstance().OnDisplayCreate(dummyDisplay_->ConvertToDisplayInfo());
366 }
367 dummyDisplay_ = nullptr;
368 }
369 } else {
370 WLOGE("The first real screen should be default screen for Phone. %{public}" PRIu64"", realAbsScreen->dmsId_);
371 }
372 }
373
AddScreenToMirrorLocked(sptr<AbstractScreen> absScreen)374 void AbstractDisplayController::AddScreenToMirrorLocked(sptr<AbstractScreen> absScreen)
375 {
376 WLOGI("bind display to mirror. screen:%{public}" PRIu64"", absScreen->dmsId_);
377 }
378
AddScreenToExpandLocked(sptr<AbstractScreen> absScreen)379 void AbstractDisplayController::AddScreenToExpandLocked(sptr<AbstractScreen> absScreen)
380 {
381 WLOGI("bind display to expand. screen:%{public}" PRIu64"", absScreen->dmsId_);
382 sptr<SupportedScreenModes> info;
383 if (absScreen->type_ == ScreenType::VIRTUAL) {
384 WLOGI("screen type is virtual, use default screen info");
385 ScreenId defaultScreenId = abstractScreenController_->GetDefaultAbstractScreenId();
386 sptr<AbstractScreen> defaultScreen = abstractScreenController_->GetAbstractScreen(defaultScreenId);
387 if (defaultScreen == nullptr) {
388 WLOGE("bind display error, cannot get defaultScreen.");
389 return;
390 }
391 info = defaultScreen->GetActiveScreenMode();
392 } else {
393 WLOGI("screen type is not virtual, get this screen info");
394 info = absScreen->GetActiveScreenMode();
395 }
396 if (info == nullptr) {
397 WLOGE("bind display error, cannot get info.");
398 return;
399 }
400 DisplayId displayId = displayCount_.fetch_add(1);
401 std::ostringstream buffer;
402 buffer<<"display_"<<displayId;
403 std::string name = buffer.str();
404 sptr<AbstractDisplay> display = new AbstractDisplay(displayId, absScreen->dmsId_, name, info);
405 abstractDisplayMap_.insert((std::make_pair(display->GetId(), display)));
406 WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"",
407 absScreen->dmsId_, display->GetId());
408 DisplayManagerAgentController::GetInstance().OnDisplayCreate(display->ConvertToDisplayInfo());
409 }
410
AddDisplayForExpandScreen(sptr<AbstractScreen> absScreen)411 void AbstractDisplayController::AddDisplayForExpandScreen(sptr<AbstractScreen> absScreen)
412 {
413 for (auto iter = abstractDisplayMap_.begin(); iter != abstractDisplayMap_.end(); iter++) {
414 sptr<AbstractDisplay> abstractDisplay = iter->second;
415 if (abstractDisplay->GetAbstractScreenId() == absScreen->dmsId_) {
416 WLOGE("error, screenId: %{public}" PRIu64" already has corresponding display",
417 absScreen->dmsId_);
418 return;
419 }
420 }
421 WLOGI("screenId: %{public}" PRIu64" has no corresponding display, create new display.",
422 absScreen->dmsId_);
423 AddScreenToExpandLocked(absScreen);
424 }
425
426
SetFreeze(std::vector<DisplayId> displayIds,bool toFreeze)427 void AbstractDisplayController::SetFreeze(std::vector<DisplayId> displayIds, bool toFreeze)
428 {
429 WM_SCOPED_TRACE("dms:SetAllFreeze");
430 DisplayStateChangeType type = toFreeze ? DisplayStateChangeType::FREEZE : DisplayStateChangeType::UNFREEZE;
431 DisplayChangeEvent event
432 = toFreeze ? DisplayChangeEvent::DISPLAY_FREEZED : DisplayChangeEvent::DISPLAY_UNFREEZED;
433 for (DisplayId displayId : displayIds) {
434 sptr<AbstractDisplay> abstractDisplay;
435 WM_SCOPED_TRACE("dms:SetFreeze(%" PRIu64")", displayId);
436 {
437 WLOGI("setfreeze display %{public}" PRIu64"", displayId);
438 std::lock_guard<std::recursive_mutex> lock(mutex_);
439 auto iter = abstractDisplayMap_.find(displayId);
440 if (iter == abstractDisplayMap_.end()) {
441 WLOGI("setfreeze fail, cannot get display %{public}" PRIu64"", displayId);
442 continue;
443 }
444 abstractDisplay = iter->second;
445 FreezeFlag curFlag = abstractDisplay->GetFreezeFlag();
446 if ((toFreeze && (curFlag == FreezeFlag::FREEZING))
447 || (!toFreeze && (curFlag == FreezeFlag::UNFREEZING))) {
448 WLOGI("setfreeze fail, display %{public}" PRIu64" freezeflag is %{public}u",
449 displayId, curFlag);
450 continue;
451 }
452 FreezeFlag flag = toFreeze ? FreezeFlag::FREEZING : FreezeFlag::UNFREEZING;
453 abstractDisplay->SetFreezeFlag(flag);
454 }
455
456 // Notify freeze event to WMS
457 displayStateChangeListener_(displayId, type);
458 // Notify freeze event to DisplayManager
459 sptr<DisplayInfo> displayInfo = abstractDisplay->ConvertToDisplayInfo();
460 DisplayManagerAgentController::GetInstance().OnDisplayChange(displayInfo, event);
461 }
462 }
463 } // namespace OHOS::Rosen