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 "call_manager_service_proxy.h"
17
18 #include "call_manager_errors.h"
19 #include "message_option.h"
20 #include "message_parcel.h"
21
22 namespace OHOS {
23 namespace Telephony {
CallManagerServiceProxy(const sptr<IRemoteObject> & impl)24 CallManagerServiceProxy::CallManagerServiceProxy(const sptr<IRemoteObject> &impl)
25 : IRemoteProxy<ICallManagerService>(impl)
26 {}
27
RegisterCallBack(const sptr<ICallAbilityCallback> & callback)28 int32_t CallManagerServiceProxy::RegisterCallBack(const sptr<ICallAbilityCallback> &callback)
29 {
30 MessageParcel dataParcel;
31 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
32 TELEPHONY_LOGE("write descriptor fail");
33 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
34 }
35 dataParcel.WriteRemoteObject(callback->AsObject().GetRefPtr());
36 MessageParcel replyParcel;
37
38 int32_t error = SendRequest(INTERFACE_REGISTER_CALLBACK, dataParcel, replyParcel);
39 if (error != TELEPHONY_SUCCESS) {
40 TELEPHONY_LOGE("Function RegisterCallBack! errCode:%{public}d", error);
41 return error;
42 }
43 return replyParcel.ReadInt32();
44 }
45
UnRegisterCallBack()46 int32_t CallManagerServiceProxy::UnRegisterCallBack()
47 {
48 return SendRequest(INTERFACE_UNREGISTER_CALLBACK);
49 }
50
ObserverOnCallDetailsChange()51 int32_t CallManagerServiceProxy::ObserverOnCallDetailsChange()
52 {
53 int32_t error = SendRequest(INTERFACE_OBSERVER_ON_CALL_DETAILS_CHANGE);
54 if (error != ERR_NONE) {
55 TELEPHONY_LOGE("function ObserverOnCallDetailsChange failed! errCode:%{public}d", error);
56 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
57 }
58 return TELEPHONY_SUCCESS;
59 }
60
DialCall(std::u16string number,AppExecFwk::PacMap & extras)61 int32_t CallManagerServiceProxy::DialCall(std::u16string number, AppExecFwk::PacMap &extras)
62 {
63 MessageParcel dataParcel;
64 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
65 TELEPHONY_LOGE("write descriptor fail");
66 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
67 }
68 if (number.empty()) {
69 TELEPHONY_LOGE("number is empty");
70 return TELEPHONY_ERR_ARGUMENT_INVALID;
71 }
72 dataParcel.WriteString16(number);
73 dataParcel.WriteInt32(extras.GetIntValue("accountId"));
74 dataParcel.WriteInt32(extras.GetIntValue("videoState"));
75 dataParcel.WriteInt32(extras.GetIntValue("dialScene"));
76 dataParcel.WriteInt32(extras.GetIntValue("dialType"));
77 dataParcel.WriteInt32(extras.GetIntValue("callType"));
78 MessageParcel replyParcel;
79 int32_t error = SendRequest(INTERFACE_DIAL_CALL, dataParcel, replyParcel);
80 if (error != TELEPHONY_SUCCESS) {
81 TELEPHONY_LOGE("function DialCall call failed! errCode:%{public}d", error);
82 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
83 }
84 return replyParcel.ReadInt32();
85 }
86
MakeCall(std::string number)87 int32_t CallManagerServiceProxy::MakeCall(std::string number)
88 {
89 MessageParcel dataParcel;
90 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
91 TELEPHONY_LOGE("write descriptor fail");
92 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
93 }
94 if (number.empty()) {
95 TELEPHONY_LOGE("number is empty");
96 return TELEPHONY_ERR_ARGUMENT_INVALID;
97 }
98 dataParcel.WriteString(number);
99 MessageParcel replyParcel;
100 int32_t error = SendRequest(INTERFACE_MAKE_CALL, dataParcel, replyParcel);
101 if (error != TELEPHONY_SUCCESS) {
102 TELEPHONY_LOGE("function MakeCall call failed! errCode:%{public}d", error);
103 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
104 }
105 return replyParcel.ReadInt32();
106 }
107
AnswerCall(int32_t callId,int32_t videoState)108 int32_t CallManagerServiceProxy::AnswerCall(int32_t callId, int32_t videoState)
109 {
110 MessageParcel dataParcel;
111 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
112 TELEPHONY_LOGE("write descriptor fail");
113 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
114 }
115 dataParcel.WriteInt32(callId);
116 dataParcel.WriteInt32(videoState);
117 MessageParcel replyParcel;
118 int32_t error = SendRequest(INTERFACE_ANSWER_CALL, dataParcel, replyParcel);
119 if (error != TELEPHONY_SUCCESS) {
120 TELEPHONY_LOGE("function AnswerCall call failed! errCode:%{public}d", error);
121 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
122 }
123 return replyParcel.ReadInt32();
124 }
125
RejectCall(int32_t callId,bool rejectWithMessage,std::u16string textMessage)126 int32_t CallManagerServiceProxy::RejectCall(int32_t callId, bool rejectWithMessage, std::u16string textMessage)
127 {
128 MessageParcel dataParcel;
129 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
130 TELEPHONY_LOGE("write descriptor fail");
131 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
132 }
133 dataParcel.WriteInt32(callId);
134 dataParcel.WriteBool(rejectWithMessage);
135 dataParcel.WriteString16(textMessage);
136 MessageParcel replyParcel;
137 int32_t error = SendRequest(INTERFACE_REJECT_CALL, dataParcel, replyParcel);
138 if (error != TELEPHONY_SUCCESS) {
139 TELEPHONY_LOGE("function RejectCall call failed! errCode:%{public}d", error);
140 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
141 }
142 return replyParcel.ReadInt32();
143 }
144
HangUpCall(int32_t callId)145 int32_t CallManagerServiceProxy::HangUpCall(int32_t callId)
146 {
147 MessageParcel dataParcel;
148 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
149 TELEPHONY_LOGE("write descriptor fail");
150 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
151 }
152 dataParcel.WriteInt32(callId);
153 MessageParcel replyParcel;
154 int32_t error = SendRequest(INTERFACE_DISCONNECT_CALL, dataParcel, replyParcel);
155 if (error != TELEPHONY_SUCCESS) {
156 TELEPHONY_LOGE("function HangUpCall call failed! errCode:%{public}d", error);
157 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
158 }
159 return replyParcel.ReadInt32();
160 }
161
GetCallState()162 int32_t CallManagerServiceProxy::GetCallState()
163 {
164 return SendRequest(INTERFACE_GET_CALL_STATE);
165 }
166
HoldCall(int32_t callId)167 int32_t CallManagerServiceProxy::HoldCall(int32_t callId)
168 {
169 MessageParcel dataParcel;
170 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
171 TELEPHONY_LOGE("write descriptor fail");
172 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
173 }
174 dataParcel.WriteInt32(callId);
175 MessageParcel replyParcel;
176 int32_t error = SendRequest(INTERFACE_HOLD_CALL, dataParcel, replyParcel);
177 if (error != TELEPHONY_SUCCESS) {
178 TELEPHONY_LOGE("Function HoldCall call failed! errCode:%{public}d", error);
179 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
180 }
181 return replyParcel.ReadInt32();
182 }
183
RegisterVoipCallManagerCallback()184 int32_t CallManagerServiceProxy::RegisterVoipCallManagerCallback()
185 {
186 int32_t error = SendRequest(INTERFACE_VOIP_REGISTER_CALLBACK);
187 if (error != ERR_NONE) {
188 TELEPHONY_LOGE("function RegisterVoipCallManagerCallback failed! errCode:%{public}d", error);
189 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
190 }
191 return 0;
192 }
193
UnRegisterVoipCallManagerCallback()194 int32_t CallManagerServiceProxy::UnRegisterVoipCallManagerCallback()
195 {
196 return SendRequest(INTERFACE_VOIP_UNREGISTER_CALLBACK);
197 }
198
UnHoldCall(int32_t callId)199 int32_t CallManagerServiceProxy::UnHoldCall(int32_t callId)
200 {
201 MessageParcel dataParcel;
202 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
203 TELEPHONY_LOGE("write descriptor fail");
204 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
205 }
206 dataParcel.WriteInt32(callId);
207 MessageParcel replyParcel;
208 int32_t error = SendRequest(INTERFACE_UNHOLD_CALL, dataParcel, replyParcel);
209 if (error != TELEPHONY_SUCCESS) {
210 TELEPHONY_LOGE("Function UnHoldCall call failed! errCode:%{public}d", error);
211 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
212 }
213 return replyParcel.ReadInt32();
214 }
215
SwitchCall(int32_t callId)216 int32_t CallManagerServiceProxy::SwitchCall(int32_t callId)
217 {
218 MessageParcel dataParcel;
219 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
220 TELEPHONY_LOGE("write descriptor fail");
221 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
222 }
223 dataParcel.WriteInt32(callId);
224 MessageParcel replyParcel;
225 int32_t error = SendRequest(INTERFACE_SWAP_CALL, dataParcel, replyParcel);
226 if (error != TELEPHONY_SUCCESS) {
227 TELEPHONY_LOGE("Function SwitchCall call failed! errCode:%{public}d", error);
228 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
229 }
230 return replyParcel.ReadInt32();
231 }
232
HasCall()233 bool CallManagerServiceProxy::HasCall()
234 {
235 MessageParcel dataParcel;
236 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
237 TELEPHONY_LOGE("write descriptor fail");
238 return false;
239 }
240 MessageParcel replyParcel;
241 int32_t error = SendRequest(INTERFACE_HAS_CALL, dataParcel, replyParcel);
242 if (error != TELEPHONY_SUCCESS) {
243 TELEPHONY_LOGE("Function HasCall! errCode:%{public}d", error);
244 return false;
245 }
246 return replyParcel.ReadBool();
247 }
248
IsNewCallAllowed(bool & enabled)249 int32_t CallManagerServiceProxy::IsNewCallAllowed(bool &enabled)
250 {
251 MessageParcel dataParcel;
252 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
253 TELEPHONY_LOGE("write descriptor fail");
254 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
255 }
256 MessageParcel replyParcel;
257 int32_t error = SendRequest(INTERFACE_IS_NEW_CALL_ALLOWED, dataParcel, replyParcel);
258 if (error != TELEPHONY_SUCCESS) {
259 TELEPHONY_LOGE("Function IsNewCallAllowed! errCode:%{public}d", error);
260 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
261 }
262 int32_t result = replyParcel.ReadInt32();
263 if (result == TELEPHONY_ERR_SUCCESS) {
264 enabled = replyParcel.ReadBool();
265 }
266 return result;
267 }
268
SetMuted(bool isMute)269 int32_t CallManagerServiceProxy::SetMuted(bool isMute)
270 {
271 MessageParcel dataParcel;
272 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
273 TELEPHONY_LOGE("write descriptor fail");
274 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
275 }
276 dataParcel.WriteBool(isMute);
277 MessageParcel replyParcel;
278 int32_t error = SendRequest(INTERFACE_SET_MUTE, dataParcel, replyParcel);
279 if (error != TELEPHONY_SUCCESS) {
280 TELEPHONY_LOGE("function SetMute failed! errCode:%{public}d", error);
281 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
282 }
283 return replyParcel.ReadInt32();
284 }
285
MuteRinger()286 int32_t CallManagerServiceProxy::MuteRinger()
287 {
288 return SendRequest(INTERFACE_MUTE_RINGER);
289 }
290
SetAudioDevice(const AudioDevice & audioDevice)291 int32_t CallManagerServiceProxy::SetAudioDevice(const AudioDevice &audioDevice)
292 {
293 MessageParcel dataParcel;
294 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
295 TELEPHONY_LOGE("write descriptor fail");
296 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
297 }
298 dataParcel.WriteRawData((const void *)&audioDevice, sizeof(AudioDevice));
299 MessageParcel replyParcel;
300 int32_t error = SendRequest(INTERFACE_SET_AUDIO_DEVICE, dataParcel, replyParcel);
301 if (error != TELEPHONY_SUCCESS) {
302 TELEPHONY_LOGE("function SetAudioDevice failed! errCode:%{public}d", error);
303 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
304 }
305 return replyParcel.ReadInt32();
306 }
307
IsRinging(bool & enabled)308 int32_t CallManagerServiceProxy::IsRinging(bool &enabled)
309 {
310 MessageParcel dataParcel;
311 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
312 TELEPHONY_LOGE("write descriptor fail");
313 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
314 }
315 MessageParcel replyParcel;
316 int32_t error = SendRequest(INTERFACE_IS_RINGING, dataParcel, replyParcel);
317 if (error != TELEPHONY_SUCCESS) {
318 TELEPHONY_LOGE("function IsRinging errCode:%{public}d", error);
319 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
320 }
321 int32_t result = replyParcel.ReadInt32();
322 if (result == TELEPHONY_ERR_SUCCESS) {
323 enabled = replyParcel.ReadBool();
324 }
325 return result;
326 }
327
IsInEmergencyCall(bool & enabled)328 int32_t CallManagerServiceProxy::IsInEmergencyCall(bool &enabled)
329 {
330 MessageParcel dataParcel;
331 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
332 TELEPHONY_LOGE("write descriptor fail");
333 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
334 }
335 MessageParcel replyParcel;
336 int32_t error = SendRequest(INTERFACE_IS_EMERGENCY_CALL, dataParcel, replyParcel);
337 if (error != TELEPHONY_SUCCESS) {
338 TELEPHONY_LOGE("function IsInEmergencyCall errCode:%{public}d", error);
339 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
340 }
341 int32_t result = replyParcel.ReadInt32();
342 if (result == TELEPHONY_ERR_SUCCESS) {
343 enabled = replyParcel.ReadBool();
344 }
345 return result;
346 }
347
StartDtmf(int32_t callId,char str)348 int32_t CallManagerServiceProxy::StartDtmf(int32_t callId, char str)
349 {
350 MessageParcel dataParcel;
351 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
352 TELEPHONY_LOGE("write descriptor fail");
353 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
354 }
355 dataParcel.WriteInt32(callId);
356 dataParcel.WriteInt8(str);
357 MessageParcel replyParcel;
358 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_START_DTMF, dataParcel, replyParcel);
359 if (error != TELEPHONY_SUCCESS) {
360 TELEPHONY_LOGE("Function StartDtmf! errCode:%{public}d", error);
361 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
362 }
363 return replyParcel.ReadInt32();
364 }
365
StopDtmf(int32_t callId)366 int32_t CallManagerServiceProxy::StopDtmf(int32_t callId)
367 {
368 MessageParcel dataParcel;
369 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
370 TELEPHONY_LOGE("write descriptor fail");
371 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
372 }
373 dataParcel.WriteInt32(callId);
374 MessageParcel replyParcel;
375 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_STOP_DTMF, dataParcel, replyParcel);
376 if (error != TELEPHONY_SUCCESS) {
377 TELEPHONY_LOGE("Function StopDtmf! errCode:%{public}d", error);
378 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
379 }
380 return replyParcel.ReadInt32();
381 }
382
PostDialProceed(int32_t callId,bool proceed)383 int32_t CallManagerServiceProxy::PostDialProceed(int32_t callId, bool proceed)
384 {
385 MessageParcel dataParcel;
386 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
387 TELEPHONY_LOGE("WriteInterfaceToken fail");
388 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
389 }
390 dataParcel.WriteInt32(callId);
391 dataParcel.WriteBool(proceed);
392 MessageParcel replyParcel;
393 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_POST_DIAL_PROCEED, dataParcel, replyParcel);
394 if (error != TELEPHONY_SUCCESS) {
395 TELEPHONY_LOGE("Function PostDialProceed! errCode:%{public}d", error);
396 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
397 }
398 return replyParcel.ReadInt32();
399 }
400
GetCallWaiting(int32_t slotId)401 int32_t CallManagerServiceProxy::GetCallWaiting(int32_t slotId)
402 {
403 MessageParcel dataParcel;
404 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
405 TELEPHONY_LOGE("write descriptor fail");
406 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
407 }
408 dataParcel.WriteInt32(slotId);
409 MessageParcel replyParcel;
410 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_GET_CALL_WAITING, dataParcel, replyParcel);
411 if (error != TELEPHONY_SUCCESS) {
412 TELEPHONY_LOGE("Function GetCallWaiting! errCode:%{public}d", error);
413 return error;
414 }
415 return replyParcel.ReadInt32();
416 }
417
SetCallWaiting(int32_t slotId,bool activate)418 int32_t CallManagerServiceProxy::SetCallWaiting(int32_t slotId, bool activate)
419 {
420 MessageParcel dataParcel;
421 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
422 TELEPHONY_LOGE("write descriptor fail");
423 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
424 }
425 dataParcel.WriteInt32(slotId);
426 dataParcel.WriteBool(activate);
427 MessageParcel replyParcel;
428 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_SET_CALL_WAITING, dataParcel, replyParcel);
429 if (error != TELEPHONY_SUCCESS) {
430 TELEPHONY_LOGE("Function SetCallWaiting! errCode:%{public}d", error);
431 return error;
432 }
433 return replyParcel.ReadInt32();
434 }
435
GetCallRestriction(int32_t slotId,CallRestrictionType type)436 int32_t CallManagerServiceProxy::GetCallRestriction(int32_t slotId, CallRestrictionType type)
437 {
438 MessageParcel dataParcel;
439 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
440 TELEPHONY_LOGE("write descriptor fail");
441 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
442 }
443 dataParcel.WriteInt32(slotId);
444 dataParcel.WriteInt32(static_cast<int32_t>(type));
445 MessageParcel replyParcel;
446 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_GET_CALL_RESTRICTION, dataParcel, replyParcel);
447 if (error != TELEPHONY_SUCCESS) {
448 TELEPHONY_LOGE("Function GetCallRestriction! errCode:%{public}d", error);
449 return error;
450 }
451 return replyParcel.ReadInt32();
452 }
453
SetCallRestriction(int32_t slotId,CallRestrictionInfo & info)454 int32_t CallManagerServiceProxy::SetCallRestriction(int32_t slotId, CallRestrictionInfo &info)
455 {
456 MessageParcel dataParcel;
457 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
458 TELEPHONY_LOGE("write descriptor fail");
459 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
460 }
461 dataParcel.WriteInt32(slotId);
462 dataParcel.WriteRawData((const void *)&info, sizeof(CallRestrictionInfo));
463 MessageParcel replyParcel;
464 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_SET_CALL_RESTRICTION, dataParcel, replyParcel);
465 if (error != TELEPHONY_SUCCESS) {
466 TELEPHONY_LOGE("Function SetCallRestriction! errCode:%{public}d", error);
467 return error;
468 }
469 return replyParcel.ReadInt32();
470 }
471
SetCallRestrictionPassword(int32_t slotId,CallRestrictionType fac,const char * oldPassword,const char * newPassword)472 int32_t CallManagerServiceProxy::SetCallRestrictionPassword(
473 int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword)
474 {
475 MessageParcel dataParcel;
476 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
477 TELEPHONY_LOGE("write descriptor fail");
478 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
479 }
480 if (oldPassword == nullptr || newPassword == nullptr || oldPassword[0] == '\0' || newPassword[0] == '\0') {
481 TELEPHONY_LOGE("oldPassword or newPassword is empty");
482 return TELEPHONY_ERR_ARGUMENT_INVALID;
483 }
484 dataParcel.WriteInt32(slotId);
485 dataParcel.WriteInt32(static_cast<int32_t>(fac));
486 dataParcel.WriteCString(oldPassword);
487 dataParcel.WriteCString(newPassword);
488 MessageParcel replyParcel;
489 int32_t error =
490 SendRequest(CallManagerInterfaceCode::INTERFACE_SET_CALL_RESTRICTION_PASSWORD, dataParcel, replyParcel);
491 if (error != TELEPHONY_SUCCESS) {
492 TELEPHONY_LOGE("Function SetCallRestrictionPassword! errCode:%{public}d", error);
493 return error;
494 }
495 return replyParcel.ReadInt32();
496 }
497
GetCallTransferInfo(int32_t slotId,CallTransferType type)498 int32_t CallManagerServiceProxy::GetCallTransferInfo(int32_t slotId, CallTransferType type)
499 {
500 MessageParcel dataParcel;
501 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
502 TELEPHONY_LOGE("write descriptor fail");
503 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
504 }
505 dataParcel.WriteInt32(slotId);
506 dataParcel.WriteInt32(static_cast<int32_t>(type));
507 MessageParcel replyParcel;
508 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_GET_CALL_TRANSFER, dataParcel, replyParcel);
509 if (error != TELEPHONY_SUCCESS) {
510 TELEPHONY_LOGE("Function GetCallTransfer! errCode:%{public}d", error);
511 return error;
512 }
513 return replyParcel.ReadInt32();
514 }
515
SetCallTransferInfo(int32_t slotId,CallTransferInfo & info)516 int32_t CallManagerServiceProxy::SetCallTransferInfo(int32_t slotId, CallTransferInfo &info)
517 {
518 MessageParcel dataParcel;
519 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
520 TELEPHONY_LOGE("write descriptor fail");
521 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
522 }
523 dataParcel.WriteInt32(slotId);
524 dataParcel.WriteRawData((const void *)&info, sizeof(CallTransferInfo));
525 MessageParcel replyParcel;
526 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_SET_CALL_TRANSFER, dataParcel, replyParcel);
527 if (error != TELEPHONY_SUCCESS) {
528 TELEPHONY_LOGE("Function SetCallTransfer! errCode:%{public}d", error);
529 return error;
530 }
531 return replyParcel.ReadInt32();
532 }
533
CanSetCallTransferTime(int32_t slotId,bool & result)534 int32_t CallManagerServiceProxy::CanSetCallTransferTime(int32_t slotId, bool &result)
535 {
536 MessageParcel dataParcel;
537 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
538 TELEPHONY_LOGE("[slot%{public}d] write descriptor fail", slotId);
539 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
540 }
541 if (!dataParcel.WriteInt32(slotId)) {
542 TELEPHONY_LOGE("[slot%{public}d] write slotId fail", slotId);
543 return TELEPHONY_ERR_WRITE_DATA_FAIL;
544 }
545 if (!dataParcel.WriteBool(result)) {
546 TELEPHONY_LOGE("[slot%{public}d] write result fail", slotId);
547 return TELEPHONY_ERR_WRITE_DATA_FAIL;
548 }
549 MessageParcel replyParcel;
550 int32_t error =
551 SendRequest(CallManagerInterfaceCode::INTERFACE_CAN_SET_CALL_TRANSFER_TIME, dataParcel, replyParcel);
552 if (error == ERR_NONE) {
553 result = replyParcel.ReadBool();
554 return replyParcel.ReadInt32();
555 }
556 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
557 }
558
SetCallPreferenceMode(int32_t slotId,int32_t mode)559 int32_t CallManagerServiceProxy::SetCallPreferenceMode(int32_t slotId, int32_t mode)
560 {
561 MessageParcel dataParcel;
562 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
563 TELEPHONY_LOGE("write descriptor fail");
564 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
565 }
566 dataParcel.WriteInt32(slotId);
567 dataParcel.WriteInt32(mode);
568 MessageParcel replyParcel;
569 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_SETCALL_PREFERENCEMODE, dataParcel, replyParcel);
570 if (error != TELEPHONY_SUCCESS) {
571 TELEPHONY_LOGE("Function SetCallPreferenceMode! errCode:%{public}d", error);
572 return error;
573 }
574 return replyParcel.ReadInt32();
575 }
576
StartRtt(int32_t callId,std::u16string & msg)577 int32_t CallManagerServiceProxy::StartRtt(int32_t callId, std::u16string &msg)
578 {
579 MessageParcel dataParcel;
580 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
581 TELEPHONY_LOGE("write descriptor fail");
582 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
583 }
584 if (msg.empty()) {
585 TELEPHONY_LOGE("msg is empty");
586 return TELEPHONY_ERR_ARGUMENT_INVALID;
587 }
588 dataParcel.WriteInt32(callId);
589 dataParcel.WriteString16(msg);
590 MessageParcel replyParcel;
591 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_START_RTT, dataParcel, replyParcel);
592 if (error != TELEPHONY_SUCCESS) {
593 TELEPHONY_LOGE("Function StartRtt errCode:%{public}d", error);
594 return error;
595 }
596 return replyParcel.ReadInt32();
597 }
598
StopRtt(int32_t callId)599 int32_t CallManagerServiceProxy::StopRtt(int32_t callId)
600 {
601 MessageParcel dataParcel;
602 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
603 TELEPHONY_LOGE("write descriptor fail");
604 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
605 }
606 dataParcel.WriteInt32(callId);
607 MessageParcel replyParcel;
608 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_STOP_RTT, dataParcel, replyParcel);
609 if (error != TELEPHONY_SUCCESS) {
610 TELEPHONY_LOGE("Function StopRtt errCode:%{public}d", error);
611 return error;
612 }
613 return replyParcel.ReadInt32();
614 }
615
CombineConference(int32_t mainCallId)616 int32_t CallManagerServiceProxy::CombineConference(int32_t mainCallId)
617 {
618 MessageParcel dataParcel;
619 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
620 TELEPHONY_LOGE("write descriptor fail");
621 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
622 }
623 dataParcel.WriteInt32(mainCallId);
624 MessageParcel replyParcel;
625 int32_t error = SendRequest(INTERFACE_COMBINE_CONFERENCE, dataParcel, replyParcel);
626 if (error != TELEPHONY_SUCCESS) {
627 TELEPHONY_LOGE("Function CombineConference failed! errCode:%{public}d", error);
628 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
629 }
630 return replyParcel.ReadInt32();
631 }
632
SeparateConference(int32_t callId)633 int32_t CallManagerServiceProxy::SeparateConference(int32_t callId)
634 {
635 MessageParcel dataParcel;
636 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
637 TELEPHONY_LOGE("write descriptor fail");
638 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
639 }
640 dataParcel.WriteInt32(callId);
641 MessageParcel replyParcel;
642 int32_t error = SendRequest(INTERFACE_SEPARATE_CONFERENCE, dataParcel, replyParcel);
643 if (error != TELEPHONY_SUCCESS) {
644 TELEPHONY_LOGE("Function SeparateConference call failed! errCode:%{public}d", error);
645 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
646 }
647 return replyParcel.ReadInt32();
648 }
649
KickOutFromConference(int32_t callId)650 int32_t CallManagerServiceProxy::KickOutFromConference(int32_t callId)
651 {
652 MessageParcel dataParcel;
653 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
654 TELEPHONY_LOGE("write descriptor fail");
655 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
656 }
657 dataParcel.WriteInt32(callId);
658 MessageParcel replyParcel;
659 int32_t error = SendRequest(INTERFACE_KICK_OUT_CONFERENCE, dataParcel, replyParcel);
660 if (error != TELEPHONY_SUCCESS) {
661 TELEPHONY_LOGE("Function KickOutFromConference call failed! errCode:%{public}d", error);
662 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
663 }
664 return replyParcel.ReadInt32();
665 }
666
ControlCamera(int32_t callId,std::u16string & cameraId)667 int32_t CallManagerServiceProxy::ControlCamera(int32_t callId, std::u16string &cameraId)
668 {
669 MessageParcel dataParcel;
670 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
671 TELEPHONY_LOGE("write descriptor fail");
672 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
673 }
674 dataParcel.WriteInt32(callId);
675 dataParcel.WriteString16(cameraId);
676 MessageParcel replyParcel;
677 int32_t error = SendRequest(INTERFACE_CTRL_CAMERA, dataParcel, replyParcel);
678 if (error != TELEPHONY_SUCCESS) {
679 TELEPHONY_LOGE("Function CtrlCamera call failed! errCode:%{public}d", error);
680 return error;
681 }
682 return replyParcel.ReadInt32();
683 }
684
SetPreviewWindow(int32_t callId,std::string & surfaceId,sptr<Surface> surface)685 int32_t CallManagerServiceProxy::SetPreviewWindow(int32_t callId, std::string &surfaceId, sptr<Surface> surface)
686 {
687 MessageParcel dataParcel;
688 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
689 TELEPHONY_LOGE("write descriptor fail");
690 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
691 }
692 dataParcel.WriteInt32(callId);
693 dataParcel.WriteString(surfaceId);
694 if (surface != nullptr) {
695 sptr<IBufferProducer> producer = surface->GetProducer();
696 if (producer != nullptr) {
697 dataParcel.WriteRemoteObject(producer->AsObject());
698 }
699 }
700 MessageParcel replyParcel;
701 int32_t error = SendRequest(INTERFACE_SET_PREVIEW_WINDOW, dataParcel, replyParcel);
702 if (error != TELEPHONY_SUCCESS) {
703 TELEPHONY_LOGE("Function SetPreviewWindow call failed! errCode:%{public}d", error);
704 return error;
705 }
706 return replyParcel.ReadInt32();
707 }
708
SetDisplayWindow(int32_t callId,std::string & surfaceId,sptr<Surface> surface)709 int32_t CallManagerServiceProxy::SetDisplayWindow(int32_t callId, std::string &surfaceId, sptr<Surface> surface)
710 {
711 MessageParcel dataParcel;
712 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
713 TELEPHONY_LOGE("write descriptor fail");
714 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
715 }
716 dataParcel.WriteInt32(callId);
717 dataParcel.WriteString(surfaceId);
718 if (surface != nullptr) {
719 sptr<IBufferProducer> producer = surface->GetProducer();
720 if (producer != nullptr) {
721 dataParcel.WriteRemoteObject(producer->AsObject());
722 }
723 }
724 MessageParcel replyParcel;
725 int32_t error = SendRequest(INTERFACE_SET_DISPLAY_WINDOW, dataParcel, replyParcel);
726 if (error != TELEPHONY_SUCCESS) {
727 TELEPHONY_LOGE("Function SetDisplayWindow call failed! errCode:%{public}d", error);
728 return error;
729 }
730 return replyParcel.ReadInt32();
731 }
732
SetCameraZoom(float zoomRatio)733 int32_t CallManagerServiceProxy::SetCameraZoom(float zoomRatio)
734 {
735 MessageParcel dataParcel;
736 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
737 TELEPHONY_LOGE("write descriptor fail");
738 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
739 }
740 dataParcel.WriteFloat(zoomRatio);
741 MessageParcel replyParcel;
742 int32_t error = SendRequest(INTERFACE_SET_CAMERA_ZOOM, dataParcel, replyParcel);
743 if (error != TELEPHONY_SUCCESS) {
744 TELEPHONY_LOGE("Function SetCameraZoom call failed! errCode:%{public}d", error);
745 return error;
746 }
747 return replyParcel.ReadInt32();
748 }
749
SetPausePicture(int32_t callId,std::u16string & path)750 int32_t CallManagerServiceProxy::SetPausePicture(int32_t callId, std::u16string &path)
751 {
752 MessageParcel dataParcel;
753 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
754 TELEPHONY_LOGE("write descriptor fail");
755 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
756 }
757 dataParcel.WriteInt32(callId);
758 dataParcel.WriteString16(path);
759 MessageParcel replyParcel;
760 int32_t error = SendRequest(INTERFACE_SET_PAUSE_IMAGE, dataParcel, replyParcel);
761 if (error != TELEPHONY_SUCCESS) {
762 TELEPHONY_LOGE("Function SetPausePicture call failed! errCode:%{public}d", error);
763 return error;
764 }
765 return replyParcel.ReadInt32();
766 }
767
SetDeviceDirection(int32_t callId,int32_t rotation)768 int32_t CallManagerServiceProxy::SetDeviceDirection(int32_t callId, int32_t rotation)
769 {
770 MessageParcel dataParcel;
771 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
772 TELEPHONY_LOGE("write descriptor fail");
773 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
774 }
775 dataParcel.WriteInt32(callId);
776 dataParcel.WriteInt32(rotation);
777 MessageParcel replyParcel;
778 int32_t error = SendRequest(INTERFACE_SET_DEVICE_DIRECTION, dataParcel, replyParcel);
779 if (error != TELEPHONY_SUCCESS) {
780 TELEPHONY_LOGE("Function SetDeviceDirection call failed! errCode:%{public}d", error);
781 return error;
782 }
783 return replyParcel.ReadInt32();
784 }
785
IsEmergencyPhoneNumber(std::u16string & number,int32_t slotId,bool & enabled)786 int32_t CallManagerServiceProxy::IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId, bool &enabled)
787 {
788 MessageParcel dataParcel;
789 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
790 TELEPHONY_LOGE("write descriptor fail");
791 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
792 }
793 if (number.empty()) {
794 TELEPHONY_LOGE("number is empty");
795 return TELEPHONY_ERR_ARGUMENT_INVALID;
796 }
797 dataParcel.WriteString16(number);
798 dataParcel.WriteInt32(slotId);
799 MessageParcel replyParcel;
800 int32_t error = SendRequest(INTERFACE_IS_EMERGENCY_NUMBER, dataParcel, replyParcel);
801 if (error != TELEPHONY_SUCCESS) {
802 TELEPHONY_LOGE("Function IsEmergencyPhoneNumber call failed! errCode:%{public}d", error);
803 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
804 }
805 int32_t result = replyParcel.ReadInt32();
806 if (result == TELEPHONY_SUCCESS) {
807 enabled = replyParcel.ReadBool();
808 }
809 return result;
810 }
811
FormatPhoneNumber(std::u16string & number,std::u16string & countryCode,std::u16string & formatNumber)812 int32_t CallManagerServiceProxy::FormatPhoneNumber(
813 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber)
814 {
815 MessageParcel dataParcel;
816 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
817 TELEPHONY_LOGE("write descriptor fail");
818 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
819 }
820 if (number.empty() || countryCode.empty()) {
821 TELEPHONY_LOGE("number or countryCode is empty");
822 return TELEPHONY_ERR_ARGUMENT_INVALID;
823 }
824 dataParcel.WriteString16(number);
825 dataParcel.WriteString16(countryCode);
826 MessageParcel replyParcel;
827 int32_t error = SendRequest(INTERFACE_IS_FORMAT_NUMBER, dataParcel, replyParcel);
828 if (error != TELEPHONY_SUCCESS) {
829 TELEPHONY_LOGE("Function FormatPhoneNumber call failed! errCode:%{public}d", error);
830 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
831 }
832 int32_t result = replyParcel.ReadInt32();
833 if (result == TELEPHONY_SUCCESS) {
834 formatNumber = replyParcel.ReadString16();
835 }
836 return result;
837 }
838
FormatPhoneNumberToE164(std::u16string & number,std::u16string & countryCode,std::u16string & formatNumber)839 int32_t CallManagerServiceProxy::FormatPhoneNumberToE164(
840 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber)
841 {
842 MessageParcel dataParcel;
843 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
844 TELEPHONY_LOGE("write descriptor fail");
845 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
846 }
847 if (number.empty() || countryCode.empty()) {
848 TELEPHONY_LOGE("number or countryCode is empty");
849 return TELEPHONY_ERR_ARGUMENT_INVALID;
850 }
851 dataParcel.WriteString16(number);
852 dataParcel.WriteString16(countryCode);
853 MessageParcel replyParcel;
854 int32_t error = SendRequest(INTERFACE_IS_FORMAT_NUMBER_E164, dataParcel, replyParcel);
855 if (error != TELEPHONY_SUCCESS) {
856 TELEPHONY_LOGE("Function FormatPhoneNumberToE164 call failed! errCode:%{public}d", error);
857 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
858 }
859 int32_t result = replyParcel.ReadInt32();
860 if (result == TELEPHONY_SUCCESS) {
861 formatNumber = replyParcel.ReadString16();
862 }
863 return result;
864 }
865
GetMainCallId(int32_t callId,int32_t & mainCallId)866 int32_t CallManagerServiceProxy::GetMainCallId(int32_t callId, int32_t &mainCallId)
867 {
868 MessageParcel dataParcel;
869 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
870 TELEPHONY_LOGE("write descriptor fail");
871 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
872 }
873 dataParcel.WriteInt32(callId);
874 MessageParcel replyParcel;
875 int32_t error = SendRequest(INTERFACE_GET_MAINID, dataParcel, replyParcel);
876 if (error != TELEPHONY_SUCCESS) {
877 TELEPHONY_LOGE("Function StartConference call failed! errCode:%{public}d", error);
878 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
879 }
880 int32_t result = replyParcel.ReadInt32();
881 if (result == TELEPHONY_ERR_SUCCESS) {
882 mainCallId = replyParcel.ReadInt32();
883 }
884 return result;
885 }
886
GetSubCallIdList(int32_t callId,std::vector<std::u16string> & callIdList)887 int32_t CallManagerServiceProxy::GetSubCallIdList(int32_t callId, std::vector<std::u16string> &callIdList)
888 {
889 MessageParcel dataParcel;
890 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
891 TELEPHONY_LOGE("write descriptor fail");
892 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
893 }
894 dataParcel.WriteInt32(callId);
895 MessageParcel replyParcel;
896 int32_t error = SendRequest(INTERFACE_GET_SUBCALL_LIST_ID, dataParcel, replyParcel);
897 if (error != TELEPHONY_SUCCESS) {
898 TELEPHONY_LOGE("Function GetSubCallIdList call failed! errCode:%{public}d", error);
899 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
900 }
901 int32_t result = replyParcel.ReadInt32();
902 if (result == TELEPHONY_ERR_SUCCESS) {
903 replyParcel.ReadString16Vector(&callIdList);
904 }
905 return result;
906 }
907
GetCallIdListForConference(int32_t callId,std::vector<std::u16string> & callIdList)908 int32_t CallManagerServiceProxy::GetCallIdListForConference(int32_t callId, std::vector<std::u16string> &callIdList)
909 {
910 MessageParcel dataParcel;
911 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
912 TELEPHONY_LOGE("write descriptor fail");
913 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
914 }
915 dataParcel.WriteInt32(callId);
916 MessageParcel replyParcel;
917 int32_t error = SendRequest(INTERFACE_GET_CALL_LIST_ID_FOR_CONFERENCE, dataParcel, replyParcel);
918 if (error != TELEPHONY_SUCCESS) {
919 TELEPHONY_LOGE("Function GetCallIdListForConference call failed! errCode:%{public}d", error);
920 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
921 }
922 int32_t result = replyParcel.ReadInt32();
923 if (result == TELEPHONY_ERR_SUCCESS) {
924 replyParcel.ReadString16Vector(&callIdList);
925 }
926 return result;
927 }
928
GetImsConfig(int32_t slotId,ImsConfigItem item)929 int32_t CallManagerServiceProxy::GetImsConfig(int32_t slotId, ImsConfigItem item)
930 {
931 MessageParcel dataParcel;
932 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
933 TELEPHONY_LOGE("write descriptor fail");
934 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
935 }
936 dataParcel.WriteInt32(slotId);
937 dataParcel.WriteInt32(item);
938 MessageParcel replyParcel;
939 int32_t error = SendRequest(INTERFACE_GET_IMS_CONFIG, dataParcel, replyParcel);
940 if (error != TELEPHONY_SUCCESS) {
941 TELEPHONY_LOGE("function GetImsConfig failed! errCode:%{public}d", error);
942 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
943 }
944 return replyParcel.ReadInt32();
945 }
946
SetImsConfig(int32_t slotId,ImsConfigItem item,std::u16string & value)947 int32_t CallManagerServiceProxy::SetImsConfig(int32_t slotId, ImsConfigItem item, std::u16string &value)
948 {
949 MessageParcel dataParcel;
950 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
951 TELEPHONY_LOGE("write descriptor fail");
952 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
953 }
954 dataParcel.WriteInt32(slotId);
955 dataParcel.WriteInt32(item);
956 dataParcel.WriteString16(value);
957 MessageParcel replyParcel;
958 int32_t error = SendRequest(INTERFACE_SET_IMS_CONFIG, dataParcel, replyParcel);
959 if (error != TELEPHONY_SUCCESS) {
960 TELEPHONY_LOGE("function SetImsConfig failed! errCode:%{public}d", error);
961 return error;
962 }
963 return replyParcel.ReadInt32();
964 }
965
GetImsFeatureValue(int32_t slotId,FeatureType type)966 int32_t CallManagerServiceProxy::GetImsFeatureValue(int32_t slotId, FeatureType type)
967 {
968 MessageParcel dataParcel;
969 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
970 TELEPHONY_LOGE("write descriptor fail");
971 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
972 }
973 dataParcel.WriteInt32(slotId);
974 dataParcel.WriteInt32(type);
975 MessageParcel replyParcel;
976 int32_t error = SendRequest(INTERFACE_GET_IMS_FEATURE_VALUE, dataParcel, replyParcel);
977 if (error != TELEPHONY_SUCCESS) {
978 TELEPHONY_LOGE("function GetImsFeatureValue failed! errCode:%{public}d", error);
979 return error;
980 }
981 return replyParcel.ReadInt32();
982 }
983
SetImsFeatureValue(int32_t slotId,FeatureType type,int32_t value)984 int32_t CallManagerServiceProxy::SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value)
985 {
986 MessageParcel dataParcel;
987 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
988 TELEPHONY_LOGE("write descriptor fail");
989 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
990 }
991 dataParcel.WriteInt32(slotId);
992 dataParcel.WriteInt32(type);
993 dataParcel.WriteInt32(value);
994 MessageParcel replyParcel;
995 int32_t error = SendRequest(INTERFACE_SET_IMS_FEATURE_VALUE, dataParcel, replyParcel);
996 if (error != TELEPHONY_SUCCESS) {
997 TELEPHONY_LOGE("function SetImsFeatureValue failed! errCode:%{public}d", error);
998 return error;
999 }
1000 return replyParcel.ReadInt32();
1001 }
1002
UpdateImsCallMode(int32_t callId,ImsCallMode mode)1003 int32_t CallManagerServiceProxy::UpdateImsCallMode(int32_t callId, ImsCallMode mode)
1004 {
1005 MessageParcel dataParcel;
1006 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1007 TELEPHONY_LOGE("write descriptor fail");
1008 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1009 }
1010 dataParcel.WriteInt32(callId);
1011 dataParcel.WriteUint32(mode);
1012 MessageParcel replyParcel;
1013 int32_t error = SendRequest(INTERFACE_UPDATE_CALL_MEDIA_MODE, dataParcel, replyParcel);
1014 if (error != TELEPHONY_SUCCESS) {
1015 TELEPHONY_LOGE("function UpdateImsCallMode failed! errCode:%{public}d", error);
1016 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1017 }
1018 return replyParcel.ReadInt32();
1019 }
1020
EnableImsSwitch(int32_t slotId)1021 int32_t CallManagerServiceProxy::EnableImsSwitch(int32_t slotId)
1022 {
1023 MessageParcel dataParcel;
1024 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1025 TELEPHONY_LOGE("write descriptor fail");
1026 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1027 }
1028 dataParcel.WriteInt32(slotId);
1029 MessageParcel replyParcel;
1030 int32_t error = SendRequest(INTERFACE_ENABLE_VOLTE, dataParcel, replyParcel);
1031 if (error != ERR_NONE) {
1032 TELEPHONY_LOGE("function EnableImsSwitch failed! errCode:%{public}d", error);
1033 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1034 }
1035 return replyParcel.ReadInt32();
1036 }
1037
DisableImsSwitch(int32_t slotId)1038 int32_t CallManagerServiceProxy::DisableImsSwitch(int32_t slotId)
1039 {
1040 MessageParcel dataParcel;
1041 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1042 TELEPHONY_LOGE("write descriptor fail");
1043 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1044 }
1045 dataParcel.WriteInt32(slotId);
1046 MessageParcel replyParcel;
1047 int32_t error = SendRequest(INTERFACE_DISABLE_VOLTE, dataParcel, replyParcel);
1048 if (error != ERR_NONE) {
1049 TELEPHONY_LOGE("function DisableImsSwitch failed! errCode:%{public}d", error);
1050 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1051 }
1052 return replyParcel.ReadInt32();
1053 }
1054
IsImsSwitchEnabled(int32_t slotId,bool & enabled)1055 int32_t CallManagerServiceProxy::IsImsSwitchEnabled(int32_t slotId, bool &enabled)
1056 {
1057 MessageParcel dataParcel;
1058 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1059 TELEPHONY_LOGE("write descriptor fail");
1060 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1061 }
1062 dataParcel.WriteInt32(slotId);
1063 MessageParcel replyParcel;
1064 int32_t error = SendRequest(INTERFACE_IS_VOLTE_ENABLED, dataParcel, replyParcel);
1065 if (error != ERR_NONE) {
1066 TELEPHONY_LOGE("function IsImsSwitchEnabled failed! errCode:%{public}d", error);
1067 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1068 }
1069 enabled = replyParcel.ReadBool();
1070 return replyParcel.ReadInt32();
1071 }
1072
SetVoNRState(int32_t slotId,int32_t state)1073 int32_t CallManagerServiceProxy::SetVoNRState(int32_t slotId, int32_t state)
1074 {
1075 MessageParcel dataParcel;
1076 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1077 TELEPHONY_LOGE("write descriptor fail");
1078 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1079 }
1080 dataParcel.WriteInt32(slotId);
1081 dataParcel.WriteInt32(state);
1082 MessageParcel replyParcel;
1083 int32_t error = SendRequest(INTERFACE_SET_VONR_STATE, dataParcel, replyParcel);
1084 if (error != ERR_NONE) {
1085 TELEPHONY_LOGE("function SetVoNRState failed! errCode:%{public}d", error);
1086 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1087 }
1088 return replyParcel.ReadInt32();
1089 }
1090
GetVoNRState(int32_t slotId,int32_t & state)1091 int32_t CallManagerServiceProxy::GetVoNRState(int32_t slotId, int32_t &state)
1092 {
1093 MessageParcel dataParcel;
1094 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1095 TELEPHONY_LOGE("write descriptor fail");
1096 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1097 }
1098 dataParcel.WriteInt32(slotId);
1099 MessageParcel replyParcel;
1100 int32_t error = SendRequest(INTERFACE_GET_VONR_STATE, dataParcel, replyParcel);
1101 if (error != ERR_NONE) {
1102 TELEPHONY_LOGE("function GetVoNRState failed! errCode:%{public}d", error);
1103 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1104 }
1105 state = replyParcel.ReadInt32();
1106 return replyParcel.ReadInt32();
1107 }
1108
JoinConference(int32_t callId,std::vector<std::u16string> & numberList)1109 int32_t CallManagerServiceProxy::JoinConference(int32_t callId, std::vector<std::u16string> &numberList)
1110 {
1111 MessageParcel dataParcel;
1112 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1113 TELEPHONY_LOGE("write descriptor fail");
1114 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1115 }
1116 dataParcel.WriteInt32(callId);
1117 dataParcel.WriteString16Vector(numberList);
1118 MessageParcel replyParcel;
1119 int32_t error = SendRequest(INTERFACE_JOIN_CONFERENCE, dataParcel, replyParcel);
1120 if (error != TELEPHONY_SUCCESS) {
1121 TELEPHONY_LOGE("function JoinConference failed! errCode:%{public}d", error);
1122 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1123 }
1124 return replyParcel.ReadInt32();
1125 }
1126
ReportOttCallDetailsInfo(std::vector<OttCallDetailsInfo> & ottVec)1127 int32_t CallManagerServiceProxy::ReportOttCallDetailsInfo(std::vector<OttCallDetailsInfo> &ottVec)
1128 {
1129 MessageParcel dataParcel;
1130 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1131 TELEPHONY_LOGE("write descriptor fail");
1132 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1133 }
1134 if (ottVec.empty()) {
1135 TELEPHONY_LOGE("ottVec is empty");
1136 return TELEPHONY_ERR_ARGUMENT_INVALID;
1137 }
1138 dataParcel.WriteInt32(ottVec.size());
1139 std::vector<OttCallDetailsInfo>::iterator it = ottVec.begin();
1140 for (; it != ottVec.end(); ++it) {
1141 dataParcel.WriteRawData((const void *)&(*it), sizeof(OttCallDetailsInfo));
1142 }
1143 MessageParcel replyParcel;
1144 int32_t error = SendRequest(INTERFACE_REPORT_OTT_CALL_DETAIL_INFO, dataParcel, replyParcel);
1145 if (error != TELEPHONY_SUCCESS) {
1146 TELEPHONY_LOGE("function ReportOttCallDetailsInfo failed! errCode:%{public}d", error);
1147 return error;
1148 }
1149 return replyParcel.ReadInt32();
1150 }
1151
ReportOttCallEventInfo(OttCallEventInfo & eventInfo)1152 int32_t CallManagerServiceProxy::ReportOttCallEventInfo(OttCallEventInfo &eventInfo)
1153 {
1154 MessageParcel dataParcel;
1155 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1156 TELEPHONY_LOGE("write descriptor fail");
1157 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1158 }
1159 dataParcel.WriteRawData((const void *)&eventInfo, sizeof(OttCallEventInfo));
1160 MessageParcel replyParcel;
1161 int32_t error = SendRequest(INTERFACE_REPORT_OTT_CALL_EVENT_INFO, dataParcel, replyParcel);
1162 if (error != TELEPHONY_SUCCESS) {
1163 TELEPHONY_LOGE("function ReportOttCallDetailsInfo failed! errCode:%{public}d", error);
1164 return error;
1165 }
1166 return replyParcel.ReadInt32();
1167 }
1168
CloseUnFinishedUssd(int32_t slotId)1169 int32_t CallManagerServiceProxy::CloseUnFinishedUssd(int32_t slotId)
1170 {
1171 MessageParcel dataParcel;
1172 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1173 TELEPHONY_LOGE("write descriptor fail");
1174 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1175 }
1176 dataParcel.WriteInt32(slotId);
1177 MessageParcel replyParcel;
1178 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_CLOSE_UNFINISHED_USSD, dataParcel, replyParcel);
1179 if (error != TELEPHONY_SUCCESS) {
1180 TELEPHONY_LOGE("Function CloseUnFinishedUssd! errCode:%{public}d", error);
1181 return error;
1182 }
1183 return replyParcel.ReadInt32();
1184 }
1185
InputDialerSpecialCode(const std::string & specialCode)1186 int32_t CallManagerServiceProxy::InputDialerSpecialCode(const std::string &specialCode)
1187 {
1188 MessageParcel dataParcel;
1189 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1190 TELEPHONY_LOGE("write descriptor fail");
1191 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1192 }
1193 dataParcel.WriteString(specialCode);
1194 MessageParcel replyParcel;
1195 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_INPUT_DIALER_SPECIAL_CODE, dataParcel, replyParcel);
1196 if (error != TELEPHONY_SUCCESS) {
1197 TELEPHONY_LOGE("Function InputDialerSpecialCode! errCode:%{public}d", error);
1198 return error;
1199 }
1200 return replyParcel.ReadInt32();
1201 }
1202
RemoveMissedIncomingCallNotification()1203 int32_t CallManagerServiceProxy::RemoveMissedIncomingCallNotification()
1204 {
1205 MessageParcel dataParcel;
1206 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1207 TELEPHONY_LOGE("write descriptor fail");
1208 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1209 }
1210 MessageParcel replyParcel;
1211 int32_t error = SendRequest(
1212 CallManagerInterfaceCode::INTERFACE_CANCEL_MISSED_INCOMING_CALL_NOTIFICATION, dataParcel, replyParcel);
1213 if (error != TELEPHONY_SUCCESS) {
1214 TELEPHONY_LOGE("Function RemoveMissedIncomingCallNotification! errCode:%{public}d", error);
1215 return error;
1216 }
1217 return replyParcel.ReadInt32();
1218 }
1219
SetVoIPCallState(int32_t state)1220 int32_t CallManagerServiceProxy::SetVoIPCallState(int32_t state)
1221 {
1222 MessageParcel dataParcel;
1223 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1224 TELEPHONY_LOGE("write descriptor fail");
1225 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1226 }
1227 dataParcel.WriteInt32(state);
1228 MessageParcel replyParcel;
1229 int32_t error = SendRequest(INTERFACE_SET_VOIP_CALL_STATE, dataParcel, replyParcel);
1230 if (error != ERR_NONE) {
1231 TELEPHONY_LOGE("function SetVoIPCallState failed! errCode:%{public}d", error);
1232 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1233 }
1234 return replyParcel.ReadInt32();
1235 }
1236
GetVoIPCallState(int32_t & state)1237 int32_t CallManagerServiceProxy::GetVoIPCallState(int32_t &state)
1238 {
1239 MessageParcel dataParcel;
1240 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1241 TELEPHONY_LOGE("write descriptor fail");
1242 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1243 }
1244 MessageParcel replyParcel;
1245 int32_t error = SendRequest(INTERFACE_GET_VOIP_CALL_STATE, dataParcel, replyParcel);
1246 if (error != ERR_NONE) {
1247 TELEPHONY_LOGE("function GetVoIPCallState failed! errCode:%{public}d", error);
1248 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1249 }
1250 state = replyParcel.ReadInt32();
1251 return replyParcel.ReadInt32();
1252 }
1253
GetProxyObjectPtr(CallManagerProxyType proxyType)1254 sptr<IRemoteObject> CallManagerServiceProxy::GetProxyObjectPtr(CallManagerProxyType proxyType)
1255 {
1256 MessageParcel dataParcel;
1257 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1258 TELEPHONY_LOGE("write descriptor fail");
1259 return nullptr;
1260 }
1261 dataParcel.WriteInt32(static_cast<int32_t>(proxyType));
1262 MessageParcel replyParcel;
1263 int32_t error = SendRequest(INTERFACE_GET_PROXY_OBJECT_PTR, dataParcel, replyParcel);
1264 if (error != TELEPHONY_SUCCESS) {
1265 TELEPHONY_LOGE("function GetProxyObjectPtr failed! errCode:%{public}d", error);
1266 return nullptr;
1267 }
1268 return replyParcel.ReadRemoteObject();
1269 }
1270
ReportAudioDeviceInfo()1271 int32_t CallManagerServiceProxy::ReportAudioDeviceInfo()
1272 {
1273 return SendRequest(INTERFACE_REPORT_AUDIO_DEVICE_INFO);
1274 }
1275
CancelCallUpgrade(int32_t callId)1276 int32_t CallManagerServiceProxy::CancelCallUpgrade(int32_t callId)
1277 {
1278 MessageParcel dataParcel;
1279 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1280 TELEPHONY_LOGE("write descriptor fail");
1281 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1282 }
1283 dataParcel.WriteInt32(callId);
1284 MessageParcel replyParcel;
1285 int32_t error = SendRequest(CallManagerInterfaceCode::INTERFACE_CANCEL_CALL_UPGRADE, dataParcel, replyParcel);
1286 if (error != TELEPHONY_SUCCESS) {
1287 TELEPHONY_LOGE("Function CloseUnFinishedUssd! errCode:%{public}d", error);
1288 return error;
1289 }
1290 return replyParcel.ReadInt32();
1291 }
1292
RequestCameraCapabilities(int32_t callId)1293 int32_t CallManagerServiceProxy::RequestCameraCapabilities(int32_t callId)
1294 {
1295 MessageParcel dataParcel;
1296 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1297 TELEPHONY_LOGE("write descriptor fail");
1298 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1299 }
1300 dataParcel.WriteInt32(callId);
1301 MessageParcel replyParcel;
1302 int32_t error = SendRequest(
1303 CallManagerInterfaceCode::INTERFACE_REQUEST_CAMERA_CAPABILITIES, dataParcel, replyParcel);
1304 if (error != TELEPHONY_SUCCESS) {
1305 TELEPHONY_LOGE("Function CloseUnFinishedUssd! errCode:%{public}d", error);
1306 return error;
1307 }
1308 return replyParcel.ReadInt32();
1309 }
1310
SendRequest(CallManagerInterfaceCode code)1311 int32_t CallManagerServiceProxy::SendRequest(CallManagerInterfaceCode code)
1312 {
1313 MessageParcel dataParcel;
1314 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1315 TELEPHONY_LOGE("write descriptor fail");
1316 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1317 }
1318 MessageParcel replyParcel;
1319 int32_t error = SendRequest(code, dataParcel, replyParcel);
1320 if (error != TELEPHONY_SUCCESS) {
1321 TELEPHONY_LOGE("CallManagerInterfaceCode:%{public}d errCode:%{public}d", static_cast<int32_t>(code), error);
1322 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1323 }
1324 return replyParcel.ReadInt32();
1325 }
1326
SendRequest(CallManagerInterfaceCode code,MessageParcel & dataParcel,MessageParcel & replyParcel)1327 int32_t CallManagerServiceProxy::SendRequest(
1328 CallManagerInterfaceCode code, MessageParcel &dataParcel, MessageParcel &replyParcel)
1329 {
1330 auto remote = Remote();
1331 if (remote == nullptr) {
1332 TELEPHONY_LOGE("function Remote() return nullptr!");
1333 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1334 }
1335 MessageOption option;
1336 return remote->SendRequest(static_cast<int32_t>(code), dataParcel, replyParcel, option);
1337 }
1338
SendCallUiEvent(int32_t callId,std::string & eventName)1339 int32_t CallManagerServiceProxy::SendCallUiEvent(int32_t callId, std::string &eventName)
1340 {
1341 MessageParcel dataParcel;
1342 if (!dataParcel.WriteInterfaceToken(CallManagerServiceProxy::GetDescriptor())) {
1343 TELEPHONY_LOGE("write descriptor fail");
1344 return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1345 }
1346 dataParcel.WriteInt32(callId);
1347 dataParcel.WriteString(eventName);
1348 MessageParcel replyParcel;
1349 int32_t error = SendRequest(INTERFACE_SEND_CALLUI_EVENT, dataParcel, replyParcel);
1350 if (error != TELEPHONY_SUCCESS) {
1351 TELEPHONY_LOGE("function SendCallUiEvent call failed! errCode:%{public}d", error);
1352 return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1353 }
1354 return replyParcel.ReadInt32();
1355 }
1356 } // namespace Telephony
1357 } // namespace OHOS
1358