• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "zidl/window_manager_stub.h"
17 #include <ipc_skeleton.h>
18 #include <key_event.h>
19 #include <rs_iwindow_animation_controller.h>
20 #include <rs_window_animation_target.h>
21 
22 #include "marshalling_helper.h"
23 #include "memory_guard.h"
24 #include "window_manager_hilog.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 namespace {
29 constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowManagerStub"};
30 }
31 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)32 int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
33     MessageOption& option)
34 {
35     MemoryGuard cacheGuard;
36     if (data.ReadInterfaceToken() != GetDescriptor()) {
37         WLOGFE("InterfaceToken check failed");
38         return ERR_TRANSACTION_FAILED;
39     }
40     auto msgId = static_cast<WindowManagerMessage>(code);
41     switch (msgId) {
42         case WindowManagerMessage::TRANS_ID_CREATE_WINDOW: {
43             sptr<IRemoteObject> windowObject = data.ReadRemoteObject();
44             sptr<IWindow> windowProxy = iface_cast<IWindow>(windowObject);
45             sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
46             std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Unmarshalling(data);
47             uint32_t windowId;
48             sptr<IRemoteObject> token = nullptr;
49             if (windowProperty && windowProperty->GetTokenState()) {
50                 token = data.ReadRemoteObject();
51             }
52             WMError errCode = CreateWindow(windowProxy, windowProperty, surfaceNode, windowId, token);
53             reply.WriteUint32(windowId);
54             reply.WriteInt32(static_cast<int32_t>(errCode));
55             if (windowProperty) {
56                 reply.WriteUint32(windowProperty->GetWindowFlags());
57                 reply.WriteUint32(windowProperty->GetApiCompatibleVersion());
58             }
59             break;
60         }
61         case WindowManagerMessage::TRANS_ID_ADD_WINDOW: {
62             sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
63             WMError errCode = AddWindow(windowProperty);
64             reply.WriteInt32(static_cast<int32_t>(errCode));
65             break;
66         }
67         case WindowManagerMessage::TRANS_ID_REMOVE_WINDOW: {
68             uint32_t windowId = 0;
69             if (!data.ReadUint32(windowId)) {
70                 TLOGE(WmsLogTag::WMS_LIFE, "TRANS_ID_REMOVE_WINDOW Read windowId failed.");
71                 return ERR_INVALID_DATA;
72             }
73             bool isFromInnerkits = false;
74             if (!data.ReadBool(isFromInnerkits)) {
75                 TLOGE(WmsLogTag::WMS_LIFE, "TRANS_ID_REMOVE_WINDOW Read isFromInnerkits failed.");
76                 return ERR_INVALID_DATA;
77             }
78             WMError errCode = RemoveWindow(windowId, isFromInnerkits);
79             reply.WriteInt32(static_cast<int32_t>(errCode));
80             break;
81         }
82         case WindowManagerMessage::TRANS_ID_DESTROY_WINDOW: {
83             uint32_t windowId = 0;
84             if (!data.ReadUint32(windowId)) {
85                 TLOGE(WmsLogTag::WMS_LIFE, "TRANS_ID_DESTROY_WINDOW Read windowId failed.");
86                 return ERR_INVALID_DATA;
87             }
88             WMError errCode = DestroyWindow(windowId);
89             reply.WriteInt32(static_cast<int32_t>(errCode));
90             break;
91         }
92         case WindowManagerMessage::TRANS_ID_REQUEST_FOCUS: {
93             uint32_t windowId = 0;
94             if (!data.ReadUint32(windowId)) {
95                 TLOGE(WmsLogTag::WMS_FOCUS, "read focus failed");
96                 return ERR_INVALID_DATA;
97             }
98             WMError errCode = RequestFocus(windowId);
99             reply.WriteInt32(static_cast<int32_t>(errCode));
100             break;
101         }
102         case WindowManagerMessage::TRANS_ID_GET_AVOID_AREA: {
103             uint32_t windowId = data.ReadUint32();
104             uint32_t avoidAreaTypeId = 0;
105             if (!data.ReadUint32(avoidAreaTypeId) ||
106                 avoidAreaTypeId >= static_cast<uint32_t>(AvoidAreaType::TYPE_END)) {
107                 return ERR_INVALID_DATA;
108             }
109             auto avoidAreaType = static_cast<AvoidAreaType>(avoidAreaTypeId);
110             Rect rect = {};
111             if (!data.ReadInt32(rect.posX_) || !data.ReadInt32(rect.posY_) ||
112                 !data.ReadUint32(rect.width_) || !data.ReadUint32(rect.height_)) {
113                 TLOGE(WmsLogTag::WMS_IMMS, "read rect error");
114                 return ERR_INVALID_DATA;
115             }
116             AvoidArea avoidArea = GetAvoidAreaByType(windowId, avoidAreaType, rect);
117             reply.WriteParcelable(&avoidArea);
118             break;
119         }
120         case WindowManagerMessage::TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT: {
121             uint32_t windowType = 0;
122             if (!data.ReadUint32(windowType) ||
123                 windowType >= static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_END)) {
124                 return ERR_INVALID_DATA;
125             }
126             auto type = static_cast<WindowManagerAgentType>(windowType);
127             sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
128             if (windowManagerAgentObject == nullptr) {
129                 return ERR_INVALID_DATA;
130             }
131             sptr<IWindowManagerAgent> windowManagerAgentProxy =
132                 iface_cast<IWindowManagerAgent>(windowManagerAgentObject);
133             WMError errCode = RegisterWindowManagerAgent(type, windowManagerAgentProxy);
134             reply.WriteInt32(static_cast<int32_t>(errCode));
135             break;
136         }
137         case WindowManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT: {
138             uint32_t windowType = 0;
139             if (!data.ReadUint32(windowType) ||
140                 windowType >= static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_END)) {
141                 return ERR_INVALID_DATA;
142             }
143             auto type = static_cast<WindowManagerAgentType>(windowType);
144             sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
145             if (windowManagerAgentObject == nullptr) {
146                 return ERR_INVALID_DATA;
147             }
148             sptr<IWindowManagerAgent> windowManagerAgentProxy =
149                 iface_cast<IWindowManagerAgent>(windowManagerAgentObject);
150             WMError errCode = UnregisterWindowManagerAgent(type, windowManagerAgentProxy);
151             reply.WriteInt32(static_cast<int32_t>(errCode));
152             break;
153         }
154         case WindowManagerMessage::TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG: {
155             uint32_t windowId = 0;
156             if (!data.ReadUint32(windowId)) {
157                 return ERR_INVALID_DATA;
158             }
159             sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
160             if (windowProperty == nullptr) {
161                 return ERR_INVALID_DATA;
162             }
163             sptr<MoveDragProperty> moveDragProperty = data.ReadStrongParcelable<MoveDragProperty>();
164             if (moveDragProperty == nullptr) {
165                 return ERR_INVALID_DATA;
166             }
167             NotifyServerReadyToMoveOrDrag(windowId, windowProperty, moveDragProperty);
168             break;
169         }
170         case WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN: {
171             uint32_t windowId = 0;
172             if (!data.ReadUint32(windowId)) {
173                 return ERR_INVALID_DATA;
174             }
175             bool isPointDown = false;
176             if (!data.ReadBool(isPointDown)) {
177                 return ERR_INVALID_DATA;
178             }
179             ProcessPointDown(windowId, isPointDown);
180             break;
181         }
182         case WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP: {
183             uint32_t windowId = 0;
184             if (!data.ReadUint32(windowId)) {
185                 return ERR_INVALID_DATA;
186             }
187             ProcessPointUp(windowId);
188             break;
189         }
190         case WindowManagerMessage::TRANS_ID_GET_TOP_WINDOW_ID: {
191             uint32_t mainWinId = 0;
192             if (!data.ReadUint32(mainWinId)) {
193                 TLOGE(WmsLogTag::WMS_HIERARCHY, "read mainWinId failed");
194                 return ERR_INVALID_DATA;
195             }
196             uint32_t topWinId = 0;
197             WMError errCode = GetTopWindowId(mainWinId, topWinId);
198             reply.WriteUint32(topWinId);
199             reply.WriteInt32(static_cast<int32_t>(errCode));
200             break;
201         }
202         case WindowManagerMessage::TRANS_ID_MINIMIZE_ALL_APP_WINDOWS: {
203             uint64_t displayId = 0;
204             if (!data.ReadUint64(displayId)) {
205                 TLOGE(WmsLogTag::WMS_LIFE, "Read displayID failed.");
206                 return ERR_INVALID_DATA;
207             }
208             WMError errCode = MinimizeAllAppWindows(displayId);
209             reply.WriteInt32(static_cast<int32_t>(errCode));
210             break;
211         }
212         case WindowManagerMessage::TRANS_ID_TOGGLE_SHOWN_STATE_FOR_ALL_APP_WINDOWS: {
213             WMError errCode = ToggleShownStateForAllAppWindows();
214             reply.WriteInt32(static_cast<int32_t>(errCode));
215             break;
216         }
217         case WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE: {
218             uint32_t layoutMode = 0;
219             if (!data.ReadUint32(layoutMode)) {
220                 TLOGE(WmsLogTag::WMS_LAYOUT, "read layoutMode failed");
221                 return ERR_INVALID_DATA;
222             }
223             auto mode = static_cast<WindowLayoutMode>(layoutMode);
224             WMError errCode = SetWindowLayoutMode(mode);
225             reply.WriteInt32(static_cast<int32_t>(errCode));
226             break;
227         }
228         case WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY: {
229             uint32_t actionValue = 0;
230             if (!data.ReadUint32(actionValue)) {
231                 TLOGE(WmsLogTag::DEFAULT, "read action error");
232                 return ERR_INVALID_DATA;
233             }
234             auto action = static_cast<PropertyChangeAction>(actionValue);
235             sptr<WindowProperty> windowProperty = new WindowProperty();
236             windowProperty->Read(data, action);
237             WMError errCode = UpdateProperty(windowProperty, action);
238             reply.WriteInt32(static_cast<int32_t>(errCode));
239             break;
240         }
241         case WindowManagerMessage::TRANS_ID_GET_ACCESSIBILITY_WINDOW_INFO_ID: {
242             std::vector<sptr<AccessibilityWindowInfo>> infos;
243             WMError errCode = GetAccessibilityWindowInfo(infos);
244             if (!MarshallingHelper::MarshallingVectorParcelableObj<AccessibilityWindowInfo>(reply, infos)) {
245                 WLOGFE("Write accessibility window infos failed");
246                 return -1;
247             }
248             reply.WriteInt32(static_cast<int32_t>(errCode));
249             break;
250         }
251         case WindowManagerMessage::TRANS_ID_GET_UNRELIABLE_WINDOW_INFO_ID: {
252             int32_t windowId = 0;
253             if (!data.ReadInt32(windowId)) {
254                 WLOGFE("Failed to readInt32 windowId");
255                 return ERR_INVALID_DATA;
256             }
257             std::vector<sptr<UnreliableWindowInfo>> infos;
258             WMError errCode = GetUnreliableWindowInfo(windowId, infos);
259             if (!MarshallingHelper::MarshallingVectorParcelableObj<UnreliableWindowInfo>(reply, infos)) {
260                 WLOGFE("Write unreliable window infos failed");
261                 return ERR_INVALID_DATA;
262             }
263             reply.WriteInt32(static_cast<int32_t>(errCode));
264             break;
265         }
266         case WindowManagerMessage::TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID: {
267             std::vector<sptr<WindowVisibilityInfo>> infos;
268             WMError errCode = GetVisibilityWindowInfo(infos);
269             if (!MarshallingHelper::MarshallingVectorParcelableObj<WindowVisibilityInfo>(reply, infos)) {
270                 WLOGFE("Write visibility window infos failed");
271                 return -1;
272             }
273             reply.WriteInt32(static_cast<int32_t>(errCode));
274             break;
275         }
276         case WindowManagerMessage::TRANS_ID_ANIMATION_SET_CONTROLLER: {
277             sptr<IRemoteObject> controllerObject = data.ReadRemoteObject();
278             if (controllerObject == nullptr) {
279                 TLOGE(WmsLogTag::DEFAULT, "Read animation controller object failed");
280                 return ERR_INVALID_DATA;
281             }
282             sptr<RSIWindowAnimationController> controller = iface_cast<RSIWindowAnimationController>(controllerObject);
283             WMError errCode = SetWindowAnimationController(controller);
284             reply.WriteInt32(static_cast<int32_t>(errCode));
285             break;
286         }
287         case WindowManagerMessage::TRANS_ID_GET_SYSTEM_CONFIG: {
288             SystemConfig config;
289             WMError errCode = GetSystemConfig(config);
290             reply.WriteParcelable(&config);
291             reply.WriteInt32(static_cast<int32_t>(errCode));
292             break;
293         }
294         case WindowManagerMessage::TRANS_ID_NOTIFY_WINDOW_TRANSITION: {
295             sptr<WindowTransitionInfo> from = data.ReadParcelable<WindowTransitionInfo>();
296             sptr<WindowTransitionInfo> to = data.ReadParcelable<WindowTransitionInfo>();
297             bool isFromClient = false;
298             if (!data.ReadBool(isFromClient)) {
299                 return ERR_INVALID_DATA;
300             }
301             WMError errCode = NotifyWindowTransition(from, to, isFromClient);
302             reply.WriteInt32(static_cast<int32_t>(errCode));
303             break;
304         }
305         case WindowManagerMessage::TRANS_ID_GET_FULLSCREEN_AND_SPLIT_HOT_ZONE: {
306             DisplayId displayId = 0;
307             if (!data.ReadUint64(displayId)) {
308                 TLOGE(WmsLogTag::WMS_FOCUS, "read displayId failed");
309                 return ERR_INVALID_DATA;
310             }
311             ModeChangeHotZones hotZones = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };
312             WMError errCode = GetModeChangeHotZones(displayId, hotZones);
313             reply.WriteInt32(static_cast<int32_t>(errCode));
314 
315             reply.WriteInt32(hotZones.fullscreen_.posX_);
316             reply.WriteInt32(hotZones.fullscreen_.posY_);
317             reply.WriteUint32(hotZones.fullscreen_.width_);
318             reply.WriteUint32(hotZones.fullscreen_.height_);
319 
320             reply.WriteInt32(hotZones.primary_.posX_);
321             reply.WriteInt32(hotZones.primary_.posY_);
322             reply.WriteUint32(hotZones.primary_.width_);
323             reply.WriteUint32(hotZones.primary_.height_);
324 
325             reply.WriteInt32(hotZones.secondary_.posX_);
326             reply.WriteInt32(hotZones.secondary_.posY_);
327             reply.WriteUint32(hotZones.secondary_.width_);
328             reply.WriteUint32(hotZones.secondary_.height_);
329             break;
330         }
331         case WindowManagerMessage::TRANS_ID_GET_ANIMATION_CALLBACK: {
332             std::vector<uint32_t> windowIds;
333             data.ReadUInt32Vector(&windowIds);
334             bool isAnimated = data.ReadBool();
335             sptr<RSIWindowAnimationFinishedCallback> finishedCallback = nullptr;
336             MinimizeWindowsByLauncher(windowIds, isAnimated, finishedCallback);
337             if (finishedCallback == nullptr) {
338                 if (!reply.WriteBool(false)) {
339                     WLOGFE("finishedCallback is nullptr and failed to write!");
340                     return ERR_INVALID_DATA;
341                 }
342             } else {
343                 if (!reply.WriteBool(true) || !reply.WriteRemoteObject(finishedCallback->AsObject())) {
344                     WLOGFE("finishedCallback is not nullptr and failed to write!");
345                     return ERR_INVALID_DATA;
346                 }
347             }
348             break;
349         }
350         case WindowManagerMessage::TRANS_ID_UPDATE_AVOIDAREA_LISTENER: {
351             uint32_t windowId = 0;
352             if (!data.ReadUint32(windowId)) {
353                 return ERR_INVALID_DATA;
354             }
355             bool haveAvoidAreaListener = false;
356             if (!data.ReadBool(haveAvoidAreaListener)) {
357                 return ERR_INVALID_DATA;
358             }
359             WMError errCode = UpdateAvoidAreaListener(windowId, haveAvoidAreaListener);
360             reply.WriteInt32(static_cast<int32_t>(errCode));
361             break;
362         }
363         case WindowManagerMessage::TRANS_ID_UPDATE_RS_TREE: {
364             uint32_t windowId = 0;
365             if (!data.ReadUint32(windowId)) {
366                 return ERR_INVALID_DATA;
367             }
368             bool isAdd = false;
369             if (!data.ReadBool(isAdd)) {
370                 return ERR_INVALID_DATA;
371             }
372             WMError errCode = UpdateRsTree(windowId, isAdd);
373             reply.WriteInt32(static_cast<int32_t>(errCode));
374             break;
375         }
376         case WindowManagerMessage::TRANS_ID_BIND_DIALOG_TARGET: {
377             uint32_t windowId = 0;
378             if (!data.ReadUint32(windowId)) {
379                 TLOGE(WmsLogTag::DEFAULT, "Failed to read windowId");
380                 return ERR_INVALID_DATA;
381             }
382             sptr<IRemoteObject> targetToken = data.ReadRemoteObject();
383             if (targetToken == nullptr) {
384                 TLOGE(WmsLogTag::WMS_DIALOG, "Read targetToken object failed!");
385                 return ERR_INVALID_DATA;
386             }
387             WMError errCode = BindDialogTarget(windowId, targetToken);
388             reply.WriteInt32(static_cast<int32_t>(errCode));
389             break;
390         }
391         case WindowManagerMessage::TRANS_ID_SET_ANCHOR_AND_SCALE : {
392             int32_t x = 0;
393             int32_t y = 0;
394             if (!data.ReadInt32(x) || !data.ReadInt32(y)) {
395                 return ERR_INVALID_DATA;
396             }
397             float scale = 0.0f;
398             if (!data.ReadFloat(scale)) {
399                 return ERR_INVALID_DATA;
400             }
401             SetAnchorAndScale(x, y, scale);
402             break;
403         }
404         case WindowManagerMessage::TRANS_ID_SET_ANCHOR_OFFSET: {
405             int32_t deltaX = 0;
406             int32_t deltaY = 0;
407             if (!data.ReadInt32(deltaX) || !data.ReadInt32(deltaY)) {
408                 return ERR_INVALID_DATA;
409             }
410             SetAnchorOffset(deltaX, deltaY);
411             break;
412         }
413         case WindowManagerMessage::TRANS_ID_OFF_WINDOW_ZOOM: {
414             OffWindowZoom();
415             break;
416         }
417         case WindowManagerMessage::TRANS_ID_RAISE_WINDOW_Z_ORDER: {
418             uint32_t windowId = 0;
419             if (!data.ReadUint32(windowId)) {
420                 TLOGE(WmsLogTag::WMS_HIERARCHY, "read windowId failed");
421                 return ERR_INVALID_DATA;
422             }
423             WMError errCode = RaiseToAppTop(windowId);
424             reply.WriteInt32(static_cast<int32_t>(errCode));
425             break;
426         }
427         case WindowManagerMessage::TRANS_ID_GET_SNAPSHOT: {
428             uint32_t windowId = 0;
429             if (!data.ReadUint32(windowId)) {
430                 TLOGE(WmsLogTag::WMS_ATTRIBUTE, "read windowId error");
431                 return ERR_INVALID_DATA;
432             }
433             std::shared_ptr<Media::PixelMap> pixelMap = GetSnapshot(windowId);
434             reply.WriteParcelable(pixelMap.get());
435             break;
436         }
437         case WindowManagerMessage::TRANS_ID_GESTURE_NAVIGATION_ENABLED: {
438             bool enable = data.ReadBool();
439             WMError errCode = SetGestureNavigationEnabled(enable);
440             reply.WriteInt32(static_cast<int32_t>(errCode));
441             break;
442         }
443         case WindowManagerMessage::TRANS_ID_SET_WINDOW_GRAVITY: {
444             uint32_t windowId = INVALID_WINDOW_ID;
445             if (!data.ReadUint32(windowId)) {
446                 TLOGE(WmsLogTag::WMS_KEYBOARD, "Read windowId failed.");
447                 return ERR_INVALID_DATA;
448             }
449             uint32_t gravityValue = 0;
450             if (!data.ReadUint32(gravityValue) ||
451                 gravityValue < static_cast<uint32_t>(WindowGravity::WINDOW_GRAVITY_FLOAT) ||
452                 gravityValue > static_cast<uint32_t>(WindowGravity::WINDOW_GRAVITY_BOTTOM)) {
453                 TLOGE(WmsLogTag::WMS_KEYBOARD, "Window gravity value read failed, gravityValue: %{public}d",
454                     gravityValue);
455                 return ERR_INVALID_DATA;
456             }
457             WindowGravity gravity = static_cast<WindowGravity>(gravityValue);
458             uint32_t percent = 0;
459             if (!data.ReadUint32(percent)) {
460                 TLOGE(WmsLogTag::WMS_KEYBOARD, "Percent read failed.");
461                 return ERR_INVALID_DATA;
462             }
463             WMError errCode = SetWindowGravity(windowId, gravity, percent);
464             reply.WriteInt32(static_cast<int32_t>(errCode));
465             break;
466         }
467         case WindowManagerMessage::TRANS_ID_DISPATCH_KEY_EVENT: {
468             uint32_t windowId = 0;
469             if (!data.ReadUint32(windowId)) {
470                 TLOGE(WmsLogTag::WMS_EVENT, "Read failed!");
471                 return ERR_INVALID_DATA;
472             }
473             std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
474             if (event == nullptr) {
475                 TLOGE(WmsLogTag::WMS_EVENT, "event is null");
476                 return ERR_INVALID_DATA;
477             }
478             event->ReadFromParcel(data);
479             DispatchKeyEvent(windowId, event);
480             break;
481         }
482         case WindowManagerMessage::TRANS_ID_NOTIFY_DUMP_INFO_RESULT: {
483             std::vector<std::string> info;
484             if (!data.ReadStringVector(&info)) {
485                 return ERR_INVALID_DATA;
486             }
487             NotifyDumpInfoResult(info);
488             break;
489         }
490         case WindowManagerMessage::TRANS_ID_GET_WINDOW_ANIMATION_TARGETS: {
491             std::vector<uint32_t> missionIds;
492             if (!data.ReadUInt32Vector(&missionIds)) {
493                 TLOGE(WmsLogTag::DEFAULT, "Read animation target mission ids failed");
494                 return ERR_INVALID_DATA;
495             }
496             std::vector<sptr<RSWindowAnimationTarget>> targets;
497             WMError errCode = GetWindowAnimationTargets(missionIds, targets);
498             if (!MarshallingHelper::MarshallingVectorParcelableObj<RSWindowAnimationTarget>(reply, targets)) {
499                 WLOGFE("Write window animation targets failed");
500                 return ERR_INVALID_DATA;
501             }
502             reply.WriteInt32(static_cast<int32_t>(errCode));
503             break;
504         }
505         case WindowManagerMessage::TRANS_ID_SET_MAXIMIZE_MODE: {
506             uint32_t modeId = 0;
507             if (!data.ReadUint32(modeId) || modeId >= static_cast<uint32_t>(MaximizeMode::MODE_END)) {
508                 return ERR_INVALID_DATA;
509             }
510             MaximizeMode maximizeMode = static_cast<MaximizeMode>(modeId);
511             SetMaximizeMode(maximizeMode);
512             break;
513         }
514         case WindowManagerMessage::TRANS_ID_GET_MAXIMIZE_MODE: {
515             MaximizeMode maximizeMode = GetMaximizeMode();
516             reply.WriteInt32(static_cast<int32_t>(maximizeMode));
517             break;
518         }
519         case WindowManagerMessage::TRANS_ID_GET_FOCUS_WINDOW_INFO: {
520             FocusChangeInfo focusInfo;
521             uint64_t displayId = 0;
522             if (!data.ReadUint64(displayId)) {
523                 TLOGE(WmsLogTag::WMS_FOCUS, "Failed to read displayId");
524                 return ERR_INVALID_DATA;
525             }
526             GetFocusWindowInfo(focusInfo, displayId);
527             reply.WriteParcelable(&focusInfo);
528             break;
529         }
530         default:
531             WLOGFW("unknown transaction code %{public}d", code);
532             return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
533     }
534     return ERR_NONE;
535 }
536 } // namespace Rosen
537 } // namespace OHOS
538