1 /*
2 * Copyright (c) 2022-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 "devicestatus_srv_stub.h"
17
18 #include <unistd.h>
19 #include <tokenid_kit.h>
20
21 #include "accesstoken_kit.h"
22 #include "ipc_skeleton.h"
23 #include "message_parcel.h"
24 #include "pixel_map.h"
25
26 #include "devicestatus_callback_proxy.h"
27 #include "devicestatus_common.h"
28 #include "devicestatus_define.h"
29 #include "drag_data_packer.h"
30 #include "preview_style_packer.h"
31 #include "proto.h"
32 #include "stationary_callback.h"
33 #include "stationary_data.h"
34 #include "include/util.h"
35 #include "utility.h"
36
37 #undef LOG_TAG
38 #define LOG_TAG "DeviceStatusSrvStub"
39
40 namespace OHOS {
41 namespace Msdp {
42 namespace DeviceStatus {
43
DeviceStatusSrvStub()44 DeviceStatusSrvStub::DeviceStatusSrvStub()
45 {
46 InitCoordination();
47 InitDrag();
48 }
49
InitCoordination()50 void DeviceStatusSrvStub::InitCoordination()
51 {
52 CALL_DEBUG_ENTER;
53 connFuncs_ = {
54 { static_cast<uint32_t>(DeviceInterfaceCode::DEVICESTATUS_SUBSCRIBE),
55 [this](MessageParcel &data, MessageParcel &reply) {
56 return this->SubscribeStub(data, reply);}
57 },
58 { static_cast<uint32_t>(DeviceInterfaceCode::DEVICESTATUS_UNSUBSCRIBE),
59 [this](MessageParcel &data, MessageParcel &reply) {
60 return this->UnsubscribeStub(data, reply);}
61 },
62 { static_cast<uint32_t>(DeviceInterfaceCode::DEVICESTATUS_GETCACHE),
63 [this](MessageParcel &data, MessageParcel &reply) {
64 return this->GetLatestDeviceStatusDataStub(data, reply);}
65 },
66 { static_cast<uint32_t>(DeviceInterfaceCode::REGISTER_COORDINATION_MONITOR),
67 [this](MessageParcel &data, MessageParcel &reply) {
68 return this->RegisterCoordinationMonitorStub(data, reply);}
69 },
70 { static_cast<uint32_t>(DeviceInterfaceCode::UNREGISTER_COORDINATION_MONITOR),
71 [this](MessageParcel &data, MessageParcel &reply) {
72 return this->UnregisterCoordinationMonitorStub(data, reply);}
73 },
74 { static_cast<uint32_t>(DeviceInterfaceCode::PREPARE_COORDINATION),
75 [this](MessageParcel &data, MessageParcel &reply) {
76 return this->PrepareCoordinationStub(data, reply);}
77 },
78 { static_cast<uint32_t>(DeviceInterfaceCode::UNPREPARE_COORDINATION),
79 [this](MessageParcel &data, MessageParcel &reply) {
80 return this->UnPrepareCoordinationStub(data, reply);}
81 },
82 { static_cast<uint32_t>(DeviceInterfaceCode::START_COORDINATION),
83 [this](MessageParcel &data, MessageParcel &reply) {
84 return this->ActivateCoordinationStub(data, reply);}
85 },
86 { static_cast<uint32_t>(DeviceInterfaceCode::STOP_COORDINATION),
87 [this](MessageParcel &data, MessageParcel &reply) {
88 return this->DeactivateCoordinationStub(data, reply);}
89 },
90 { static_cast<uint32_t>(DeviceInterfaceCode::GET_COORDINATION_STATE),
91 [this](MessageParcel &data, MessageParcel &reply) {
92 return this->GetCoordinationStateStub(data, reply);}
93 },
94 { static_cast<uint32_t>(DeviceInterfaceCode::GET_COORDINATION_STATE_SYNC),
95 [this](MessageParcel &data, MessageParcel &reply) {
96 return this->GetCoordinationStateSyncStub(data, reply);}
97 },
98 { static_cast<uint32_t>(DeviceInterfaceCode::ADD_HOT_AREA_MONITOR),
99 [this](MessageParcel &data, MessageParcel &reply) {
100 return this->AddHotAreaListenerStub(data, reply);}
101 },
102 { static_cast<uint32_t>(DeviceInterfaceCode::REMOVE_HOT_AREA_MONITOR),
103 [this](MessageParcel &data, MessageParcel &reply) {
104 return this->RemoveHotAreaListenerStub(data, reply);}
105 },
106 { static_cast<uint32_t>(DeviceInterfaceCode::REGISTER_SUBSCRIPT_MONITOR),
107 [this](MessageParcel &data, MessageParcel &reply) {
108 return this->AddSubscriptListenerStub(data, reply);}
109 },
110 { static_cast<uint32_t>(DeviceInterfaceCode::UNREGISTER_SUBSCRIPT_MONITOR),
111 [this](MessageParcel &data, MessageParcel &reply) {
112 return this->RemoveSubscriptListenerStub(data, reply);}
113 },
114 { static_cast<uint32_t>(DeviceInterfaceCode::REGISTER_COOPERATE_MONITOR),
115 [this](MessageParcel &data, MessageParcel &reply) {
116 return this->RegisterCooperateMonitorStub(data, reply);}
117 },
118 { static_cast<uint32_t>(DeviceInterfaceCode::UNREGISTER_COOPERATE_MONITOR),
119 [this](MessageParcel &data, MessageParcel &reply) {
120 return this->UnregisterCooperateMonitorStub(data, reply);}
121 },
122 { static_cast<uint32_t>(DeviceInterfaceCode::PREPARE_COOPERATE),
123 [this](MessageParcel &data, MessageParcel &reply) {
124 return this->PrepareCooperateStub(data, reply);}
125 },
126 { static_cast<uint32_t>(DeviceInterfaceCode::UNPREPARE_COOPERATE),
127 [this](MessageParcel &data, MessageParcel &reply) {
128 return this->UnPrepareCooperateStub(data, reply);}
129 },
130 { static_cast<uint32_t>(DeviceInterfaceCode::START_COOPERATE),
131 [this](MessageParcel &data, MessageParcel &reply) {
132 return this->ActivateCooperateStub(data, reply);}
133 },
134 { static_cast<uint32_t>(DeviceInterfaceCode::STOP_COOPERATE),
135 [this](MessageParcel &data, MessageParcel &reply) {
136 return this->DeactivateCooperateStub(data, reply);}
137 },
138 { static_cast<uint32_t>(DeviceInterfaceCode::GET_COOPERATE_STATE),
139 [this](MessageParcel &data, MessageParcel &reply) {
140 return this->GetCooperateStateStub(data, reply);}
141 }
142 };
143 }
144
InitDrag()145 void DeviceStatusSrvStub::InitDrag()
146 {
147 CALL_DEBUG_ENTER;
148 std::map<uint32_t, std::function<int32_t(MessageParcel &data, MessageParcel &reply)>> dragFuncs = {
149 { static_cast<uint32_t>(DeviceInterfaceCode::ALLOC_SOCKET_FD),
150 [this](MessageParcel &data, MessageParcel &reply) {
151 return this->HandleAllocSocketFdStub(data, reply);}
152 },
153 { static_cast<uint32_t>(DeviceInterfaceCode::START_DRAG),
154 [this](MessageParcel &data, MessageParcel &reply) {
155 return this->StartDragStub(data, reply);}
156 },
157 { static_cast<uint32_t>(DeviceInterfaceCode::STOP_DRAG),
158 [this](MessageParcel &data, MessageParcel &reply) {
159 return this->StopDragStub(data, reply);}
160 },
161 { static_cast<uint32_t>(DeviceInterfaceCode::UPDATED_DRAG_STYLE),
162 [this](MessageParcel &data, MessageParcel &reply) {
163 return this->UpdateDragStyleStub(data, reply);}
164 },
165 { static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_TARGET_PID),
166 [this](MessageParcel &data, MessageParcel &reply) {
167 return this->GetDragTargetPidStub(data, reply);}
168 },
169 { static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_TARGET_UDKEY),
170 [this](MessageParcel &data, MessageParcel &reply) {
171 return this->GetUdKeyStub(data, reply);}
172 },
173 { static_cast<uint32_t>(DeviceInterfaceCode::REGISTER_DRAG_MONITOR),
174 [this](MessageParcel &data, MessageParcel &reply) {
175 return this->AddDraglistenerStub(data, reply);}
176 },
177 { static_cast<uint32_t>(DeviceInterfaceCode::UNREGISTER_DRAG_MONITOR),
178 [this](MessageParcel &data, MessageParcel &reply) {
179 return this->RemoveDraglistenerStub(data, reply);}
180 },
181 { static_cast<uint32_t>(DeviceInterfaceCode::SET_DRAG_WINDOW_VISIBLE),
182 [this](MessageParcel &data, MessageParcel &reply) {
183 return this->SetDragWindowVisibleStub(data, reply);}
184 },
185 { static_cast<uint32_t>(DeviceInterfaceCode::GET_SHADOW_OFFSET),
186 [this](MessageParcel &data, MessageParcel &reply) {
187 return this->GetShadowOffsetStub(data, reply);}
188 },
189 { static_cast<uint32_t>(DeviceInterfaceCode::UPDATE_SHADOW_PIC),
190 [this](MessageParcel &data, MessageParcel &reply) {
191 return this->UpdateShadowPicStub(data, reply);}
192 },
193 { static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_DATA),
194 [this](MessageParcel &data, MessageParcel &reply) {
195 return this->GetDragDataStub(data, reply);}
196 },
197 { static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_STATE),
198 [this](MessageParcel &data, MessageParcel &reply) {
199 return this->GetDragStateStub(data, reply);}
200 },
201 { static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_SUMMARY),
202 [this](MessageParcel &data, MessageParcel &reply) {
203 return this->GetDragSummaryStub(data, reply);}
204 },
205 { static_cast<uint32_t>(DeviceInterfaceCode::ENTER_TEXT_EDITOR_AREA),
206 [this](MessageParcel &data, MessageParcel &reply) {
207 return this->EnterTextEditorAreaStub(data, reply);}
208 },
209 {static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_EXTRAINFO),
210 [this](MessageParcel &data, MessageParcel &reply) {
211 return this->GetExtraInfoStub(data, reply);}
212 },
213 {static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_ACTION),
214 [this](MessageParcel &data, MessageParcel &reply) {
215 return this->GetDragActionStub(data, reply);}
216 },
217 {static_cast<uint32_t>(DeviceInterfaceCode::UPDATE_PREVIEW_STYLE),
218 [this](MessageParcel &data, MessageParcel &reply) {
219 return this->UpdatePreviewStyleStub(data, reply);}
220 },
221 {static_cast<uint32_t>(DeviceInterfaceCode::UPDATE_PREVIEW_STYLE_WITH_ANIMATION),
222 [this](MessageParcel &data, MessageParcel &reply) {
223 return this->UpdatePreviewStyleWithAnimationStub(data, reply);}
224 },
225 {static_cast<uint32_t>(DeviceInterfaceCode::ADD_PRIVILEGE),
226 [this](MessageParcel &data, MessageParcel &reply) {
227 return this->AddPrivilegeStub(data, reply);}
228 },
229 {static_cast<uint32_t>(DeviceInterfaceCode::ERASE_MOUSE_ICON),
230 [this](MessageParcel &data, MessageParcel &reply) {
231 return this->EraseMouseIconStub(data, reply);}
232 },
233 };
234 connFuncs_.insert(dragFuncs.begin(), dragFuncs.end());
235 }
236
CheckCooperatePermission()237 bool DeviceStatusSrvStub::CheckCooperatePermission()
238 {
239 CALL_DEBUG_ENTER;
240 Security::AccessToken::AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID();
241 int32_t result = Security::AccessToken::AccessTokenKit::VerifyAccessToken(callerToken,
242 COOPERATE_PERMISSION);
243 return result == Security::AccessToken::PERMISSION_GRANTED;
244 }
245
IsSystemServiceCalling()246 bool DeviceStatusSrvStub::IsSystemServiceCalling()
247 {
248 const auto tokenId = IPCSkeleton::GetCallingTokenID();
249 const auto flag = Security::AccessToken::AccessTokenKit::GetTokenTypeFlag(tokenId);
250 if (flag == Security::AccessToken::ATokenTypeEnum::TOKEN_NATIVE ||
251 flag == Security::AccessToken::ATokenTypeEnum::TOKEN_SHELL) {
252 FI_HILOGD("system service calling, flag:%{public}u", flag);
253 return true;
254 }
255 return false;
256 }
257
IsSystemCalling()258 bool DeviceStatusSrvStub::IsSystemCalling()
259 {
260 if (IsSystemServiceCalling()) {
261 return true;
262 }
263 return Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(IPCSkeleton::GetCallingFullTokenID());
264 }
265
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)266 int32_t DeviceStatusSrvStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
267 MessageOption &option)
268 {
269 FI_HILOGD("cmd:%{public}d, flags:%{public}d", code, option.GetFlags());
270 std::u16string descriptor = DeviceStatusSrvStub::GetDescriptor();
271 std::u16string remoteDescriptor = data.ReadInterfaceToken();
272 if (descriptor != remoteDescriptor) {
273 FI_HILOGE("DeviceStatusSrvStub::OnRemoteRequest failed, descriptor is not matched");
274 return E_DEVICESTATUS_GET_SERVICE_FAILED;
275 }
276 auto it = connFuncs_.find(code);
277 if (it != connFuncs_.end()) {
278 return (it->second)(data, reply);
279 }
280 FI_HILOGE("Unknown code:%{public}u", code);
281 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
282 }
283
SubscribeStub(MessageParcel & data,MessageParcel & reply)284 int32_t DeviceStatusSrvStub::SubscribeStub(MessageParcel &data, MessageParcel &reply)
285 {
286 CALL_DEBUG_ENTER;
287 int32_t type = -1;
288 READINT32(data, type, E_DEVICESTATUS_READ_PARCEL_ERROR);
289 FI_HILOGD("Read type successfully");
290 int32_t event = -1;
291 READINT32(data, event, E_DEVICESTATUS_READ_PARCEL_ERROR);
292 FI_HILOGD("Read event successfully");
293 FI_HILOGD("event:%{public}d", event);
294 int32_t latency = -1;
295 READINT32(data, latency, E_DEVICESTATUS_READ_PARCEL_ERROR);
296 FI_HILOGD("Read latency successfully");
297 sptr<IRemoteObject> obj = data.ReadRemoteObject();
298 CHKPR(obj, E_DEVICESTATUS_READ_PARCEL_ERROR);
299 FI_HILOGI("Read remote obj successfully");
300 sptr<IRemoteDevStaCallback> callback = iface_cast<IRemoteDevStaCallback>(obj);
301 CHKPR(callback, E_DEVICESTATUS_READ_PARCEL_ERROR);
302 FI_HILOGI("Read callback successfully");
303 Subscribe(static_cast<Type>(type), static_cast<ActivityEvent>(event),
304 static_cast<ReportLatencyNs>(latency), callback);
305 return RET_OK;
306 }
307
UnsubscribeStub(MessageParcel & data,MessageParcel & reply)308 int32_t DeviceStatusSrvStub::UnsubscribeStub(MessageParcel &data, MessageParcel &reply)
309 {
310 CALL_DEBUG_ENTER;
311 int32_t type = -1;
312 READINT32(data, type, E_DEVICESTATUS_READ_PARCEL_ERROR);
313 int32_t event = -1;
314 READINT32(data, event, E_DEVICESTATUS_READ_PARCEL_ERROR);
315 FI_HILOGE("event:%{public}d", event);
316 sptr<IRemoteObject> obj = data.ReadRemoteObject();
317 CHKPR(obj, E_DEVICESTATUS_READ_PARCEL_ERROR);
318 sptr<IRemoteDevStaCallback> callback = iface_cast<IRemoteDevStaCallback>(obj);
319 CHKPR(callback, E_DEVICESTATUS_READ_PARCEL_ERROR);
320 Unsubscribe(static_cast<Type>(type), static_cast<ActivityEvent>(event), callback);
321 return RET_OK;
322 }
323
GetLatestDeviceStatusDataStub(MessageParcel & data,MessageParcel & reply)324 int32_t DeviceStatusSrvStub::GetLatestDeviceStatusDataStub(MessageParcel &data, MessageParcel &reply)
325 {
326 CALL_DEBUG_ENTER;
327 int32_t type = -1;
328 READINT32(data, type, E_DEVICESTATUS_READ_PARCEL_ERROR);
329 Data devicestatusData = GetCache(static_cast<Type>(type));
330 FI_HILOGD("devicestatusData.type:%{public}d", devicestatusData.type);
331 FI_HILOGD("devicestatusData.value:%{public}d", devicestatusData.value);
332 WRITEINT32(reply, devicestatusData.type, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
333 WRITEINT32(reply, devicestatusData.value, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
334 return RET_OK;
335 }
336
RegisterCoordinationMonitorStub(MessageParcel & data,MessageParcel & reply)337 int32_t DeviceStatusSrvStub::RegisterCoordinationMonitorStub(MessageParcel &data, MessageParcel &reply)
338 {
339 CALL_DEBUG_ENTER;
340 int32_t ret = RegisterCoordinationListener();
341 if (ret != RET_OK) {
342 FI_HILOGE("Call registerCoordinationEvent failed, ret:%{public}d", ret);
343 }
344 return ret;
345 }
346
UnregisterCoordinationMonitorStub(MessageParcel & data,MessageParcel & reply)347 int32_t DeviceStatusSrvStub::UnregisterCoordinationMonitorStub(MessageParcel &data, MessageParcel &reply)
348 {
349 CALL_DEBUG_ENTER;
350 int32_t ret = UnregisterCoordinationListener();
351 if (ret != RET_OK) {
352 FI_HILOGE("Call unregisterCoordinationEvent failed, ret:%{public}d", ret);
353 }
354 return ret;
355 }
356
PrepareCoordinationStub(MessageParcel & data,MessageParcel & reply)357 int32_t DeviceStatusSrvStub::PrepareCoordinationStub(MessageParcel &data, MessageParcel &reply)
358 {
359 CALL_DEBUG_ENTER;
360 int32_t userData = 0;
361 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
362 int32_t ret = PrepareCoordination(userData);
363 if (ret != RET_OK) {
364 FI_HILOGE("Call prepareCoordination failed, ret:%{public}d", ret);
365 }
366 return ret;
367 }
368
UnPrepareCoordinationStub(MessageParcel & data,MessageParcel & reply)369 int32_t DeviceStatusSrvStub::UnPrepareCoordinationStub(MessageParcel &data, MessageParcel &reply)
370 {
371 CALL_DEBUG_ENTER;
372 int32_t userData = 0;
373 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
374 int32_t ret = UnprepareCoordination(userData);
375 if (ret != RET_OK) {
376 FI_HILOGE("Call unprepareCoordination failed, ret:%{public}d", ret);
377 }
378 return ret;
379 }
380
ActivateCoordinationStub(MessageParcel & data,MessageParcel & reply)381 int32_t DeviceStatusSrvStub::ActivateCoordinationStub(MessageParcel &data, MessageParcel &reply)
382 {
383 CALL_DEBUG_ENTER;
384 int32_t userData = 0;
385 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
386 std::string remoteNetworkId;
387 READSTRING(data, remoteNetworkId, E_DEVICESTATUS_READ_PARCEL_ERROR);
388 int32_t startDeviceId = 0;
389 READINT32(data, startDeviceId, E_DEVICESTATUS_READ_PARCEL_ERROR);
390 int32_t ret = ActivateCoordination(userData, remoteNetworkId, startDeviceId);
391 if (ret != RET_OK) {
392 FI_HILOGE("Call ActivateCoordination failed, ret:%{public}d", ret);
393 }
394 return ret;
395 }
396
DeactivateCoordinationStub(MessageParcel & data,MessageParcel & reply)397 int32_t DeviceStatusSrvStub::DeactivateCoordinationStub(MessageParcel &data, MessageParcel &reply)
398 {
399 CALL_DEBUG_ENTER;
400 int32_t userData = 0;
401 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
402 bool isUnchained = false;
403 READBOOL(data, isUnchained, E_DEVICESTATUS_READ_PARCEL_ERROR);
404 int32_t ret = DeactivateCoordination(userData, isUnchained);
405 if (ret != RET_OK) {
406 FI_HILOGE("Call DeactivateCoordination failed, ret:%{public}d", ret);
407 }
408 return ret;
409 }
410
GetCoordinationStateStub(MessageParcel & data,MessageParcel & reply)411 int32_t DeviceStatusSrvStub::GetCoordinationStateStub(MessageParcel &data, MessageParcel &reply)
412 {
413 CALL_DEBUG_ENTER;
414 int32_t userData = 0;
415 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
416 std::string networkId;
417 READSTRING(data, networkId, E_DEVICESTATUS_READ_PARCEL_ERROR);
418 int32_t ret = GetCoordinationState(userData, networkId);
419 if (ret != RET_OK) {
420 FI_HILOGE("GetCoordinationStateStub failed, ret:%{public}d", ret);
421 }
422 return ret;
423 }
424
GetCoordinationStateSyncStub(MessageParcel & data,MessageParcel & reply)425 int32_t DeviceStatusSrvStub::GetCoordinationStateSyncStub(MessageParcel &data, MessageParcel &reply)
426 {
427 CALL_DEBUG_ENTER;
428 if (!IsSystemCalling()) {
429 FI_HILOGE("The caller is not system hap");
430 return COMMON_NOT_SYSTEM_APP;
431 }
432 if (!CheckCooperatePermission()) {
433 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
434 return COMMON_PERMISSION_CHECK_ERROR;
435 }
436 std::string udId;
437 READSTRING(data, udId, E_DEVICESTATUS_READ_PARCEL_ERROR);
438 bool state { false };
439 int32_t ret = GetCoordinationState(udId, state);
440 if (ret != RET_OK) {
441 FI_HILOGE("GetCoordinationState failed, ret:%{public}d", ret);
442 }
443 WRITEBOOL(reply, state, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
444 return ret;
445 }
446
RegisterCooperateMonitorStub(MessageParcel & data,MessageParcel & reply)447 int32_t DeviceStatusSrvStub::RegisterCooperateMonitorStub(MessageParcel &data,
448 MessageParcel &reply)
449 {
450 CALL_DEBUG_ENTER;
451 if (!IsSystemCalling()) {
452 FI_HILOGE("The caller is not system hap");
453 return COMMON_NOT_SYSTEM_APP;
454 }
455 if (!CheckCooperatePermission()) {
456 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
457 return COMMON_PERMISSION_CHECK_ERROR;
458 }
459 int32_t ret = RegisterCoordinationListener();
460 if (ret != RET_OK) {
461 FI_HILOGE("Call registerCoordinationEvent failed, ret:%{public}d", ret);
462 }
463 return ret;
464 }
465
UnregisterCooperateMonitorStub(MessageParcel & data,MessageParcel & reply)466 int32_t DeviceStatusSrvStub::UnregisterCooperateMonitorStub(MessageParcel &data,
467 MessageParcel &reply)
468 {
469 CALL_DEBUG_ENTER;
470 if (!IsSystemCalling()) {
471 FI_HILOGE("The caller is not system hap");
472 return COMMON_NOT_SYSTEM_APP;
473 }
474 if (!CheckCooperatePermission()) {
475 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
476 return COMMON_PERMISSION_CHECK_ERROR;
477 }
478 int32_t ret = UnregisterCoordinationListener();
479 if (ret != RET_OK) {
480 FI_HILOGE("Call unregisterCoordinationEvent failed, ret:%{public}d", ret);
481 }
482 return ret;
483 }
484
PrepareCooperateStub(MessageParcel & data,MessageParcel & reply)485 int32_t DeviceStatusSrvStub::PrepareCooperateStub(MessageParcel &data, MessageParcel &reply)
486 {
487 CALL_DEBUG_ENTER;
488 if (!IsSystemCalling()) {
489 FI_HILOGE("The caller is not system hap");
490 return COMMON_NOT_SYSTEM_APP;
491 }
492 if (!CheckCooperatePermission()) {
493 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
494 return COMMON_PERMISSION_CHECK_ERROR;
495 }
496 int32_t userData = 0;
497 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
498 int32_t ret = PrepareCoordination(userData);
499 if (ret != RET_OK) {
500 FI_HILOGE("Call prepareCoordination failed, ret:%{public}d", ret);
501 }
502 return ret;
503 }
504
UnPrepareCooperateStub(MessageParcel & data,MessageParcel & reply)505 int32_t DeviceStatusSrvStub::UnPrepareCooperateStub(MessageParcel &data, MessageParcel &reply)
506 {
507 CALL_DEBUG_ENTER;
508 if (!IsSystemCalling()) {
509 FI_HILOGE("The caller is not system hap");
510 return COMMON_NOT_SYSTEM_APP;
511 }
512 if (!CheckCooperatePermission()) {
513 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
514 return COMMON_PERMISSION_CHECK_ERROR;
515 }
516 int32_t userData = 0;
517 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
518 int32_t ret = UnprepareCoordination(userData);
519 if (ret != RET_OK) {
520 FI_HILOGE("Call unprepareCoordination failed, ret:%{public}d", ret);
521 }
522 return ret;
523 }
524
ActivateCooperateStub(MessageParcel & data,MessageParcel & reply)525 int32_t DeviceStatusSrvStub::ActivateCooperateStub(MessageParcel &data, MessageParcel &reply)
526 {
527 CALL_DEBUG_ENTER;
528 if (!IsSystemCalling()) {
529 FI_HILOGE("The caller is not system hap");
530 return COMMON_NOT_SYSTEM_APP;
531 }
532 if (!CheckCooperatePermission()) {
533 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
534 return COMMON_PERMISSION_CHECK_ERROR;
535 }
536 int32_t userData = 0;
537 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
538 std::string remoteNetworkId;
539 READSTRING(data, remoteNetworkId, E_DEVICESTATUS_READ_PARCEL_ERROR);
540 int32_t startDeviceId = 0;
541 READINT32(data, startDeviceId, E_DEVICESTATUS_READ_PARCEL_ERROR);
542 int32_t ret = ActivateCoordination(userData, remoteNetworkId, startDeviceId);
543 if (ret != RET_OK) {
544 FI_HILOGE("Call ActivateCoordination failed, ret:%{public}d", ret);
545 }
546 return ret;
547 }
548
DeactivateCooperateStub(MessageParcel & data,MessageParcel & reply)549 int32_t DeviceStatusSrvStub::DeactivateCooperateStub(MessageParcel &data, MessageParcel &reply)
550 {
551 CALL_DEBUG_ENTER;
552 if (!IsSystemCalling()) {
553 FI_HILOGE("The caller is not system hap");
554 return COMMON_NOT_SYSTEM_APP;
555 }
556 if (!CheckCooperatePermission()) {
557 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
558 return COMMON_PERMISSION_CHECK_ERROR;
559 }
560 int32_t userData = 0;
561 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
562 bool isUnchained = false;
563 READBOOL(data, isUnchained, E_DEVICESTATUS_READ_PARCEL_ERROR);
564 int32_t ret = DeactivateCoordination(userData, isUnchained);
565 if (ret != RET_OK) {
566 FI_HILOGE("Call DeactivateCoordination failed, ret:%{public}d", ret);
567 }
568 return ret;
569 }
570
GetCooperateStateStub(MessageParcel & data,MessageParcel & reply)571 int32_t DeviceStatusSrvStub::GetCooperateStateStub(MessageParcel &data, MessageParcel &reply)
572 {
573 CALL_DEBUG_ENTER;
574 if (!IsSystemCalling()) {
575 FI_HILOGE("The caller is not system hap");
576 return COMMON_NOT_SYSTEM_APP;
577 }
578 if (!CheckCooperatePermission()) {
579 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
580 return COMMON_PERMISSION_CHECK_ERROR;
581 }
582 int32_t userData = 0;
583 READINT32(data, userData, E_DEVICESTATUS_READ_PARCEL_ERROR);
584 std::string networkId;
585 READSTRING(data, networkId, E_DEVICESTATUS_READ_PARCEL_ERROR);
586 int32_t ret = GetCoordinationState(userData, networkId);
587 if (ret != RET_OK) {
588 FI_HILOGE("Call RegisterCoordinationEvent failed, ret:%{public}d", ret);
589 }
590 return ret;
591 }
592
UpdateDragStyleStub(MessageParcel & data,MessageParcel & reply)593 int32_t DeviceStatusSrvStub::UpdateDragStyleStub(MessageParcel &data, MessageParcel &reply)
594 {
595 int32_t style = 0;
596 READINT32(data, style, E_DEVICESTATUS_READ_PARCEL_ERROR);
597 int32_t ret = UpdateDragStyle(static_cast<DragCursorStyle>(style));
598 if (ret != RET_OK) {
599 FI_HILOGE("Call UpdateDragStyle failed, ret:%{public}d", ret);
600 }
601 return ret;
602 }
603
GetDragTargetPidStub(MessageParcel & data,MessageParcel & reply)604 int32_t DeviceStatusSrvStub::GetDragTargetPidStub(MessageParcel &data, MessageParcel &reply)
605 {
606 int32_t pid = GetDragTargetPid();
607 WRITEINT32(reply, pid, IPC_STUB_WRITE_PARCEL_ERR);
608 return RET_OK;
609 }
610
GetUdKeyStub(MessageParcel & data,MessageParcel & reply)611 int32_t DeviceStatusSrvStub::GetUdKeyStub(MessageParcel &data, MessageParcel &reply)
612 {
613 std::string udKey;
614 int32_t ret = GetUdKey(udKey);
615 if (ret != RET_OK) {
616 FI_HILOGE("Get udKey failed, ret:%{public}d", ret);
617 }
618 WRITESTRING(reply, udKey, IPC_STUB_WRITE_PARCEL_ERR);
619 FI_HILOGD("Target udKey:%{public}s", GetAnonyString(udKey).c_str());
620 return RET_OK;
621 }
622
HandleAllocSocketFdStub(MessageParcel & data,MessageParcel & reply)623 int32_t DeviceStatusSrvStub::HandleAllocSocketFdStub(MessageParcel &data, MessageParcel &reply)
624 {
625 int32_t pid = GetCallingPid();
626 if (!IsRunning()) {
627 FI_HILOGE("Service is not running, pid:%{public}d, go switch default", pid);
628 return SERVICE_NOT_RUNNING;
629 }
630 int32_t moduleId = 0;
631 READINT32(data, moduleId, E_DEVICESTATUS_READ_PARCEL_ERROR);
632 std::string clientName;
633 READSTRING(data, clientName, E_DEVICESTATUS_READ_PARCEL_ERROR);
634
635 int32_t clientFd = -1;
636 uint32_t tokenId = GetCallingTokenID();
637 int32_t tokenType = Security::AccessToken::AccessTokenKit::GetTokenTypeFlag(tokenId);
638 int32_t ret = AllocSocketFd(clientName, moduleId, clientFd, tokenType);
639 if (ret != RET_OK) {
640 FI_HILOGE("AllocSocketFd failed, pid:%{public}d, go switch default", pid);
641 if (clientFd >= 0) {
642 if (close(clientFd) < 0) {
643 FI_HILOGE("Close client fd failed, error:%{public}s, clientFd:%{public}d", strerror(errno), clientFd);
644 }
645 }
646 return ret;
647 }
648
649 if (!reply.WriteFileDescriptor(clientFd)) {
650 FI_HILOGE("Write file descriptor failed");
651 if (close(clientFd) < 0) {
652 FI_HILOGE("Close client fd failed, error:%{public}s, clientFd:%{public}d", strerror(errno), clientFd);
653 }
654 return IPC_STUB_WRITE_PARCEL_ERR;
655 }
656
657 WRITEINT32(reply, tokenType, IPC_STUB_WRITE_PARCEL_ERR);
658 FI_HILOGD("Send clientFd to client, clientFd:%{public}d, tokenType:%{public}d", clientFd, tokenType);
659 if (close(clientFd) < 0) {
660 FI_HILOGE("Close client fd failed, error:%{public}s, clientFd:%{public}d", strerror(errno), clientFd);
661 }
662 return RET_OK;
663 }
664
StartDragStub(MessageParcel & data,MessageParcel & reply)665 int32_t DeviceStatusSrvStub::StartDragStub(MessageParcel &data, MessageParcel &reply)
666 {
667 CALL_DEBUG_ENTER;
668 DragData dragData;
669 if (DragDataPacker::UnMarshalling(data, dragData) != RET_OK) {
670 FI_HILOGE("UnMarshalling dragData failed");
671 return E_DEVICESTATUS_READ_PARCEL_ERROR;
672 }
673 if (DragDataPacker::CheckDragData(dragData) != RET_OK) {
674 FI_HILOGE("CheckDragData failed");
675 return RET_ERR;
676 }
677 int32_t ret = StartDrag(dragData);
678 if (ret != RET_OK) {
679 FI_HILOGE("Call StartDrag failed, ret:%{public}d", ret);
680 }
681 WRITEINT32(reply, ret, IPC_STUB_WRITE_PARCEL_ERR);
682 return ret;
683 }
684
StopDragStub(MessageParcel & data,MessageParcel & reply)685 int32_t DeviceStatusSrvStub::StopDragStub(MessageParcel &data, MessageParcel &reply)
686 {
687 int32_t result = 0;
688 READINT32(data, result, E_DEVICESTATUS_READ_PARCEL_ERROR);
689 if ((result < static_cast<int32_t>(DragResult::DRAG_SUCCESS)) ||
690 (result > static_cast<int32_t>(DragResult::DRAG_EXCEPTION))) {
691 FI_HILOGE("Invalid result:%{public}d", result);
692 return RET_ERR;
693 }
694 bool hasCustomAnimation = false;
695 READBOOL(data, hasCustomAnimation, E_DEVICESTATUS_READ_PARCEL_ERROR);
696 int32_t mainWindow = -1;
697 READINT32(data, mainWindow, E_DEVICESTATUS_READ_PARCEL_ERROR);
698 int32_t dragBehavior = -1;
699 READINT32(data, dragBehavior, E_DEVICESTATUS_READ_PARCEL_ERROR);
700 if ((dragBehavior < static_cast<int32_t>(DragBehavior::UNKNOWN)) ||
701 (dragBehavior > static_cast<int32_t>(DragBehavior::MOVE))) {
702 FI_HILOGE("Invalid dragBehavior:%{public}d", dragBehavior);
703 return RET_ERR;
704 }
705 DragDropResult dropResult;
706 dropResult.result = static_cast<DragResult>(result);
707 dropResult.hasCustomAnimation = hasCustomAnimation;
708 dropResult.mainWindow = mainWindow;
709 dropResult.dragBehavior = static_cast<DragBehavior>(dragBehavior);
710 int32_t ret = StopDrag(dropResult);
711 if (ret != RET_OK) {
712 FI_HILOGE("Call StopDrag failed, ret:%{public}d", ret);
713 }
714 WRITEINT32(reply, ret, IPC_STUB_WRITE_PARCEL_ERR);
715 return ret;
716 }
717
AddDraglistenerStub(MessageParcel & data,MessageParcel & reply)718 int32_t DeviceStatusSrvStub::AddDraglistenerStub(MessageParcel &data, MessageParcel &reply)
719 {
720 int32_t ret = AddDraglistener();
721 if (ret != RET_OK) {
722 FI_HILOGE("Call AddDraglistener failed, ret:%{public}d", ret);
723 }
724 return ret;
725 }
726
RemoveDraglistenerStub(MessageParcel & data,MessageParcel & reply)727 int32_t DeviceStatusSrvStub::RemoveDraglistenerStub(MessageParcel &data, MessageParcel &reply)
728 {
729 int32_t ret = RemoveDraglistener();
730 if (ret != RET_OK) {
731 FI_HILOGE("Call RemoveDraglistener failed, ret:%{public}d", ret);
732 }
733 return ret;
734 }
735
AddSubscriptListenerStub(MessageParcel & data,MessageParcel & reply)736 int32_t DeviceStatusSrvStub::AddSubscriptListenerStub(MessageParcel &data, MessageParcel &reply)
737 {
738 int32_t ret = AddSubscriptListener();
739 if (ret != RET_OK) {
740 FI_HILOGE("Call AddSubscriptListener failed, ret:%{public}d", ret);
741 }
742 return ret;
743 }
744
RemoveSubscriptListenerStub(MessageParcel & data,MessageParcel & reply)745 int32_t DeviceStatusSrvStub::RemoveSubscriptListenerStub(MessageParcel &data, MessageParcel &reply)
746 {
747 int32_t ret = RemoveSubscriptListener();
748 if (ret != RET_OK) {
749 FI_HILOGE("Call RemoveSubscriptListener failed, ret:%{public}d", ret);
750 }
751 return ret;
752 }
753
SetDragWindowVisibleStub(MessageParcel & data,MessageParcel & reply)754 int32_t DeviceStatusSrvStub::SetDragWindowVisibleStub(MessageParcel &data, MessageParcel &reply)
755 {
756 bool visible = false;
757 READBOOL(data, visible, E_DEVICESTATUS_READ_PARCEL_ERROR);
758 bool isForce = false;
759 READBOOL(data, isForce, E_DEVICESTATUS_READ_PARCEL_ERROR);
760 int32_t ret = SetDragWindowVisible(visible, isForce);
761 if (ret != RET_OK) {
762 FI_HILOGE("Call SetDragWindowVisible failed, ret:%{public}d", ret);
763 }
764 return ret;
765 }
766
GetShadowOffsetStub(MessageParcel & data,MessageParcel & reply)767 int32_t DeviceStatusSrvStub::GetShadowOffsetStub(MessageParcel &data, MessageParcel &reply)
768 {
769 ShadowOffset shadowOffset;
770 if (GetShadowOffset(shadowOffset) != RET_OK) {
771 FI_HILOGE("GetShadowOffset failed");
772 return RET_ERR;
773 }
774 if (ShadowOffsetPacker::Marshalling(shadowOffset, reply) != RET_OK) {
775 FI_HILOGE("Marshalling shadowOffset failed");
776 return RET_ERR;
777 }
778 return RET_OK;
779 }
780
UpdateShadowPicStub(MessageParcel & data,MessageParcel & reply)781 int32_t DeviceStatusSrvStub::UpdateShadowPicStub(MessageParcel &data, MessageParcel &reply)
782 {
783 ShadowInfo shadowInfo;
784 if (ShadowPacker::UnPackShadowInfo(data, shadowInfo) != RET_OK) {
785 FI_HILOGE("UnPackShadowInfo failed");
786 return RET_ERR;
787 }
788 if (ShadowPacker::CheckShadowInfo(shadowInfo) != RET_OK) {
789 FI_HILOGE("CheckShadowInfo failed");
790 return RET_ERR;
791 }
792 int32_t ret = UpdateShadowPic(shadowInfo);
793 if (ret != RET_OK) {
794 FI_HILOGE("Call Update shadow picture failed, ret:%{public}d", ret);
795 }
796 return ret;
797 }
798
GetDragDataStub(MessageParcel & data,MessageParcel & reply)799 int32_t DeviceStatusSrvStub::GetDragDataStub(MessageParcel &data, MessageParcel &reply)
800 {
801 DragData dragData;
802 int32_t ret = GetDragData(dragData);
803 WRITEINT32(reply, ret, IPC_STUB_WRITE_PARCEL_ERR);
804
805 if (ret != RET_OK) {
806 FI_HILOGE("Get DragData failed, ret:%{public}d", ret);
807 return RET_ERR;
808 }
809 if (DragDataPacker::Marshalling(dragData, reply) != RET_OK) {
810 FI_HILOGE("Marshalling dragData failed");
811 return RET_ERR;
812 }
813 return ret;
814 }
815
AddHotAreaListenerStub(MessageParcel & data,MessageParcel & reply)816 int32_t DeviceStatusSrvStub::AddHotAreaListenerStub(MessageParcel &data, MessageParcel &reply)
817 {
818 CALL_DEBUG_ENTER;
819 if (!CheckCooperatePermission()) {
820 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
821 return COMMON_PERMISSION_CHECK_ERROR;
822 }
823 int32_t ret = AddHotAreaListener();
824 if (ret != RET_OK) {
825 FI_HILOGE("Call hot area listener failed, ret:%{public}d", ret);
826 }
827 return ret;
828 }
829
GetDragStateStub(MessageParcel & data,MessageParcel & reply)830 int32_t DeviceStatusSrvStub::GetDragStateStub(MessageParcel &data, MessageParcel &reply)
831 {
832 DragState dragState;
833 int32_t ret = GetDragState(dragState);
834 if (ret != RET_OK) {
835 FI_HILOGE("Get DragState failed, ret:%{public}d", ret);
836 return RET_ERR;
837 }
838 int32_t dragStateTmp = static_cast<int32_t>(dragState);
839 WRITEINT32(reply, dragStateTmp, ERR_INVALID_VALUE);
840 return ret;
841 }
842
RemoveHotAreaListenerStub(MessageParcel & data,MessageParcel & reply)843 int32_t DeviceStatusSrvStub::RemoveHotAreaListenerStub(MessageParcel &data, MessageParcel &reply)
844 {
845 CALL_DEBUG_ENTER;
846 if (!CheckCooperatePermission()) {
847 FI_HILOGE("The caller has no COOPERATE_MANAGER permission");
848 return COMMON_PERMISSION_CHECK_ERROR;
849 }
850 int32_t ret = RemoveHotAreaListener();
851 if (ret != RET_OK) {
852 FI_HILOGE("Call remove hot area listener failed, ret:%{public}d", ret);
853 }
854 return ret;
855 }
856
UpdatePreviewStyleStub(MessageParcel & data,MessageParcel & reply)857 int32_t DeviceStatusSrvStub::UpdatePreviewStyleStub(MessageParcel &data, MessageParcel &reply)
858 {
859 CALL_DEBUG_ENTER;
860 PreviewStyle previewStyle;
861 if (PreviewStylePacker::UnMarshalling(data, previewStyle) != RET_OK) {
862 FI_HILOGE("UnMarshalling previewStyle failed");
863 return RET_ERR;
864 }
865 int32_t ret = UpdatePreviewStyle(previewStyle);
866 if (ret != RET_OK) {
867 FI_HILOGE("UpdatePreviewStyle failed, ret:%{public}d", ret);
868 }
869 return ret;
870 }
871
UpdatePreviewStyleWithAnimationStub(MessageParcel & data,MessageParcel & reply)872 int32_t DeviceStatusSrvStub::UpdatePreviewStyleWithAnimationStub(MessageParcel &data, MessageParcel &reply)
873 {
874 CALL_DEBUG_ENTER;
875 PreviewStyle previewStyle;
876 if (PreviewStylePacker::UnMarshalling(data, previewStyle) != RET_OK) {
877 FI_HILOGE("UnMarshalling previewStyle failed");
878 return RET_ERR;
879 }
880 PreviewAnimation animation;
881 if (PreviewAnimationPacker::UnMarshalling(data, animation) != RET_OK) {
882 FI_HILOGE("UnMarshalling animation failed");
883 return RET_ERR;
884 }
885 int32_t ret = UpdatePreviewStyleWithAnimation(previewStyle, animation);
886 if (ret != RET_OK) {
887 FI_HILOGE("UpdatePreviewStyleWithAnimation failed, ret:%{public}d", ret);
888 }
889 return ret;
890 }
891
GetDragSummaryStub(MessageParcel & data,MessageParcel & reply)892 int32_t DeviceStatusSrvStub::GetDragSummaryStub(MessageParcel &data, MessageParcel &reply)
893 {
894 std::map<std::string, int64_t> summarys;
895 if (GetDragSummary(summarys) != RET_OK) {
896 FI_HILOGE("Get summarys failed");
897 return RET_ERR;
898 }
899 if (SummaryPacker::Marshalling(summarys, reply) != RET_OK) {
900 FI_HILOGE("Failed to summarys unmarshalling");
901 return ERR_INVALID_VALUE;
902 }
903 return RET_OK;
904 }
905
GetDragActionStub(MessageParcel & data,MessageParcel & reply)906 int32_t DeviceStatusSrvStub::GetDragActionStub(MessageParcel &data, MessageParcel &reply)
907 {
908 CALL_DEBUG_ENTER;
909 DragAction dragAction = DragAction::INVALID;
910 int32_t ret = GetDragAction(dragAction);
911 if (ret != RET_OK) {
912 return RET_ERR;
913 }
914 WRITEINT32(reply, static_cast<int32_t>(dragAction), IPC_STUB_WRITE_PARCEL_ERR);
915 return RET_OK;
916 }
917
EnterTextEditorAreaStub(MessageParcel & data,MessageParcel & reply)918 int32_t DeviceStatusSrvStub::EnterTextEditorAreaStub(MessageParcel &data, MessageParcel &reply)
919 {
920 CALL_DEBUG_ENTER;
921 bool enable = false;
922 READBOOL(data, enable, E_DEVICESTATUS_READ_PARCEL_ERROR);
923 int32_t ret = EnterTextEditorArea(enable);
924 if (ret != RET_OK) {
925 FI_HILOGE("Call EnterTextEditorArea failed, ret:%{public}d", ret);
926 }
927 return ret;
928 }
929
GetExtraInfoStub(MessageParcel & data,MessageParcel & reply)930 int32_t DeviceStatusSrvStub::GetExtraInfoStub(MessageParcel &data, MessageParcel &reply)
931 {
932 CALL_DEBUG_ENTER;
933 std::string extraInfo;
934 int32_t ret = GetExtraInfo(extraInfo);
935 if (ret != RET_OK) {
936 FI_HILOGE("Failed to get extraInfo in dragData");
937 return ret;
938 }
939 WRITESTRING(reply, extraInfo, IPC_STUB_WRITE_PARCEL_ERR);
940 return RET_OK;
941 }
942
AddPrivilegeStub(MessageParcel & data,MessageParcel & reply)943 int32_t DeviceStatusSrvStub::AddPrivilegeStub(MessageParcel &data, MessageParcel &reply)
944 {
945 CALL_DEBUG_ENTER;
946 int32_t ret = AddPrivilege();
947 if (ret != RET_OK) {
948 FI_HILOGE("Failed to get extraInfo in dragData");
949 return ret;
950 }
951 return RET_OK;
952 }
953
EraseMouseIconStub(MessageParcel & data,MessageParcel & reply)954 int32_t DeviceStatusSrvStub::EraseMouseIconStub(MessageParcel &data, MessageParcel &reply)
955 {
956 CALL_DEBUG_ENTER;
957 int32_t ret = EraseMouseIcon();
958 if (ret != RET_OK) {
959 FI_HILOGE("Failed to earse mouse in dragData");
960 }
961 return ret;
962 }
963 } // namespace DeviceStatus
964 } // namespace Msdp
965 } // namespace OHOS