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 "display_manager_adapter.h"
17
18 #include <iremote_broker.h>
19 #include <iservice_registry.h>
20 #include <system_ability_definition.h>
21
22 #include "display_manager.h"
23 #include "screen_manager.h"
24 #include "session_manager.h"
25 #include "window_manager_hilog.h"
26 #include "scene_board_judgement.h"
27
28 namespace OHOS::Rosen {
29 namespace {
30 constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "DisplayManagerAdapter"};
31 }
32 WM_IMPLEMENT_SINGLE_INSTANCE(DisplayManagerAdapter)
WM_IMPLEMENT_SINGLE_INSTANCE(ScreenManagerAdapter)33 WM_IMPLEMENT_SINGLE_INSTANCE(ScreenManagerAdapter)
34
35 #define INIT_PROXY_CHECK_RETURN(ret) \
36 do { \
37 if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) { \
38 if (!InitDMSProxy()) { \
39 WLOGFE("InitDMSProxy failed!"); \
40 return ret; \
41 } \
42 } else { \
43 if (!InitSMSProxy()) { \
44 WLOGFE("InitSMSProxy failed!"); \
45 return ret; \
46 } \
47 } \
48 } while (false)
49
50 sptr<DisplayInfo> DisplayManagerAdapter::GetDefaultDisplayInfo()
51 {
52 INIT_PROXY_CHECK_RETURN(nullptr);
53
54 return displayManagerServiceProxy_->GetDefaultDisplayInfo();
55 }
56
GetDisplayInfoByScreenId(ScreenId screenId)57 sptr<DisplayInfo> DisplayManagerAdapter::GetDisplayInfoByScreenId(ScreenId screenId)
58 {
59 INIT_PROXY_CHECK_RETURN(nullptr);
60
61 return displayManagerServiceProxy_->GetDisplayInfoByScreen(screenId);
62 }
63
GetDisplaySnapshot(DisplayId displayId,DmErrorCode * errorCode)64 std::shared_ptr<Media::PixelMap> DisplayManagerAdapter::GetDisplaySnapshot(DisplayId displayId, DmErrorCode* errorCode)
65 {
66 INIT_PROXY_CHECK_RETURN(nullptr);
67
68 return displayManagerServiceProxy_->GetDisplaySnapshot(displayId, errorCode);
69 }
70
GetScreenSupportedColorGamuts(ScreenId screenId,std::vector<ScreenColorGamut> & colorGamuts)71 DMError ScreenManagerAdapter::GetScreenSupportedColorGamuts(ScreenId screenId,
72 std::vector<ScreenColorGamut>& colorGamuts)
73 {
74 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
75
76 return displayManagerServiceProxy_->GetScreenSupportedColorGamuts(screenId, colorGamuts);
77 }
78
GetScreenColorGamut(ScreenId screenId,ScreenColorGamut & colorGamut)79 DMError ScreenManagerAdapter::GetScreenColorGamut(ScreenId screenId, ScreenColorGamut& colorGamut)
80 {
81 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
82
83 return displayManagerServiceProxy_->GetScreenColorGamut(screenId, colorGamut);
84 }
85
SetScreenColorGamut(ScreenId screenId,int32_t colorGamutIdx)86 DMError ScreenManagerAdapter::SetScreenColorGamut(ScreenId screenId, int32_t colorGamutIdx)
87 {
88 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
89
90 return displayManagerServiceProxy_->SetScreenColorGamut(screenId, colorGamutIdx);
91 }
92
GetScreenGamutMap(ScreenId screenId,ScreenGamutMap & gamutMap)93 DMError ScreenManagerAdapter::GetScreenGamutMap(ScreenId screenId, ScreenGamutMap& gamutMap)
94 {
95 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
96
97 return displayManagerServiceProxy_->GetScreenGamutMap(screenId, gamutMap);
98 }
99
SetScreenGamutMap(ScreenId screenId,ScreenGamutMap gamutMap)100 DMError ScreenManagerAdapter::SetScreenGamutMap(ScreenId screenId, ScreenGamutMap gamutMap)
101 {
102 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
103
104 return displayManagerServiceProxy_->SetScreenGamutMap(screenId, gamutMap);
105 }
106
SetScreenColorTransform(ScreenId screenId)107 DMError ScreenManagerAdapter::SetScreenColorTransform(ScreenId screenId)
108 {
109 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
110
111 return displayManagerServiceProxy_->SetScreenColorTransform(screenId);
112 }
113
CreateVirtualScreen(VirtualScreenOption option,const sptr<IDisplayManagerAgent> & displayManagerAgent)114 ScreenId ScreenManagerAdapter::CreateVirtualScreen(VirtualScreenOption option,
115 const sptr<IDisplayManagerAgent>& displayManagerAgent)
116 {
117 INIT_PROXY_CHECK_RETURN(SCREEN_ID_INVALID);
118
119 WLOGFI("DisplayManagerAdapter::CreateVirtualScreen");
120 return displayManagerServiceProxy_->CreateVirtualScreen(option, displayManagerAgent->AsObject());
121 }
122
DestroyVirtualScreen(ScreenId screenId)123 DMError ScreenManagerAdapter::DestroyVirtualScreen(ScreenId screenId)
124 {
125 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
126
127 WLOGFI("DisplayManagerAdapter::DestroyVirtualScreen");
128 return displayManagerServiceProxy_->DestroyVirtualScreen(screenId);
129 }
130
SetVirtualScreenSurface(ScreenId screenId,sptr<Surface> surface)131 DMError ScreenManagerAdapter::SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface)
132 {
133 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
134
135 if (surface == nullptr) {
136 WLOGFE("Surface is nullptr");
137 return DMError::DM_ERROR_NULLPTR;
138 }
139 WLOGFI("DisplayManagerAdapter::SetVirtualScreenSurface");
140 return displayManagerServiceProxy_->SetVirtualScreenSurface(screenId, surface->GetProducer());
141 }
142
SetScreenRotationLocked(bool isLocked)143 DMError ScreenManagerAdapter::SetScreenRotationLocked(bool isLocked)
144 {
145 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
146 WLOGFI("DisplayManagerAdapter::SetScreenRotationLocked");
147 return displayManagerServiceProxy_->SetScreenRotationLocked(isLocked);
148 }
149
IsScreenRotationLocked(bool & isLocked)150 DMError ScreenManagerAdapter::IsScreenRotationLocked(bool& isLocked)
151 {
152 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
153 WLOGFI("DisplayManagerAdapter::IsScreenRotationLocked");
154 return displayManagerServiceProxy_->IsScreenRotationLocked(isLocked);
155 }
156
SetScreenPowerForAll(ScreenPowerState state,PowerStateChangeReason reason)157 bool ScreenManagerAdapter::SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason)
158 {
159 INIT_PROXY_CHECK_RETURN(false);
160 return displayManagerServiceProxy_->SetScreenPowerForAll(state, reason);
161 }
162
GetScreenPower(ScreenId dmsScreenId)163 ScreenPowerState ScreenManagerAdapter::GetScreenPower(ScreenId dmsScreenId)
164 {
165 INIT_PROXY_CHECK_RETURN(ScreenPowerState::INVALID_STATE);
166 return displayManagerServiceProxy_->GetScreenPower(dmsScreenId);
167 }
168
SetOrientation(ScreenId screenId,Orientation orientation)169 DMError ScreenManagerAdapter::SetOrientation(ScreenId screenId, Orientation orientation)
170 {
171 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
172
173 return displayManagerServiceProxy_->SetOrientation(screenId, orientation);
174 }
175
RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent> & displayManagerAgent,DisplayManagerAgentType type)176 DMError BaseAdapter::RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
177 DisplayManagerAgentType type)
178 {
179 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
180
181 return displayManagerServiceProxy_->RegisterDisplayManagerAgent(displayManagerAgent, type);
182 }
183
UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent> & displayManagerAgent,DisplayManagerAgentType type)184 DMError BaseAdapter::UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
185 DisplayManagerAgentType type)
186 {
187 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
188
189 return displayManagerServiceProxy_->UnregisterDisplayManagerAgent(displayManagerAgent, type);
190 }
191
WakeUpBegin(PowerStateChangeReason reason)192 bool DisplayManagerAdapter::WakeUpBegin(PowerStateChangeReason reason)
193 {
194 INIT_PROXY_CHECK_RETURN(false);
195
196 return displayManagerServiceProxy_->WakeUpBegin(reason);
197 }
198
WakeUpEnd()199 bool DisplayManagerAdapter::WakeUpEnd()
200 {
201 INIT_PROXY_CHECK_RETURN(false);
202
203 return displayManagerServiceProxy_->WakeUpEnd();
204 }
205
SuspendBegin(PowerStateChangeReason reason)206 bool DisplayManagerAdapter::SuspendBegin(PowerStateChangeReason reason)
207 {
208 INIT_PROXY_CHECK_RETURN(false);
209
210 return displayManagerServiceProxy_->SuspendBegin(reason);
211 }
212
SuspendEnd()213 bool DisplayManagerAdapter::SuspendEnd()
214 {
215 INIT_PROXY_CHECK_RETURN(false);
216
217 return displayManagerServiceProxy_->SuspendEnd();
218 }
219
SetDisplayState(DisplayState state)220 bool DisplayManagerAdapter::SetDisplayState(DisplayState state)
221 {
222 INIT_PROXY_CHECK_RETURN(false);
223
224 return displayManagerServiceProxy_->SetDisplayState(state);
225 }
226
GetDisplayState(DisplayId displayId)227 DisplayState DisplayManagerAdapter::GetDisplayState(DisplayId displayId)
228 {
229 INIT_PROXY_CHECK_RETURN(DisplayState::UNKNOWN);
230
231 return displayManagerServiceProxy_->GetDisplayState(displayId);
232 }
233
NotifyDisplayEvent(DisplayEvent event)234 void DisplayManagerAdapter::NotifyDisplayEvent(DisplayEvent event)
235 {
236 INIT_PROXY_CHECK_RETURN();
237
238 displayManagerServiceProxy_->NotifyDisplayEvent(event);
239 }
240
SetFreeze(std::vector<DisplayId> displayIds,bool isFreeze)241 bool DisplayManagerAdapter::SetFreeze(std::vector<DisplayId> displayIds, bool isFreeze)
242 {
243 INIT_PROXY_CHECK_RETURN(false);
244 return displayManagerServiceProxy_->SetFreeze(displayIds, isFreeze);
245 }
246
InitDMSProxy()247 bool BaseAdapter::InitDMSProxy()
248 {
249 std::lock_guard<std::recursive_mutex> lock(mutex_);
250 if (!isProxyValid_) {
251 sptr<ISystemAbilityManager> systemAbilityManager =
252 SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
253 if (!systemAbilityManager) {
254 WLOGFE("Failed to get system ability mgr.");
255 return false;
256 }
257
258 sptr<IRemoteObject> remoteObject
259 = systemAbilityManager->GetSystemAbility(DISPLAY_MANAGER_SERVICE_SA_ID);
260 if (!remoteObject) {
261 WLOGFE("Failed to get display manager service.");
262 return false;
263 }
264
265 displayManagerServiceProxy_ = iface_cast<IDisplayManager>(remoteObject);
266 if ((!displayManagerServiceProxy_) || (!displayManagerServiceProxy_->AsObject())) {
267 WLOGFE("Failed to get system display manager services");
268 return false;
269 }
270
271 dmsDeath_ = new(std::nothrow) DMSDeathRecipient(*this);
272 if (dmsDeath_ == nullptr) {
273 WLOGFE("Failed to create death Recipient ptr DMSDeathRecipient");
274 return false;
275 }
276 if (remoteObject->IsProxyObject() && !remoteObject->AddDeathRecipient(dmsDeath_)) {
277 WLOGFE("Failed to add death recipient");
278 return false;
279 }
280 isProxyValid_ = true;
281 }
282 return true;
283 }
284
InitSMSProxy()285 bool BaseAdapter::InitSMSProxy()
286 {
287 if (isProxyValid_) {
288 return true;
289 }
290
291 std::lock_guard<std::recursive_mutex> lock(mutex_);
292 SessionManager& sessionManager = SessionManager::GetInstance();
293 displayManagerServiceProxy_ = sessionManager.GetScreenSessionManagerProxy();
294 if ((!displayManagerServiceProxy_) || (!displayManagerServiceProxy_->AsObject())) {
295 WLOGFE("Failed to get system display manager services");
296 return false;
297 }
298
299 dmsDeath_ = new(std::nothrow) DMSDeathRecipient(*this);
300 if (dmsDeath_ == nullptr) {
301 WLOGFE("Failed to create death Recipient ptr DMSDeathRecipient");
302 return false;
303 }
304
305 sptr<IRemoteObject> remoteObject = displayManagerServiceProxy_->AsObject();
306 if (remoteObject->IsProxyObject() && !remoteObject->AddDeathRecipient(dmsDeath_)) {
307 WLOGFE("Failed to add death recipient");
308 return false;
309 }
310 isProxyValid_ = true;
311 return true;
312 }
313
DMSDeathRecipient(BaseAdapter & adapter)314 DMSDeathRecipient::DMSDeathRecipient(BaseAdapter& adapter) : adapter_(adapter)
315 {
316 }
317
OnRemoteDied(const wptr<IRemoteObject> & wptrDeath)318 void DMSDeathRecipient::OnRemoteDied(const wptr<IRemoteObject>& wptrDeath)
319 {
320 if (wptrDeath == nullptr) {
321 WLOGFE("wptrDeath is null");
322 return;
323 }
324
325 sptr<IRemoteObject> object = wptrDeath.promote();
326 if (!object) {
327 WLOGFE("object is null");
328 return;
329 }
330 WLOGFI("dms OnRemoteDied");
331 adapter_.Clear();
332 SingletonContainer::Get<DisplayManager>().OnRemoteDied();
333 SingletonContainer::Get<ScreenManager>().OnRemoteDied();
334 SingletonContainer::Get<SessionManager>().ClearSessionManagerProxy();
335 return;
336 }
337
Clear()338 void BaseAdapter::Clear()
339 {
340 std::lock_guard<std::recursive_mutex> lock(mutex_);
341 if ((displayManagerServiceProxy_ != nullptr) && (displayManagerServiceProxy_->AsObject() != nullptr)) {
342 displayManagerServiceProxy_->AsObject()->RemoveDeathRecipient(dmsDeath_);
343 }
344 isProxyValid_ = false;
345 }
346
MakeMirror(ScreenId mainScreenId,std::vector<ScreenId> mirrorScreenId,ScreenId & screenGroupId)347 DMError ScreenManagerAdapter::MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenId,
348 ScreenId& screenGroupId)
349 {
350 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
351
352 return displayManagerServiceProxy_->MakeMirror(mainScreenId, mirrorScreenId, screenGroupId);
353 }
354
StopMirror(const std::vector<ScreenId> & mirrorScreenIds)355 DMError ScreenManagerAdapter::StopMirror(const std::vector<ScreenId>& mirrorScreenIds)
356 {
357 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
358
359 return displayManagerServiceProxy_->StopMirror(mirrorScreenIds);
360 }
361
GetScreenInfo(ScreenId screenId)362 sptr<ScreenInfo> ScreenManagerAdapter::GetScreenInfo(ScreenId screenId)
363 {
364 if (screenId == SCREEN_ID_INVALID) {
365 WLOGFE("screen id is invalid");
366 return nullptr;
367 }
368 INIT_PROXY_CHECK_RETURN(nullptr);
369
370 sptr<ScreenInfo> screenInfo = displayManagerServiceProxy_->GetScreenInfoById(screenId);
371 return screenInfo;
372 }
373
GetAllDisplayIds()374 std::vector<DisplayId> DisplayManagerAdapter::GetAllDisplayIds()
375 {
376 INIT_PROXY_CHECK_RETURN(std::vector<DisplayId>());
377
378 return displayManagerServiceProxy_->GetAllDisplayIds();
379 }
380
HasPrivateWindow(DisplayId displayId,bool & hasPrivateWindow)381 DMError DisplayManagerAdapter::HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow)
382 {
383 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
384
385 return displayManagerServiceProxy_->HasPrivateWindow(displayId, hasPrivateWindow);
386 }
387
GetDisplayInfo(DisplayId displayId)388 sptr<DisplayInfo> DisplayManagerAdapter::GetDisplayInfo(DisplayId displayId)
389 {
390 if (displayId == DISPLAY_ID_INVALID) {
391 WLOGFE("screen id is invalid");
392 return nullptr;
393 }
394 INIT_PROXY_CHECK_RETURN(nullptr);
395
396 return displayManagerServiceProxy_->GetDisplayInfoById(displayId);
397 }
398
GetCutoutInfo(DisplayId displayId)399 sptr<CutoutInfo> DisplayManagerAdapter::GetCutoutInfo(DisplayId displayId)
400 {
401 WLOGFI("DisplayManagerAdapter::GetCutoutInfo");
402 if (displayId == DISPLAY_ID_INVALID) {
403 WLOGFE("screen id is invalid");
404 return nullptr;
405 }
406 INIT_PROXY_CHECK_RETURN(nullptr);
407 return displayManagerServiceProxy_->GetCutoutInfo(displayId);
408 }
409
AddSurfaceNodeToDisplay(DisplayId displayId,std::shared_ptr<class RSSurfaceNode> & surfaceNode)410 DMError DisplayManagerAdapter::AddSurfaceNodeToDisplay(DisplayId displayId,
411 std::shared_ptr<class RSSurfaceNode>& surfaceNode)
412 {
413 if (displayId == DISPLAY_ID_INVALID) {
414 WLOGFE("screen id is invalid");
415 return DMError::DM_ERROR_INVALID_PARAM;
416 }
417 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
418 return displayManagerServiceProxy_->AddSurfaceNodeToDisplay(displayId, surfaceNode);
419 }
420
RemoveSurfaceNodeFromDisplay(DisplayId displayId,std::shared_ptr<class RSSurfaceNode> & surfaceNode)421 DMError DisplayManagerAdapter::RemoveSurfaceNodeFromDisplay(DisplayId displayId,
422 std::shared_ptr<class RSSurfaceNode>& surfaceNode)
423 {
424 if (displayId == DISPLAY_ID_INVALID) {
425 WLOGFE("screen id is invalid");
426 return DMError::DM_ERROR_INVALID_PARAM;
427 }
428 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
429 return displayManagerServiceProxy_->RemoveSurfaceNodeFromDisplay(displayId, surfaceNode);
430 }
431
IsFoldable()432 bool DisplayManagerAdapter::IsFoldable()
433 {
434 INIT_PROXY_CHECK_RETURN(false);
435
436 return displayManagerServiceProxy_->IsFoldable();
437 }
438
GetFoldStatus()439 FoldStatus DisplayManagerAdapter::GetFoldStatus()
440 {
441 INIT_PROXY_CHECK_RETURN(FoldStatus::UNKNOWN);
442
443 return displayManagerServiceProxy_->GetFoldStatus();
444 }
445
GetFoldDisplayMode()446 FoldDisplayMode DisplayManagerAdapter::GetFoldDisplayMode()
447 {
448 INIT_PROXY_CHECK_RETURN(FoldDisplayMode::UNKNOWN);
449
450 return displayManagerServiceProxy_->GetFoldDisplayMode();
451 }
452
SetFoldDisplayMode(const FoldDisplayMode mode)453 void DisplayManagerAdapter::SetFoldDisplayMode(const FoldDisplayMode mode)
454 {
455 INIT_PROXY_CHECK_RETURN();
456
457 return displayManagerServiceProxy_->SetFoldDisplayMode(mode);
458 }
459
GetCurrentFoldCreaseRegion()460 sptr<FoldCreaseRegion> DisplayManagerAdapter::GetCurrentFoldCreaseRegion()
461 {
462 INIT_PROXY_CHECK_RETURN(nullptr);
463
464 return displayManagerServiceProxy_->GetCurrentFoldCreaseRegion();
465 }
466
GetScreenGroupInfoById(ScreenId screenId)467 sptr<ScreenGroupInfo> ScreenManagerAdapter::GetScreenGroupInfoById(ScreenId screenId)
468 {
469 if (screenId == SCREEN_ID_INVALID) {
470 WLOGFE("screenGroup id is invalid");
471 return nullptr;
472 }
473 INIT_PROXY_CHECK_RETURN(nullptr);
474
475 return displayManagerServiceProxy_->GetScreenGroupInfoById(screenId);
476 }
477
GetAllScreenInfos(std::vector<sptr<ScreenInfo>> & screenInfos)478 DMError ScreenManagerAdapter::GetAllScreenInfos(std::vector<sptr<ScreenInfo>>& screenInfos)
479 {
480 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
481
482 return displayManagerServiceProxy_->GetAllScreenInfos(screenInfos);
483 }
484
MakeExpand(std::vector<ScreenId> screenId,std::vector<Point> startPoint,ScreenId & screenGroupId)485 DMError ScreenManagerAdapter::MakeExpand(std::vector<ScreenId> screenId, std::vector<Point> startPoint,
486 ScreenId& screenGroupId)
487 {
488 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
489
490 return displayManagerServiceProxy_->MakeExpand(screenId, startPoint, screenGroupId);
491 }
492
StopExpand(const std::vector<ScreenId> & expandScreenIds)493 DMError ScreenManagerAdapter::StopExpand(const std::vector<ScreenId>& expandScreenIds)
494 {
495 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
496
497 return displayManagerServiceProxy_->StopExpand(expandScreenIds);
498 }
499
500
RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens)501 void ScreenManagerAdapter::RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens)
502 {
503 INIT_PROXY_CHECK_RETURN();
504
505 displayManagerServiceProxy_->RemoveVirtualScreenFromGroup(screens);
506 }
507
SetScreenActiveMode(ScreenId screenId,uint32_t modeId)508 DMError ScreenManagerAdapter::SetScreenActiveMode(ScreenId screenId, uint32_t modeId)
509 {
510 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
511
512 return displayManagerServiceProxy_->SetScreenActiveMode(screenId, modeId);
513 }
514
SetVirtualPixelRatio(ScreenId screenId,float virtualPixelRatio)515 DMError ScreenManagerAdapter::SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio)
516 {
517 INIT_PROXY_CHECK_RETURN(DMError::DM_ERROR_INIT_DMS_PROXY_LOCKED);
518
519 return displayManagerServiceProxy_->SetVirtualPixelRatio(screenId, virtualPixelRatio);
520 }
521 } // namespace OHOS::Rosen