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 #include "zidl/screen_session_manager_client_proxy.h"
17
18 #include "window_manager_hilog.h"
19
20 namespace OHOS::Rosen {
21 namespace {
22 constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_DISPLAY, "ScreenSessionManagerClientProxy" };
23 } // namespace
24
OnScreenConnectionChanged(SessionOption SessionOption,ScreenEvent screenEvent)25 void ScreenSessionManagerClientProxy::OnScreenConnectionChanged(SessionOption SessionOption, ScreenEvent screenEvent)
26 {
27 sptr<IRemoteObject> remote = Remote();
28 if (remote == nullptr) {
29 WLOGFE("remote is nullptr");
30 return;
31 }
32
33 MessageParcel data;
34 MessageParcel reply;
35 MessageOption option(MessageOption::TF_SYNC);
36 if (!data.WriteInterfaceToken(GetDescriptor())) {
37 WLOGFE("WriteInterfaceToken failed");
38 return;
39 }
40 if (!data.WriteUint64(SessionOption.rsId_)) {
41 WLOGFE("Write rsId failed");
42 return;
43 }
44 if (!data.WriteString(SessionOption.name_)) {
45 WLOGFE("Write name failed");
46 return;
47 }
48 if (!data.WriteBool(SessionOption.isExtend_)) {
49 WLOGFE("Write isExtended failed");
50 return;
51 }
52 if (!data.WriteString(SessionOption.innerName_)) {
53 WLOGFE("Write innerName failed");
54 return;
55 }
56 if (!data.WriteUint64(SessionOption.screenId_)) {
57 WLOGFE("Write screenId failed");
58 return;
59 }
60 if (!data.WriteUint8(static_cast<uint8_t>(screenEvent))) {
61 WLOGFE("Write screenEvent failed");
62 return;
63 }
64 if (remote->SendRequest(
65 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SCREEN_CONNECTION_CHANGED),
66 data, reply, option) != ERR_NONE) {
67 WLOGFE("SendRequest failed");
68 return;
69 }
70 }
71
SwitchUserCallback(std::vector<int32_t> oldScbPids,int32_t currentScbPid)72 void ScreenSessionManagerClientProxy::SwitchUserCallback(std::vector<int32_t> oldScbPids, int32_t currentScbPid)
73 {
74 sptr<IRemoteObject> remote = Remote();
75 if (remote == nullptr) {
76 WLOGFE("remote is nullptr");
77 return;
78 }
79
80 MessageParcel data;
81 MessageParcel reply;
82 MessageOption option(MessageOption::TF_SYNC);
83 if (!data.WriteInterfaceToken(GetDescriptor())) {
84 WLOGFE("WriteInterfaceToken failed");
85 return;
86 }
87 if (!data.WriteInt32Vector(oldScbPids)) {
88 WLOGFE("Write oldScbPids failed");
89 return;
90 }
91 if (!data.WriteInt32(currentScbPid)) {
92 WLOGFE("Write currentScbPid failed");
93 return;
94 }
95 if (remote->SendRequest(
96 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SWITCH_USER_CMD),
97 data, reply, option) != ERR_NONE) {
98 WLOGFE("SendRequest failed");
99 return;
100 }
101 }
102
OnScreenExtendChanged(ScreenId mainScreenId,ScreenId extendScreenId)103 void ScreenSessionManagerClientProxy::OnScreenExtendChanged(ScreenId mainScreenId, ScreenId extendScreenId)
104 {
105 sptr<IRemoteObject> remote = Remote();
106 if (remote == nullptr) {
107 WLOGE("remote is nullptr");
108 return;
109 }
110 MessageParcel data;
111 MessageParcel reply;
112 MessageOption option(MessageOption::TF_SYNC);
113 if (!data.WriteInterfaceToken(GetDescriptor())) {
114 WLOGFE("WriteInterfaceToken failed");
115 return;
116 }
117 if (!data.WriteUint64(mainScreenId)) {
118 WLOGFE("Write screenId failed");
119 return;
120 }
121 if (!data.WriteUint64(extendScreenId)) {
122 WLOGFE("Write screenOrientation failed");
123 return;
124 }
125 if (remote->SendRequest(
126 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SCREEN_EXTEND_CHANGED),
127 data, reply, option) != ERR_NONE) {
128 WLOGFE("SendRequest failed");
129 return;
130 }
131 }
132
OnPropertyChanged(ScreenId screenId,const ScreenProperty & property,ScreenPropertyChangeReason reason)133 void ScreenSessionManagerClientProxy::OnPropertyChanged(ScreenId screenId,
134 const ScreenProperty& property, ScreenPropertyChangeReason reason)
135 {
136 sptr<IRemoteObject> remote = Remote();
137 if (remote == nullptr) {
138 WLOGFE("remote is nullptr");
139 return;
140 }
141
142 MessageParcel data;
143 MessageParcel reply;
144 MessageOption option(MessageOption::TF_SYNC);
145 if (!data.WriteInterfaceToken(GetDescriptor())) {
146 WLOGFE("WriteInterfaceToken failed");
147 return;
148 }
149 if (!data.WriteUint64(screenId)) {
150 WLOGFE("Write screenId failed");
151 return;
152 }
153 if (!RSMarshallingHelper::Marshalling(data, property)) {
154 WLOGFE("Write property failed");
155 return;
156 }
157 if (!data.WriteUint32(static_cast<uint32_t>(reason))) {
158 WLOGFE("Write reason failed");
159 return;
160 }
161 if (remote->SendRequest(
162 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_PROPERTY_CHANGED),
163 data, reply, option) != ERR_NONE) {
164 WLOGFE("SendRequest failed");
165 return;
166 }
167 }
168
OnPowerStatusChanged(DisplayPowerEvent event,EventStatus status,PowerStateChangeReason reason)169 void ScreenSessionManagerClientProxy::OnPowerStatusChanged(DisplayPowerEvent event, EventStatus status,
170 PowerStateChangeReason reason)
171 {
172 MessageParcel data;
173 MessageParcel reply;
174 MessageOption option(MessageOption::TF_ASYNC);
175 if (!data.WriteInterfaceToken(GetDescriptor())) {
176 WLOGFE("WriteInterfaceToken failed");
177 return;
178 }
179 if (!data.WriteUint32(static_cast<uint32_t>(event))) {
180 WLOGFE("Write event failed");
181 return;
182 }
183 if (!data.WriteUint32(static_cast<uint32_t>(status))) {
184 WLOGFE("Write status failed");
185 return;
186 }
187 if (!data.WriteUint32(static_cast<uint32_t>(reason))) {
188 WLOGFE("Write reason failed");
189 return;
190 }
191 auto remote = Remote();
192 if (remote == nullptr) {
193 WLOGFE("SendRequest failed, Remote is nullptr");
194 return;
195 }
196 if (remote->SendRequest(
197 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_POWER_STATUS_CHANGED),
198 data, reply, option) != ERR_NONE) {
199 WLOGFE("SendRequest failed");
200 return;
201 }
202 }
203
OnSensorRotationChanged(ScreenId screenId,float sensorRotation)204 void ScreenSessionManagerClientProxy::OnSensorRotationChanged(ScreenId screenId, float sensorRotation)
205 {
206 sptr<IRemoteObject> remote = Remote();
207 if (remote == nullptr) {
208 WLOGFE("remote is nullptr");
209 return;
210 }
211
212 MessageParcel data;
213 MessageParcel reply;
214 MessageOption option(MessageOption::TF_SYNC);
215 if (!data.WriteInterfaceToken(GetDescriptor())) {
216 WLOGFE("WriteInterfaceToken failed");
217 return;
218 }
219 if (!data.WriteUint64(screenId)) {
220 WLOGFE("Write screenId failed");
221 return;
222 }
223 if (!data.WriteFloat(sensorRotation)) {
224 WLOGFE("Write sensorRotation failed");
225 return;
226 }
227 if (remote->SendRequest(
228 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SENSOR_ROTATION_CHANGED),
229 data, reply, option) != ERR_NONE) {
230 WLOGFE("SendRequest failed");
231 return;
232 }
233 }
234
OnHoverStatusChanged(ScreenId screenId,int32_t hoverStatus,bool needRotate)235 void ScreenSessionManagerClientProxy::OnHoverStatusChanged(ScreenId screenId, int32_t hoverStatus, bool needRotate)
236 {
237 sptr<IRemoteObject> remote = Remote();
238 if (remote == nullptr) {
239 WLOGFE("remote is nullptr");
240 return;
241 }
242
243 MessageParcel data;
244 MessageParcel reply;
245 MessageOption option(MessageOption::TF_SYNC);
246 if (!data.WriteInterfaceToken(GetDescriptor())) {
247 WLOGFE("WriteInterfaceToken failed");
248 return;
249 }
250 if (!data.WriteUint64(screenId)) {
251 WLOGFE("Write screenId failed");
252 return;
253 }
254 if (!data.WriteInt32(hoverStatus)) {
255 WLOGFE("Write hoverStatus failed");
256 return;
257 }
258 if (!data.WriteBool(needRotate)) {
259 WLOGFE("Write needRotate failed");
260 return;
261 }
262 if (remote->SendRequest(
263 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_HOVER_STATUS_CHANGED),
264 data, reply, option) != ERR_NONE) {
265 WLOGFE("SendRequest failed");
266 return;
267 }
268 }
269
OnScreenOrientationChanged(ScreenId screenId,float screenOrientation)270 void ScreenSessionManagerClientProxy::OnScreenOrientationChanged(ScreenId screenId, float screenOrientation)
271 {
272 sptr<IRemoteObject> remote = Remote();
273 if (remote == nullptr) {
274 WLOGE("remote is nullptr");
275 return;
276 }
277
278 MessageParcel data;
279 MessageParcel reply;
280 MessageOption option(MessageOption::TF_SYNC);
281 if (!data.WriteInterfaceToken(GetDescriptor())) {
282 WLOGFE("WriteInterfaceToken failed");
283 return;
284 }
285 if (!data.WriteUint64(screenId)) {
286 WLOGFE("Write screenId failed");
287 return;
288 }
289 if (!data.WriteFloat(screenOrientation)) {
290 WLOGFE("Write screenOrientation failed");
291 return;
292 }
293 if (remote->SendRequest(
294 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SCREEN_ORIENTATION_CHANGED),
295 data, reply, option) != ERR_NONE) {
296 WLOGFE("SendRequest failed");
297 return;
298 }
299 }
300
OnScreenRotationLockedChanged(ScreenId screenId,bool isLocked)301 void ScreenSessionManagerClientProxy::OnScreenRotationLockedChanged(ScreenId screenId, bool isLocked)
302 {
303 sptr<IRemoteObject> remote = Remote();
304 if (remote == nullptr) {
305 WLOGE("remote is nullptr");
306 return;
307 }
308
309 MessageParcel data;
310 MessageParcel reply;
311 MessageOption option(MessageOption::TF_SYNC);
312 if (!data.WriteInterfaceToken(GetDescriptor())) {
313 WLOGFE("WriteInterfaceToken failed");
314 return;
315 }
316 if (!data.WriteUint64(screenId)) {
317 WLOGFE("Write screenId failed");
318 return;
319 }
320 if (!data.WriteBool(isLocked)) {
321 WLOGFE("Write isLocked failed");
322 return;
323 }
324 if (remote->SendRequest(
325 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SCREEN_ROTATION_LOCKED_CHANGED),
326 data, reply, option) != ERR_NONE) {
327 WLOGFE("SendRequest failed");
328 return;
329 }
330 }
331
OnDisplayStateChanged(DisplayId defaultDisplayId,sptr<DisplayInfo> displayInfo,const std::map<DisplayId,sptr<DisplayInfo>> & displayInfoMap,DisplayStateChangeType type)332 void ScreenSessionManagerClientProxy::OnDisplayStateChanged(DisplayId defaultDisplayId, sptr<DisplayInfo> displayInfo,
333 const std::map<DisplayId, sptr<DisplayInfo>>& displayInfoMap, DisplayStateChangeType type)
334 {
335 sptr<IRemoteObject> remote = Remote();
336 if (remote == nullptr) {
337 WLOGE("remote is nullptr");
338 return;
339 }
340
341 MessageParcel data;
342 MessageParcel reply;
343 MessageOption option(MessageOption::TF_SYNC);
344 if (!data.WriteInterfaceToken(GetDescriptor())) {
345 WLOGFE("WriteInterfaceToken failed");
346 return;
347 }
348 if (!data.WriteUint64(defaultDisplayId)) {
349 WLOGFE("Write defaultDisplayId failed");
350 return;
351 }
352 if (!data.WriteStrongParcelable(displayInfo)) {
353 WLOGFE("Write displayInfo failed");
354 return;
355 }
356 auto mapSize = static_cast<uint32_t>(displayInfoMap.size());
357 if (!data.WriteUint32(mapSize)) {
358 WLOGFE("Write mapSize failed");
359 return;
360 }
361 for (auto [id, info] : displayInfoMap) {
362 if (!data.WriteUint64(id)) {
363 WLOGFE("Write id failed");
364 return;
365 }
366 if (!data.WriteStrongParcelable(info)) {
367 WLOGFE("Write info failed");
368 return;
369 }
370 }
371 if (!data.WriteUint32(static_cast<uint32_t>(type))) {
372 WLOGFE("Write type failed");
373 return;
374 }
375 if (remote->SendRequest(
376 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_DISPLAY_STATE_CHANGED),
377 data, reply, option) != ERR_NONE) {
378 WLOGFE("SendRequest failed");
379 return;
380 }
381 }
382
OnGetSurfaceNodeIdsFromMissionIdsChanged(std::vector<uint64_t> & missionIds,std::vector<uint64_t> & surfaceNodeIds,bool isBlackList)383 void ScreenSessionManagerClientProxy::OnGetSurfaceNodeIdsFromMissionIdsChanged(std::vector<uint64_t>& missionIds,
384 std::vector<uint64_t>& surfaceNodeIds, bool isBlackList)
385 {
386 sptr<IRemoteObject> remote = Remote();
387 if (remote == nullptr) {
388 WLOGE("remote is nullptr");
389 return;
390 }
391
392 MessageParcel data;
393 MessageParcel reply;
394 MessageOption option(MessageOption::TF_SYNC);
395 if (!data.WriteInterfaceToken(GetDescriptor())) {
396 WLOGFE("WriteInterfaceToken failed");
397 return;
398 }
399 if (!data.WriteUInt64Vector(missionIds)) {
400 WLOGFE("Write missionIds failed");
401 return;
402 }
403 if (!data.WriteUInt64Vector(surfaceNodeIds)) {
404 WLOGFE("Write surfaceNodeIds failed");
405 return;
406 }
407 if (!data.WriteBool(isBlackList)) {
408 WLOGFE("Write isBlackList failed");
409 return;
410 }
411 if (remote->SendRequest(static_cast<uint32_t>(
412 ScreenSessionManagerClientMessage::TRANS_ID_GET_SURFACENODEID_FROM_MISSIONID),
413 data, reply, option) != ERR_NONE) {
414 WLOGFE("SendRequest failed");
415 return;
416 }
417 reply.ReadUInt64Vector(&surfaceNodeIds);
418 }
419
OnUpdateFoldDisplayMode(FoldDisplayMode displayMode)420 void ScreenSessionManagerClientProxy::OnUpdateFoldDisplayMode(FoldDisplayMode displayMode)
421 {
422 sptr<IRemoteObject> remote = Remote();
423 if (remote == nullptr) {
424 WLOGE("remote is nullptr");
425 return;
426 }
427
428 MessageParcel data;
429 MessageParcel reply;
430 MessageOption option(MessageOption::TF_ASYNC);
431 if (!data.WriteInterfaceToken(GetDescriptor())) {
432 WLOGFE("WriteInterfaceToken failed");
433 return;
434 }
435 if (!data.WriteUint32(static_cast<uint32_t>(displayMode))) {
436 WLOGFE("Write displayMode failed");
437 return;
438 }
439 if (remote->SendRequest(
440 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_SET_FOLD_DISPLAY_MODE),
441 data, reply, option) != ERR_NONE) {
442 WLOGFE("SendRequest failed");
443 return;
444 }
445 }
446
OnScreenshot(DisplayId displayId)447 void ScreenSessionManagerClientProxy::OnScreenshot(DisplayId displayId)
448 {
449 MessageParcel data;
450 MessageParcel reply;
451 MessageOption option(MessageOption::TF_ASYNC);
452 if (!data.WriteInterfaceToken(GetDescriptor())) {
453 WLOGFE("WriteInterfaceToken failed");
454 return;
455 }
456 if (!data.WriteUint64(displayId)) {
457 WLOGFE("Write displayId failed");
458 return;
459 }
460 auto remote = Remote();
461 if (remote == nullptr) {
462 WLOGFE("SendRequest failed, Remote is nullptr");
463 return;
464 }
465 if (remote->SendRequest(
466 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SCREEN_SHOT),
467 data, reply, option) != ERR_NONE) {
468 WLOGFE("SendRequest failed");
469 return;
470 }
471 }
472
OnImmersiveStateChanged(ScreenId screenId,bool & immersive)473 void ScreenSessionManagerClientProxy::OnImmersiveStateChanged(ScreenId screenId, bool& immersive)
474 {
475 sptr<IRemoteObject> remote = Remote();
476 if (remote == nullptr) {
477 WLOGE("remote is nullptr");
478 return;
479 }
480
481 MessageParcel data;
482 MessageParcel reply;
483 MessageOption option(MessageOption::TF_SYNC);
484 if (!data.WriteInterfaceToken(GetDescriptor())) {
485 WLOGFE("WriteInterfaceToken failed");
486 return;
487 }
488 if (!data.WriteUint64(screenId)) {
489 WLOGFE("Write screenId failed");
490 return;
491 }
492 if (remote->SendRequest(
493 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_IMMERSIVE_STATE_CHANGED),
494 data, reply, option) != ERR_NONE) {
495 WLOGFE("SendRequest failed");
496 return;
497 }
498 immersive = reply.ReadBool();
499 }
500
SetDisplayNodeScreenId(ScreenId screenId,ScreenId displayNodeScreenId)501 void ScreenSessionManagerClientProxy::SetDisplayNodeScreenId(ScreenId screenId, ScreenId displayNodeScreenId)
502 {
503 sptr<IRemoteObject> remote = Remote();
504 if (remote == nullptr) {
505 WLOGE("remote is nullptr");
506 return;
507 }
508
509 MessageParcel data;
510 MessageParcel reply;
511 MessageOption option(MessageOption::TF_ASYNC);
512 if (!data.WriteInterfaceToken(GetDescriptor())) {
513 WLOGFE("WriteInterfaceToken failed");
514 return;
515 }
516 if (!data.WriteUint64(screenId)) {
517 WLOGFE("Write screenId failed");
518 return;
519 }
520 if (!data.WriteUint64(displayNodeScreenId)) {
521 WLOGFE("Write displayNodeScreenId failed");
522 return;
523 }
524 if (remote->SendRequest(
525 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_SET_DISPLAY_NODE_SCREEN_ID),
526 data, reply, option) != ERR_NONE) {
527 WLOGFE("SendRequest failed");
528 return;
529 }
530 }
531
SetVirtualPixelRatioSystem(ScreenId screenId,float virtualPixelRatio)532 void ScreenSessionManagerClientProxy::SetVirtualPixelRatioSystem(ScreenId screenId, float virtualPixelRatio)
533 {
534 sptr<IRemoteObject> remote = Remote();
535 if (remote == nullptr) {
536 WLOGE("remote is nullptr");
537 return;
538 }
539
540 MessageParcel data;
541 MessageParcel reply;
542 MessageOption option;
543 if (!data.WriteInterfaceToken(GetDescriptor())) {
544 WLOGFE("WriteInterfaceToken failed");
545 return;
546 }
547 if (!data.WriteUint64(screenId) || !data.WriteFloat(virtualPixelRatio)) {
548 WLOGFE("Write screenId/virtualPixelRatio failed");
549 return;
550 }
551 if (remote->SendRequest(
552 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_SET_VIRTUAL_PIXEL_RATIO_SYSTEM),
553 data, reply, option) != ERR_NONE) {
554 WLOGFE("SendRequest failed");
555 return;
556 }
557 }
558
OnFoldStatusChangedReportUE(const std::vector<std::string> & screenFoldInfo)559 void ScreenSessionManagerClientProxy::OnFoldStatusChangedReportUE(const std::vector<std::string>& screenFoldInfo)
560 {
561 sptr<IRemoteObject> remote = Remote();
562 if (remote == nullptr) {
563 WLOGE("remote is nullptr");
564 return;
565 }
566
567 MessageParcel data;
568 MessageParcel reply;
569 MessageOption option(MessageOption::TF_ASYNC);
570 if (!data.WriteInterfaceToken(GetDescriptor())) {
571 WLOGFE("WriteInterfaceToken failed");
572 return;
573 }
574 if (!data.WriteStringVector(screenFoldInfo)) {
575 WLOGFE("Write screenFoldInfo failed");
576 return;
577 }
578 if (remote->SendRequest(static_cast<uint32_t>(
579 ScreenSessionManagerClientMessage::TRANS_ID_ON_FOLDSTATUS_CHANGED_REPORT_UE),
580 data, reply, option) != ERR_NONE) {
581 WLOGFE("SendRequest failed");
582 return;
583 }
584 }
585
ScreenCaptureNotify(ScreenId mainScreenId,int32_t uid,const std::string & clientName)586 void ScreenSessionManagerClientProxy::ScreenCaptureNotify(ScreenId mainScreenId, int32_t uid,
587 const std::string& clientName)
588 {
589 sptr<IRemoteObject> remote = Remote();
590 if (remote == nullptr) {
591 WLOGE("remote is nullptr");
592 return;
593 }
594 MessageParcel data;
595 MessageParcel reply;
596 MessageOption option(MessageOption::TF_SYNC);
597 if (!data.WriteInterfaceToken(GetDescriptor())) {
598 WLOGFE("WriteInterfaceToken failed");
599 return;
600 }
601 if (!data.WriteUint64(mainScreenId) || !data.WriteInt32(uid) || !data.WriteString(clientName)) {
602 WLOGFE("Write screenId or uid or client failed");
603 return;
604 }
605 if (remote->SendRequest(
606 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SCREEN_CAPTURE_NOTIFY),
607 data, reply, option) != ERR_NONE) {
608 WLOGFE("SendRequest failed");
609 return;
610 }
611 }
612
OnCameraBackSelfieChanged(ScreenId screenId,bool isCameraBackSelfie)613 void ScreenSessionManagerClientProxy::OnCameraBackSelfieChanged(ScreenId screenId, bool isCameraBackSelfie)
614 {
615 sptr<IRemoteObject> remote = Remote();
616 if (remote == nullptr) {
617 WLOGE("remote is nullptr");
618 return;
619 }
620 MessageParcel data;
621 MessageParcel reply;
622 MessageOption option(MessageOption::TF_SYNC);
623 if (!data.WriteInterfaceToken(GetDescriptor())) {
624 WLOGFE("WriteInterfaceToken failed");
625 return;
626 }
627 if (!data.WriteUint64(screenId)) {
628 WLOGFE("Write screenId failed");
629 return;
630 }
631 if (!data.WriteBool(isCameraBackSelfie)) {
632 WLOGFE("Write isCameraBackSelfie failed");
633 return;
634 }
635 if (remote->SendRequest(
636 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_CAMERA_BACKSELFIE_CHANGED),
637 data, reply, option) != ERR_NONE) {
638 WLOGFE("SendRequest failed");
639 return;
640 }
641 }
642
OnSuperFoldStatusChanged(ScreenId screenId,SuperFoldStatus superFoldStatus)643 void ScreenSessionManagerClientProxy::OnSuperFoldStatusChanged(ScreenId screenId, SuperFoldStatus superFoldStatus)
644 {
645 sptr<IRemoteObject> remote = Remote();
646 if (remote == nullptr) {
647 WLOGE("remote is nullptr");
648 return;
649 }
650 MessageParcel data;
651 MessageParcel reply;
652 MessageOption option(MessageOption::TF_SYNC);
653 if (!data.WriteInterfaceToken(GetDescriptor())) {
654 WLOGFE("WriteInterfaceToken failed");
655 return;
656 }
657 if (!data.WriteUint64(static_cast<uint64_t>(screenId))) {
658 WLOGFE("Write screenId failed");
659 return;
660 }
661 if (!data.WriteUint32(static_cast<uint32_t>(superFoldStatus))) {
662 WLOGFE("Write superFoldStatus failed");
663 return;
664 }
665 if (remote->SendRequest(
666 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SUPER_FOLD_STATUS_CHANGED),
667 data, reply, option) != ERR_NONE) {
668 WLOGFE("SendRequest failed");
669 return;
670 }
671 }
672
OnExtendScreenConnectStatusChanged(ScreenId screenId,ExtendScreenConnectStatus extendScreenConnectStatus)673 void ScreenSessionManagerClientProxy::OnExtendScreenConnectStatusChanged(ScreenId screenId,
674 ExtendScreenConnectStatus extendScreenConnectStatus)
675 {
676 sptr<IRemoteObject> remote = Remote();
677 if (remote == nullptr) {
678 WLOGE("remote is nullptr");
679 return;
680 }
681 MessageParcel data;
682 MessageParcel reply;
683 MessageOption option(MessageOption::TF_SYNC);
684 if (!data.WriteInterfaceToken(GetDescriptor())) {
685 WLOGFE("WriteInterfaceToken failed");
686 return;
687 }
688 if (!data.WriteUint64(static_cast<uint64_t>(screenId))) {
689 WLOGFE("Write screenId failed");
690 return;
691 }
692 if (!data.WriteUint32(static_cast<uint32_t>(extendScreenConnectStatus))) {
693 WLOGFE("Write extendScreenConnectStatus failed");
694 return;
695 }
696 if (remote->SendRequest(
697 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_EXTEND_SCREEN_CONNECT_STATUS_CHANGED),
698 data, reply, option) != ERR_NONE) {
699 WLOGFE("SendRequest failed");
700 return;
701 }
702 }
703
OnSecondaryReflexionChanged(ScreenId screenId,bool isSecondaryReflexion)704 void ScreenSessionManagerClientProxy::OnSecondaryReflexionChanged(ScreenId screenId, bool isSecondaryReflexion)
705 {
706 sptr<IRemoteObject> remote = Remote();
707 if (remote == nullptr) {
708 WLOGE("remote is nullptr");
709 return;
710 }
711 MessageParcel data;
712 MessageParcel reply;
713 MessageOption option(MessageOption::TF_SYNC);
714 if (!data.WriteInterfaceToken(GetDescriptor())) {
715 WLOGFE("WriteInterfaceToken failed");
716 return;
717 }
718 if (!data.WriteUint64(static_cast<uint64_t>(screenId))) {
719 WLOGFE("Write screenId failed");
720 return;
721 }
722 if (!data.WriteUint32(static_cast<uint32_t>(isSecondaryReflexion))) {
723 WLOGFE("Write secondaryReflexion failed");
724 return;
725 }
726 if (remote->SendRequest(
727 static_cast<uint32_t>(ScreenSessionManagerClientMessage::TRANS_ID_ON_SECONDARY_REFLEXION_CHANGED),
728 data, reply, option) != ERR_NONE) {
729 WLOGFE("SendRequest failed");
730 return;
731 }
732 }
733 } // namespace OHOS::Rosen
734