1 /*
2 * Copyright (C) 2021 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_stub.h"
17
18 #include <string_ex.h>
19
20 #include "call_manager_errors.h"
21 #include "telephony_log_wrapper.h"
22
23 #include "message_option.h"
24 #include "message_parcel.h"
25
26 #include "call_control_manager.h"
27
28 namespace OHOS {
29 namespace Telephony {
CallManagerServiceStub()30 CallManagerServiceStub::CallManagerServiceStub()
31 {
32 InitCallBasicRequest();
33 InitCallUtilsRequest();
34 InitCallConferenceRequest();
35 InitCallDtmfRequest();
36 InitCallSupplementRequest();
37 initCallConferenceExRequest();
38 InitCallMultimediaRequest();
39 InitImsServiceRequest();
40 InitOttServiceRequest();
41 memberFuncMap_[INTERFACE_GET_PROXY_OBJECT_PTR] = &CallManagerServiceStub::OnGetProxyObjectPtr;
42 }
43
~CallManagerServiceStub()44 CallManagerServiceStub::~CallManagerServiceStub()
45 {
46 memberFuncMap_.clear();
47 }
48
InitCallBasicRequest()49 void CallManagerServiceStub::InitCallBasicRequest()
50 {
51 memberFuncMap_[INTERFACE_REGISTER_CALLBACK] = &CallManagerServiceStub::OnRegisterCallBack;
52 memberFuncMap_[INTERFACE_UNREGISTER_CALLBACK] = &CallManagerServiceStub::OnUnRegisterCallBack;
53 memberFuncMap_[INTERFACE_DIAL_CALL] = &CallManagerServiceStub::OnDialCall;
54 memberFuncMap_[INTERFACE_ANSWER_CALL] = &CallManagerServiceStub::OnAcceptCall;
55 memberFuncMap_[INTERFACE_REJECT_CALL] = &CallManagerServiceStub::OnRejectCall;
56 memberFuncMap_[INTERFACE_HOLD_CALL] = &CallManagerServiceStub::OnHoldCall;
57 memberFuncMap_[INTERFACE_UNHOLD_CALL] = &CallManagerServiceStub::OnUnHoldCall;
58 memberFuncMap_[INTERFACE_DISCONNECT_CALL] = &CallManagerServiceStub::OnHangUpCall;
59 memberFuncMap_[INTERFACE_GET_CALL_STATE] = &CallManagerServiceStub::OnGetCallState;
60 memberFuncMap_[INTERFACE_SWAP_CALL] = &CallManagerServiceStub::OnSwitchCall;
61 }
62
InitCallUtilsRequest()63 void CallManagerServiceStub::InitCallUtilsRequest()
64 {
65 memberFuncMap_[INTERFACE_HAS_CALL] = &CallManagerServiceStub::OnHasCall;
66 memberFuncMap_[INTERFACE_IS_NEW_CALL_ALLOWED] = &CallManagerServiceStub::OnIsNewCallAllowed;
67 memberFuncMap_[INTERFACE_IS_RINGING] = &CallManagerServiceStub::OnIsRinging;
68 memberFuncMap_[INTERFACE_IS_EMERGENCY_CALL] = &CallManagerServiceStub::OnIsInEmergencyCall;
69 memberFuncMap_[INTERFACE_IS_EMERGENCY_NUMBER] = &CallManagerServiceStub::OnIsEmergencyPhoneNumber;
70 memberFuncMap_[INTERFACE_IS_FORMAT_NUMBER] = &CallManagerServiceStub::OnFormatPhoneNumber;
71 memberFuncMap_[INTERFACE_IS_FORMAT_NUMBER_E164] = &CallManagerServiceStub::OnFormatPhoneNumberToE164;
72 }
73
InitCallConferenceRequest()74 void CallManagerServiceStub::InitCallConferenceRequest()
75 {
76 memberFuncMap_[INTERFACE_COMBINE_CONFERENCE] = &CallManagerServiceStub::OnCombineConference;
77 memberFuncMap_[INTERFACE_SEPARATE_CONFERENCE] = &CallManagerServiceStub::OnSeparateConference;
78 memberFuncMap_[INTERFACE_JOIN_CONFERENCE] = &CallManagerServiceStub::OnJoinConference;
79 }
80
InitCallDtmfRequest()81 void CallManagerServiceStub::InitCallDtmfRequest()
82 {
83 memberFuncMap_[INTERFACE_START_DTMF] = &CallManagerServiceStub::OnStartDtmf;
84 memberFuncMap_[INTERFACE_STOP_DTMF] = &CallManagerServiceStub::OnStopDtmf;
85 }
86
InitCallSupplementRequest()87 void CallManagerServiceStub::InitCallSupplementRequest()
88 {
89 memberFuncMap_[INTERFACE_GET_CALL_WAITING] = &CallManagerServiceStub::OnGetCallWaiting;
90 memberFuncMap_[INTERFACE_SET_CALL_WAITING] = &CallManagerServiceStub::OnSetCallWaiting;
91 memberFuncMap_[INTERFACE_GET_CALL_RESTRICTION] = &CallManagerServiceStub::OnGetCallRestriction;
92 memberFuncMap_[INTERFACE_SET_CALL_RESTRICTION] = &CallManagerServiceStub::OnSetCallRestriction;
93 memberFuncMap_[INTERFACE_GET_CALL_TRANSFER] = &CallManagerServiceStub::OnGetTransferNumber;
94 memberFuncMap_[INTERFACE_SET_CALL_TRANSFER] = &CallManagerServiceStub::OnSetTransferNumber;
95 }
96
initCallConferenceExRequest()97 void CallManagerServiceStub::initCallConferenceExRequest()
98 {
99 memberFuncMap_[INTERFACE_GET_MAINID] = &CallManagerServiceStub::OnGetMainCallId;
100 memberFuncMap_[INTERFACE_GET_SUBCALL_LIST_ID] = &CallManagerServiceStub::OnGetSubCallIdList;
101 memberFuncMap_[INTERFACE_GET_CALL_LIST_ID_FOR_CONFERENCE] =
102 &CallManagerServiceStub::OnGetCallIdListForConference;
103 }
104
InitCallMultimediaRequest()105 void CallManagerServiceStub::InitCallMultimediaRequest()
106 {
107 memberFuncMap_[INTERFACE_SET_MUTE] = &CallManagerServiceStub::OnSetMute;
108 memberFuncMap_[INTERFACE_MUTE_RINGER] = &CallManagerServiceStub::OnMuteRinger;
109 memberFuncMap_[INTERFACE_SET_AUDIO_DEVICE] = &CallManagerServiceStub::OnSetAudioDevice;
110 memberFuncMap_[INTERFACE_CTRL_CAMERA] = &CallManagerServiceStub::OnControlCamera;
111 memberFuncMap_[INTERFACE_SET_PREVIEW_WINDOW] = &CallManagerServiceStub::OnSetPreviewWindow;
112 memberFuncMap_[INTERFACE_SET_DISPLAY_WINDOW] = &CallManagerServiceStub::OnSetDisplayWindow;
113 memberFuncMap_[INTERFACE_SET_CAMERA_ZOOM] = &CallManagerServiceStub::OnSetCameraZoom;
114 memberFuncMap_[INTERFACE_SET_PAUSE_IMAGE] = &CallManagerServiceStub::OnSetPausePicture;
115 memberFuncMap_[INTERFACE_SET_DEVICE_DIRECTION] = &CallManagerServiceStub::OnSetDeviceDirection;
116 memberFuncMap_[INTERFACE_UPDATE_CALL_MEDIA_MODE] = &CallManagerServiceStub::OnUpdateCallMediaMode;
117 }
118
InitImsServiceRequest()119 void CallManagerServiceStub::InitImsServiceRequest()
120 {
121 memberFuncMap_[INTERFACE_SETCALL_PREFERENCEMODE] = &CallManagerServiceStub::OnSetCallPreferenceMode;
122 memberFuncMap_[INTERFACE_GET_IMS_CONFIG] = &CallManagerServiceStub::OnGetImsConfig;
123 memberFuncMap_[INTERFACE_SET_IMS_CONFIG] = &CallManagerServiceStub::OnSetImsConfig;
124 memberFuncMap_[INTERFACE_GET_IMS_FEATURE_VALUE] = &CallManagerServiceStub::OnGetImsFeatureValue;
125 memberFuncMap_[INTERFACE_SET_IMS_FEATURE_VALUE] = &CallManagerServiceStub::OnSetImsFeatureValue;
126 memberFuncMap_[INTERFACE_ENABLE_VOLTE] = &CallManagerServiceStub::OnEnableVoLte;
127 memberFuncMap_[INTERFACE_DISABLE_VOLTE] = &CallManagerServiceStub::OnDisableVoLte;
128 memberFuncMap_[INTERFACE_IS_VOLTE_ENABLED] = &CallManagerServiceStub::OnIsVoLteEnabled;
129 memberFuncMap_[INTERFACE_ENABLE_LTE_ENHANCE_MODE] = &CallManagerServiceStub::OnEnableLteEnhanceMode;
130 memberFuncMap_[INTERFACE_DISABLE_LTE_ENHANCE_MODE] = &CallManagerServiceStub::OnDisableEnhanceMode;
131 memberFuncMap_[INTERFACE_IS_LTE_ENHANCE_MODE_ENABLED] = &CallManagerServiceStub::OnIsLteEnhanceModeEnabled;
132 memberFuncMap_[INTERFACE_START_RTT] = &CallManagerServiceStub::OnStartRtt;
133 memberFuncMap_[INTERFACE_STOP_RTT] = &CallManagerServiceStub::OnStopRtt;
134 }
135
InitOttServiceRequest()136 void CallManagerServiceStub::InitOttServiceRequest()
137 {
138 memberFuncMap_[INTERFACE_REPORT_OTT_CALL_DETAIL_INFO] = &CallManagerServiceStub::OnReportOttCallDetailsInfo;
139 memberFuncMap_[INTERFACE_REPORT_OTT_CALL_EVENT_INFO] = &CallManagerServiceStub::OnReportOttCallEventInfo;
140 }
141
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)142 int32_t CallManagerServiceStub::OnRemoteRequest(
143 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
144 {
145 std::u16string myDescriptor = CallManagerServiceStub::GetDescriptor();
146 std::u16string remoteDescriptor = data.ReadInterfaceToken();
147 if (myDescriptor != remoteDescriptor) {
148 TELEPHONY_LOGE("descriptor checked fail !");
149 return TELEPHONY_ERR_DESCRIPTOR_MISMATCH;
150 }
151 TELEPHONY_LOGI("OnReceived, cmd = %{public}u", code);
152 auto itFunc = memberFuncMap_.find(code);
153 if (itFunc != memberFuncMap_.end()) {
154 auto memberFunc = itFunc->second;
155 if (memberFunc != nullptr) {
156 return (this->*memberFunc)(data, reply);
157 }
158 }
159 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
160 }
161
OnRegisterCallBack(MessageParcel & data,MessageParcel & reply)162 int32_t CallManagerServiceStub::OnRegisterCallBack(MessageParcel &data, MessageParcel &reply)
163 {
164 int32_t result = TELEPHONY_ERR_FAIL;
165 sptr<IRemoteObject> remote = data.ReadRemoteObject();
166 if (remote == nullptr) {
167 TELEPHONY_LOGE("callback ptr is nullptr.");
168 reply.WriteInt32(result);
169 return result;
170 }
171 sptr<ICallAbilityCallback> callback = iface_cast<ICallAbilityCallback>(remote);
172 result = RegisterCallBack(callback);
173 reply.WriteInt32(result);
174 return result;
175 }
176
OnUnRegisterCallBack(MessageParcel & data,MessageParcel & reply)177 int32_t CallManagerServiceStub::OnUnRegisterCallBack(MessageParcel &data, MessageParcel &reply)
178 {
179 int32_t result = TELEPHONY_ERR_FAIL;
180 result = UnRegisterCallBack();
181 if (!reply.WriteInt32(result)) {
182 TELEPHONY_LOGE("fail to write parcel");
183 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
184 }
185 return result;
186 }
187
OnDialCall(MessageParcel & data,MessageParcel & reply)188 int32_t CallManagerServiceStub::OnDialCall(MessageParcel &data, MessageParcel &reply)
189 {
190 int32_t result = TELEPHONY_ERR_FAIL;
191 AppExecFwk::PacMap dialInfo;
192 std::u16string callNumber = data.ReadString16();
193 dialInfo.PutIntValue("accountId", data.ReadInt32());
194 dialInfo.PutIntValue("videoState", data.ReadInt32());
195 dialInfo.PutIntValue("dialScene", data.ReadInt32());
196 dialInfo.PutIntValue("dialType", data.ReadInt32());
197 dialInfo.PutIntValue("callType", data.ReadInt32());
198 dialInfo.PutStringValue("bundleName", data.ReadString());
199 if (callNumber.length() > ACCOUNT_NUMBER_MAX_LENGTH) {
200 TELEPHONY_LOGE("the account number length exceeds the limit");
201 return CALL_ERR_NUMBER_OUT_OF_RANGE;
202 }
203 result = DialCall(callNumber, dialInfo);
204 TELEPHONY_LOGI("result:%{public}d", result);
205 if (!reply.WriteInt32(result)) {
206 TELEPHONY_LOGE("fail to write parcel");
207 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
208 }
209 return result;
210 }
211
OnAcceptCall(MessageParcel & data,MessageParcel & reply)212 int32_t CallManagerServiceStub::OnAcceptCall(MessageParcel &data, MessageParcel &reply)
213 {
214 int32_t callId = data.ReadInt32();
215 int32_t videoState = data.ReadInt32();
216 int32_t result = AnswerCall(callId, videoState);
217 TELEPHONY_LOGI("result:%{public}d", result);
218 if (!reply.WriteInt32(result)) {
219 TELEPHONY_LOGE("fail to write parcel");
220 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
221 }
222 return result;
223 }
224
OnRejectCall(MessageParcel & data,MessageParcel & reply)225 int32_t CallManagerServiceStub::OnRejectCall(MessageParcel &data, MessageParcel &reply)
226 {
227 int32_t callId = data.ReadInt32();
228 bool isSendSms = data.ReadBool();
229 std::u16string content = data.ReadString16();
230 int32_t result = RejectCall(callId, isSendSms, content);
231 TELEPHONY_LOGI("result:%{public}d", result);
232 if (!reply.WriteInt32(result)) {
233 TELEPHONY_LOGE("fail to write parcel");
234 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
235 }
236 return result;
237 }
238
OnHangUpCall(MessageParcel & data,MessageParcel & reply)239 int32_t CallManagerServiceStub::OnHangUpCall(MessageParcel &data, MessageParcel &reply)
240 {
241 int32_t callId = data.ReadInt32();
242 int32_t result = HangUpCall(callId);
243 TELEPHONY_LOGI("result:%{public}d", result);
244 if (!reply.WriteInt32(result)) {
245 TELEPHONY_LOGE("fail to write parcel");
246 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
247 }
248 return result;
249 }
250
OnGetCallState(MessageParcel & data,MessageParcel & reply)251 int32_t CallManagerServiceStub::OnGetCallState(MessageParcel &data, MessageParcel &reply)
252 {
253 int32_t result = GetCallState();
254 TELEPHONY_LOGI("result:%{public}d", result);
255 if (!reply.WriteInt32(result)) {
256 TELEPHONY_LOGE("fail to write parcel");
257 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
258 }
259 return TELEPHONY_SUCCESS;
260 }
261
OnHoldCall(MessageParcel & data,MessageParcel & reply)262 int32_t CallManagerServiceStub::OnHoldCall(MessageParcel &data, MessageParcel &reply)
263 {
264 int32_t callId = data.ReadInt32();
265 int32_t result = HoldCall(callId);
266 TELEPHONY_LOGI("result:%{public}d", result);
267 if (!reply.WriteInt32(result)) {
268 TELEPHONY_LOGE("fail to write parcel");
269 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
270 }
271 return result;
272 }
273
OnUnHoldCall(MessageParcel & data,MessageParcel & reply)274 int32_t CallManagerServiceStub::OnUnHoldCall(MessageParcel &data, MessageParcel &reply)
275 {
276 int32_t callId = data.ReadInt32();
277 int32_t result = UnHoldCall(callId);
278 TELEPHONY_LOGI("result:%{public}d", result);
279 if (!reply.WriteInt32(result)) {
280 TELEPHONY_LOGE("fail to write parcel");
281 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
282 }
283 return result;
284 }
285
OnSwitchCall(MessageParcel & data,MessageParcel & reply)286 int32_t CallManagerServiceStub::OnSwitchCall(MessageParcel &data, MessageParcel &reply)
287 {
288 int32_t callId = data.ReadInt32();
289 int32_t result = SwitchCall(callId);
290 TELEPHONY_LOGI("result:%{public}d", result);
291 if (!reply.WriteInt32(result)) {
292 TELEPHONY_LOGE("fail to write parcel");
293 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
294 }
295 return result;
296 }
297
OnHasCall(MessageParcel & data,MessageParcel & reply)298 int32_t CallManagerServiceStub::OnHasCall(MessageParcel &data, MessageParcel &reply)
299 {
300 bool result = HasCall();
301 TELEPHONY_LOGI("result:%{public}d", result);
302 if (!reply.WriteBool(result)) {
303 TELEPHONY_LOGE("fail to write parcel");
304 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
305 }
306 return TELEPHONY_SUCCESS;
307 }
308
OnIsNewCallAllowed(MessageParcel & data,MessageParcel & reply)309 int32_t CallManagerServiceStub::OnIsNewCallAllowed(MessageParcel &data, MessageParcel &reply)
310 {
311 bool result = IsNewCallAllowed();
312 TELEPHONY_LOGI("result:%{public}d", result);
313 if (!reply.WriteBool(result)) {
314 TELEPHONY_LOGE("fail to write parcel");
315 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
316 }
317 return TELEPHONY_SUCCESS;
318 }
319
OnSetMute(MessageParcel & data,MessageParcel & reply)320 int32_t CallManagerServiceStub::OnSetMute(MessageParcel &data, MessageParcel &reply)
321 {
322 bool isMute = data.ReadBool();
323 int32_t result = SetMuted(isMute);
324 TELEPHONY_LOGI("result:%{public}d", result);
325 if (!reply.WriteInt32(result)) {
326 TELEPHONY_LOGE("fail to write parcel");
327 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
328 }
329 return TELEPHONY_SUCCESS;
330 }
331
OnMuteRinger(MessageParcel & data,MessageParcel & reply)332 int32_t CallManagerServiceStub::OnMuteRinger(MessageParcel &data, MessageParcel &reply)
333 {
334 int32_t result = MuteRinger();
335 TELEPHONY_LOGI("result:%{public}d", result);
336 if (!reply.WriteInt32(result)) {
337 TELEPHONY_LOGE("fail to write parcel");
338 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
339 }
340 return TELEPHONY_SUCCESS;
341 }
342
OnSetAudioDevice(MessageParcel & data,MessageParcel & reply)343 int32_t CallManagerServiceStub::OnSetAudioDevice(MessageParcel &data, MessageParcel &reply)
344 {
345 int32_t deviceType = data.ReadInt32();
346 int32_t result = SetAudioDevice((AudioDevice)deviceType);
347 TELEPHONY_LOGI("result:%{public}d", result);
348 if (!reply.WriteInt32(result)) {
349 TELEPHONY_LOGE("fail to write parcel");
350 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
351 }
352 return TELEPHONY_SUCCESS;
353 }
354
OnIsRinging(MessageParcel & data,MessageParcel & reply)355 int32_t CallManagerServiceStub::OnIsRinging(MessageParcel &data, MessageParcel &reply)
356 {
357 bool result = IsRinging();
358 TELEPHONY_LOGI("result:%{public}d", result);
359 if (!reply.WriteBool(result)) {
360 TELEPHONY_LOGE("fail to write parcel");
361 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
362 }
363 return TELEPHONY_SUCCESS;
364 }
365
OnIsInEmergencyCall(MessageParcel & data,MessageParcel & reply)366 int32_t CallManagerServiceStub::OnIsInEmergencyCall(MessageParcel &data, MessageParcel &reply)
367 {
368 bool result = IsInEmergencyCall();
369 TELEPHONY_LOGI("result:%{public}d", result);
370 if (!reply.WriteBool(result)) {
371 TELEPHONY_LOGE("fail to write parcel");
372 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
373 }
374 return TELEPHONY_SUCCESS;
375 }
376
OnStartDtmf(MessageParcel & data,MessageParcel & reply)377 int32_t CallManagerServiceStub::OnStartDtmf(MessageParcel &data, MessageParcel &reply)
378 {
379 int32_t result = TELEPHONY_ERR_FAIL;
380 int32_t callId = data.ReadInt32();
381 char str = data.ReadInt8();
382 result = StartDtmf(callId, str);
383 TELEPHONY_LOGI("result:%{public}d", result);
384 if (!reply.WriteInt32(result)) {
385 TELEPHONY_LOGE("fail to write parcel");
386 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
387 }
388 return TELEPHONY_SUCCESS;
389 }
390
OnStopDtmf(MessageParcel & data,MessageParcel & reply)391 int32_t CallManagerServiceStub::OnStopDtmf(MessageParcel &data, MessageParcel &reply)
392 {
393 int32_t result = TELEPHONY_ERR_FAIL;
394 int32_t callId = data.ReadInt32();
395 result = StopDtmf(callId);
396 TELEPHONY_LOGI("result:%{public}d", result);
397 if (!reply.WriteInt32(result)) {
398 TELEPHONY_LOGE("fail to write parcel");
399 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
400 }
401 return TELEPHONY_SUCCESS;
402 }
403
OnGetCallWaiting(MessageParcel & data,MessageParcel & reply)404 int32_t CallManagerServiceStub::OnGetCallWaiting(MessageParcel &data, MessageParcel &reply)
405 {
406 int32_t result = TELEPHONY_ERR_FAIL;
407 int32_t slotId = data.ReadInt32();
408 result = GetCallWaiting(slotId);
409 TELEPHONY_LOGI("result:%{public}d", result);
410 if (!reply.WriteInt32(result)) {
411 TELEPHONY_LOGE("fail to write parcel");
412 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
413 }
414 return TELEPHONY_SUCCESS;
415 }
416
OnSetCallWaiting(MessageParcel & data,MessageParcel & reply)417 int32_t CallManagerServiceStub::OnSetCallWaiting(MessageParcel &data, MessageParcel &reply)
418 {
419 int32_t result = TELEPHONY_ERR_FAIL;
420 int32_t slotId = data.ReadInt32();
421 bool activate = data.ReadBool();
422 result = SetCallWaiting(slotId, activate);
423 TELEPHONY_LOGI("result:%{public}d", result);
424 if (!reply.WriteInt32(result)) {
425 TELEPHONY_LOGE("fail to write parcel");
426 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
427 }
428 return TELEPHONY_SUCCESS;
429 }
430
OnGetCallRestriction(MessageParcel & data,MessageParcel & reply)431 int32_t CallManagerServiceStub::OnGetCallRestriction(MessageParcel &data, MessageParcel &reply)
432 {
433 int32_t result = TELEPHONY_ERR_FAIL;
434 int32_t slotId = data.ReadInt32();
435 CallRestrictionType type = static_cast<CallRestrictionType>(data.ReadInt32());
436 result = GetCallRestriction(slotId, type);
437 TELEPHONY_LOGI("result:%{public}d", result);
438 if (!reply.WriteInt32(result)) {
439 TELEPHONY_LOGE("fail to write parcel");
440 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
441 }
442 return TELEPHONY_SUCCESS;
443 }
444
OnSetCallRestriction(MessageParcel & data,MessageParcel & reply)445 int32_t CallManagerServiceStub::OnSetCallRestriction(MessageParcel &data, MessageParcel &reply)
446 {
447 int32_t result = TELEPHONY_ERR_FAIL;
448 if (!data.ContainFileDescriptors()) {
449 TELEPHONY_LOGW("sent raw data is less than 32k");
450 }
451 int32_t slotId = data.ReadInt32();
452 CallRestrictionInfo *pCRInfo = (CallRestrictionInfo *)data.ReadRawData(sizeof(CallRestrictionInfo));
453 result = SetCallRestriction(slotId, *pCRInfo);
454 TELEPHONY_LOGI("result:%{public}d", result);
455 if (!reply.WriteInt32(result)) {
456 TELEPHONY_LOGE("fail to write parcel");
457 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
458 }
459 return TELEPHONY_SUCCESS;
460 }
461
OnGetTransferNumber(MessageParcel & data,MessageParcel & reply)462 int32_t CallManagerServiceStub::OnGetTransferNumber(MessageParcel &data, MessageParcel &reply)
463 {
464 int32_t result = TELEPHONY_ERR_FAIL;
465 int32_t slotId = data.ReadInt32();
466 CallTransferType type = static_cast<CallTransferType>(data.ReadInt32());
467 result = GetCallTransferInfo(slotId, type);
468 TELEPHONY_LOGI("result:%{public}d", result);
469 if (!reply.WriteInt32(result)) {
470 TELEPHONY_LOGE("fail to write parcel");
471 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
472 }
473 return TELEPHONY_SUCCESS;
474 }
475
OnSetTransferNumber(MessageParcel & data,MessageParcel & reply)476 int32_t CallManagerServiceStub::OnSetTransferNumber(MessageParcel &data, MessageParcel &reply)
477 {
478 int32_t result = TELEPHONY_ERR_FAIL;
479 if (!data.ContainFileDescriptors()) {
480 TELEPHONY_LOGW("sent raw data is less than 32k");
481 }
482 int32_t slotId = data.ReadInt32();
483 CallTransferInfo *pCTInfo = (CallTransferInfo *)data.ReadRawData(sizeof(CallTransferInfo));
484 result = SetCallTransferInfo(slotId, *pCTInfo);
485 TELEPHONY_LOGI("result:%{public}d", result);
486 if (!reply.WriteInt32(result)) {
487 TELEPHONY_LOGE("fail to write parcel");
488 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
489 }
490 return TELEPHONY_SUCCESS;
491 }
492
OnCombineConference(MessageParcel & data,MessageParcel & reply)493 int32_t CallManagerServiceStub::OnCombineConference(MessageParcel &data, MessageParcel &reply)
494 {
495 int32_t mainCallId = data.ReadInt32();
496 int32_t result = CombineConference(mainCallId);
497 TELEPHONY_LOGI("result:%{public}d", result);
498 if (!reply.WriteInt32(result)) {
499 TELEPHONY_LOGE("fail to write parcel");
500 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
501 }
502 return TELEPHONY_SUCCESS;
503 }
504
OnSeparateConference(MessageParcel & data,MessageParcel & reply)505 int32_t CallManagerServiceStub::OnSeparateConference(MessageParcel &data, MessageParcel &reply)
506 {
507 int32_t callId = data.ReadInt32();
508 int32_t result = SeparateConference(callId);
509 TELEPHONY_LOGI("result:%{public}d", result);
510 if (!reply.WriteInt32(result)) {
511 TELEPHONY_LOGE("fail to write parcel");
512 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
513 }
514 return TELEPHONY_SUCCESS;
515 }
516
OnJoinConference(MessageParcel & data,MessageParcel & reply)517 int32_t CallManagerServiceStub::OnJoinConference(MessageParcel &data, MessageParcel &reply)
518 {
519 int32_t result = TELEPHONY_ERR_FAIL;
520 int32_t callId = data.ReadInt32();
521 std::vector<std::u16string> numberList;
522 if (!data.ReadString16Vector(&numberList)) {
523 TELEPHONY_LOGE("read conference participants numberList failed");
524 return TELEPHONY_ERR_WRITE_DATA_FAIL;
525 }
526 result = JoinConference(callId, numberList);
527 if (!reply.WriteInt32(result)) {
528 TELEPHONY_LOGE("JoinConference fail to write parcel");
529 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
530 }
531 return TELEPHONY_SUCCESS;
532 }
533
OnSetCallPreferenceMode(MessageParcel & data,MessageParcel & reply)534 int32_t CallManagerServiceStub::OnSetCallPreferenceMode(MessageParcel &data, MessageParcel &reply)
535 {
536 int32_t result = TELEPHONY_ERR_FAIL;
537 int32_t slotId = data.ReadInt32();
538 int32_t mode = data.ReadInt32();
539 result = SetCallPreferenceMode(slotId, mode);
540 if (!reply.WriteInt32(result)) {
541 TELEPHONY_LOGE("SetCallPreferenceMode fail to write parcel");
542 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
543 }
544 return TELEPHONY_SUCCESS;
545 }
546
OnControlCamera(MessageParcel & data,MessageParcel & reply)547 int32_t CallManagerServiceStub::OnControlCamera(MessageParcel &data, MessageParcel &reply)
548 {
549 int32_t result = TELEPHONY_ERR_FAIL;
550 std::u16string cameraId = data.ReadString16();
551 result = ControlCamera(cameraId);
552 TELEPHONY_LOGI("result:%{public}d", result);
553 if (!reply.WriteInt32(result)) {
554 TELEPHONY_LOGE("ControlCamera fail to write parcel");
555 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
556 }
557 return TELEPHONY_SUCCESS;
558 }
559
OnSetPreviewWindow(MessageParcel & data,MessageParcel & reply)560 int32_t CallManagerServiceStub::OnSetPreviewWindow(MessageParcel &data, MessageParcel &reply)
561 {
562 int32_t result = TELEPHONY_ERR_FAIL;
563 if (!data.ContainFileDescriptors()) {
564 TELEPHONY_LOGW("sent raw data is less than 32k");
565 }
566 VideoWindow *pSurface = (VideoWindow *)data.ReadRawData(sizeof(VideoWindow));
567 result = SetPreviewWindow(*pSurface);
568 if (!reply.WriteInt32(result)) {
569 TELEPHONY_LOGE("SetPreviewWindow fail to write parcel");
570 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
571 }
572 return TELEPHONY_SUCCESS;
573 }
574
OnSetDisplayWindow(MessageParcel & data,MessageParcel & reply)575 int32_t CallManagerServiceStub::OnSetDisplayWindow(MessageParcel &data, MessageParcel &reply)
576 {
577 int32_t result = TELEPHONY_ERR_FAIL;
578 if (!data.ContainFileDescriptors()) {
579 TELEPHONY_LOGW("sent raw data is less than 32k");
580 }
581 VideoWindow *pSurface = (VideoWindow *)data.ReadRawData(sizeof(VideoWindow));
582 result = SetDisplayWindow(*pSurface);
583 if (!reply.WriteInt32(result)) {
584 TELEPHONY_LOGE("SetDisplayWindow fail to write parcel");
585 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
586 }
587 return TELEPHONY_SUCCESS;
588 }
589
OnSetCameraZoom(MessageParcel & data,MessageParcel & reply)590 int32_t CallManagerServiceStub::OnSetCameraZoom(MessageParcel &data, MessageParcel &reply)
591 {
592 int32_t result = TELEPHONY_ERR_FAIL;
593 float zoom = data.ReadFloat();
594 result = SetCameraZoom(zoom);
595 TELEPHONY_LOGI("result:%{public}d", result);
596 if (!reply.WriteInt32(result)) {
597 TELEPHONY_LOGE("SetCameraZoom fail to write parcel");
598 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
599 }
600 return TELEPHONY_SUCCESS;
601 }
602
OnSetPausePicture(MessageParcel & data,MessageParcel & reply)603 int32_t CallManagerServiceStub::OnSetPausePicture(MessageParcel &data, MessageParcel &reply)
604 {
605 int32_t result = TELEPHONY_ERR_FAIL;
606 std::u16string path = data.ReadString16();
607 result = SetPausePicture(path);
608 TELEPHONY_LOGI("result:%{public}d", result);
609 if (!reply.WriteInt32(result)) {
610 TELEPHONY_LOGE("SetPausePicture fail to write parcel");
611 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
612 }
613 return TELEPHONY_SUCCESS;
614 }
615
OnSetDeviceDirection(MessageParcel & data,MessageParcel & reply)616 int32_t CallManagerServiceStub::OnSetDeviceDirection(MessageParcel &data, MessageParcel &reply)
617 {
618 int32_t result = TELEPHONY_ERR_FAIL;
619 int32_t rotation = data.ReadInt32();
620 result = SetDeviceDirection(rotation);
621 TELEPHONY_LOGI("result:%{public}d", result);
622 if (!reply.WriteInt32(result)) {
623 TELEPHONY_LOGE("SetDeviceDirection fail to write parcel");
624 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
625 }
626 return TELEPHONY_SUCCESS;
627 }
628
OnIsEmergencyPhoneNumber(MessageParcel & data,MessageParcel & reply)629 int32_t CallManagerServiceStub::OnIsEmergencyPhoneNumber(MessageParcel &data, MessageParcel &reply)
630 {
631 std::u16string callNumber = data.ReadString16();
632 int32_t slotId = data.ReadInt32();
633 int32_t errorCode = TELEPHONY_ERR_FAIL;
634 bool result = IsEmergencyPhoneNumber(callNumber, slotId, errorCode);
635 TELEPHONY_LOGI("result:%{public}d", result);
636 if (!reply.WriteBool(result) || !reply.WriteInt32(errorCode)) {
637 TELEPHONY_LOGE("fail to write parcel");
638 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
639 }
640 return TELEPHONY_SUCCESS;
641 }
642
OnFormatPhoneNumber(MessageParcel & data,MessageParcel & reply)643 int32_t CallManagerServiceStub::OnFormatPhoneNumber(MessageParcel &data, MessageParcel &reply)
644 {
645 std::u16string callNumber = data.ReadString16();
646 std::u16string countryCode = data.ReadString16();
647 std::u16string formatNumber;
648 int32_t result = FormatPhoneNumber(callNumber, countryCode, formatNumber);
649 TELEPHONY_LOGI("result:%{public}d", result);
650 if (!reply.WriteString16(formatNumber) || !reply.WriteInt32(result)) {
651 TELEPHONY_LOGE("fail to write parcel");
652 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
653 }
654 return TELEPHONY_SUCCESS;
655 }
656
OnFormatPhoneNumberToE164(MessageParcel & data,MessageParcel & reply)657 int32_t CallManagerServiceStub::OnFormatPhoneNumberToE164(MessageParcel &data, MessageParcel &reply)
658 {
659 std::u16string callNumber = data.ReadString16();
660 std::u16string countryCode = data.ReadString16();
661 std::u16string formatNumber;
662 int32_t result = FormatPhoneNumberToE164(callNumber, countryCode, formatNumber);
663 TELEPHONY_LOGI("result:%{public}d", result);
664 if (!reply.WriteString16(formatNumber) || !reply.WriteInt32(result)) {
665 TELEPHONY_LOGE("fail to write parcel");
666 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
667 }
668 return TELEPHONY_SUCCESS;
669 }
670
OnGetMainCallId(MessageParcel & data,MessageParcel & reply)671 int32_t CallManagerServiceStub::OnGetMainCallId(MessageParcel &data, MessageParcel &reply)
672 {
673 int32_t callId = data.ReadInt32();
674 int32_t result = GetMainCallId(callId);
675 TELEPHONY_LOGI("result:%{public}d", result);
676 if (!reply.WriteInt32(result)) {
677 TELEPHONY_LOGE("fail to write parcel");
678 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
679 }
680 return TELEPHONY_SUCCESS;
681 }
682
OnGetSubCallIdList(MessageParcel & data,MessageParcel & reply)683 int32_t CallManagerServiceStub::OnGetSubCallIdList(MessageParcel &data, MessageParcel &reply)
684 {
685 int32_t callId = data.ReadInt32();
686 std::vector<std::u16string> result = GetSubCallIdList(callId);
687 if (!reply.WriteString16Vector(result)) {
688 TELEPHONY_LOGE("fail to write parcel");
689 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
690 }
691 return TELEPHONY_SUCCESS;
692 }
693
OnGetCallIdListForConference(MessageParcel & data,MessageParcel & reply)694 int32_t CallManagerServiceStub::OnGetCallIdListForConference(MessageParcel &data, MessageParcel &reply)
695 {
696 int32_t callId = data.ReadInt32();
697 std::vector<std::u16string> result = GetCallIdListForConference(callId);
698 if (!reply.WriteString16Vector(result)) {
699 TELEPHONY_LOGE("fail to write parcel");
700 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
701 }
702 return TELEPHONY_SUCCESS;
703 }
704
OnGetImsConfig(MessageParcel & data,MessageParcel & reply)705 int32_t CallManagerServiceStub::OnGetImsConfig(MessageParcel &data, MessageParcel &reply)
706 {
707 int32_t result = TELEPHONY_ERR_FAIL;
708 int32_t slotId = data.ReadInt32();
709 int32_t item = data.ReadInt32();
710 result = GetImsConfig(slotId, static_cast<ImsConfigItem>(item));
711 if (!reply.WriteInt32(result)) {
712 TELEPHONY_LOGE("GetImsConfig fail to write parcel");
713 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
714 }
715 return TELEPHONY_SUCCESS;
716 }
717
OnSetImsConfig(MessageParcel & data,MessageParcel & reply)718 int32_t CallManagerServiceStub::OnSetImsConfig(MessageParcel &data, MessageParcel &reply)
719 {
720 int32_t result = TELEPHONY_ERR_FAIL;
721 int32_t slotId = data.ReadInt32();
722 int32_t item = data.ReadInt32();
723 std::u16string value = data.ReadString16();
724 result = SetImsConfig(slotId, static_cast<ImsConfigItem>(item), value);
725 if (!reply.WriteInt32(result)) {
726 TELEPHONY_LOGE("SetImsConfig fail to write parcel");
727 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
728 }
729 return TELEPHONY_SUCCESS;
730 }
731
OnGetImsFeatureValue(MessageParcel & data,MessageParcel & reply)732 int32_t CallManagerServiceStub::OnGetImsFeatureValue(MessageParcel &data, MessageParcel &reply)
733 {
734 int32_t result = TELEPHONY_ERR_FAIL;
735 int32_t slotId = data.ReadInt32();
736 FeatureType type = static_cast<FeatureType>(data.ReadInt32());
737 result = GetImsFeatureValue(slotId, type);
738 if (!reply.WriteInt32(result)) {
739 TELEPHONY_LOGE("GetImsFeatureValue fail to write parcel");
740 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
741 }
742 return TELEPHONY_SUCCESS;
743 }
744
OnSetImsFeatureValue(MessageParcel & data,MessageParcel & reply)745 int32_t CallManagerServiceStub::OnSetImsFeatureValue(MessageParcel &data, MessageParcel &reply)
746 {
747 int32_t result = TELEPHONY_ERR_FAIL;
748 int32_t slotId = data.ReadInt32();
749 FeatureType type = static_cast<FeatureType>(data.ReadInt32());
750 int32_t value = data.ReadInt32();
751 result = SetImsFeatureValue(slotId, type, value);
752 if (!reply.WriteInt32(result)) {
753 TELEPHONY_LOGE("SetImsFeatureValue fail to write parcel");
754 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
755 }
756 return TELEPHONY_SUCCESS;
757 }
758
OnUpdateCallMediaMode(MessageParcel & data,MessageParcel & reply)759 int32_t CallManagerServiceStub::OnUpdateCallMediaMode(MessageParcel &data, MessageParcel &reply)
760 {
761 int32_t result = TELEPHONY_ERR_FAIL;
762 if (!data.ContainFileDescriptors()) {
763 TELEPHONY_LOGW("sent raw data is less than 32k");
764 }
765 int32_t callId = data.ReadInt32();
766 ImsCallMode mode = static_cast<ImsCallMode>(data.ReadUint32());
767 result = UpdateImsCallMode(callId, mode);
768 if (!reply.WriteInt32(result)) {
769 TELEPHONY_LOGE("OnUpdateCallMediaMode fail to write parcel");
770 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
771 }
772 return TELEPHONY_SUCCESS;
773 }
774
OnEnableVoLte(MessageParcel & data,MessageParcel & reply)775 int32_t CallManagerServiceStub::OnEnableVoLte(MessageParcel &data, MessageParcel &reply)
776 {
777 int32_t result = TELEPHONY_ERR_FAIL;
778 int32_t slotId = data.ReadInt32();
779 result = EnableImsSwitch(slotId);
780 if (!reply.WriteInt32(result)) {
781 TELEPHONY_LOGE("EnableImsSwitch fail to write parcel");
782 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
783 }
784 return TELEPHONY_SUCCESS;
785 }
786
OnDisableVoLte(MessageParcel & data,MessageParcel & reply)787 int32_t CallManagerServiceStub::OnDisableVoLte(MessageParcel &data, MessageParcel &reply)
788 {
789 int32_t result = TELEPHONY_ERR_FAIL;
790 int32_t slotId = data.ReadInt32();
791 result = DisableImsSwitch(slotId);
792 if (!reply.WriteInt32(result)) {
793 TELEPHONY_LOGE("DisableImsSwitch fail to write parcel");
794 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
795 }
796 return TELEPHONY_SUCCESS;
797 }
798
OnIsVoLteEnabled(MessageParcel & data,MessageParcel & reply)799 int32_t CallManagerServiceStub::OnIsVoLteEnabled(MessageParcel &data, MessageParcel &reply)
800 {
801 int32_t result = TELEPHONY_ERR_FAIL;
802 int32_t slotId = data.ReadInt32();
803 result = IsImsSwitchEnabled(slotId);
804 if (!reply.WriteInt32(result)) {
805 TELEPHONY_LOGE("IsImsSwitchEnabled fail to write parcel");
806 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
807 }
808 return TELEPHONY_SUCCESS;
809 }
810
OnEnableLteEnhanceMode(MessageParcel & data,MessageParcel & reply)811 int32_t CallManagerServiceStub::OnEnableLteEnhanceMode(MessageParcel &data, MessageParcel &reply)
812 {
813 int32_t result = TELEPHONY_ERR_FAIL;
814 int32_t slotId = data.ReadInt32();
815 result = EnableLteEnhanceMode(slotId);
816 if (!reply.WriteInt32(result)) {
817 TELEPHONY_LOGE("EnableLteEnhanceMode fail to write parcel");
818 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
819 }
820 return TELEPHONY_SUCCESS;
821 }
822
OnDisableEnhanceMode(MessageParcel & data,MessageParcel & reply)823 int32_t CallManagerServiceStub::OnDisableEnhanceMode(MessageParcel &data, MessageParcel &reply)
824 {
825 int32_t result = TELEPHONY_ERR_FAIL;
826 int32_t slotId = data.ReadInt32();
827 result = DisableLteEnhanceMode(slotId);
828 if (!reply.WriteInt32(result)) {
829 TELEPHONY_LOGE("DisableLteEnhanceMode fail to write parcel");
830 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
831 }
832 return TELEPHONY_SUCCESS;
833 }
834
OnIsLteEnhanceModeEnabled(MessageParcel & data,MessageParcel & reply)835 int32_t CallManagerServiceStub::OnIsLteEnhanceModeEnabled(MessageParcel &data, MessageParcel &reply)
836 {
837 int32_t result = TELEPHONY_ERR_FAIL;
838 int32_t slotId = data.ReadInt32();
839 result = IsLteEnhanceModeEnabled(slotId);
840 if (!reply.WriteInt32(result)) {
841 TELEPHONY_LOGE("GetLteEnhanceMode fail to write parcel");
842 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
843 }
844 return TELEPHONY_SUCCESS;
845 }
846
OnStartRtt(MessageParcel & data,MessageParcel & reply)847 int32_t CallManagerServiceStub::OnStartRtt(MessageParcel &data, MessageParcel &reply)
848 {
849 int32_t result = TELEPHONY_ERR_FAIL;
850 int32_t callId = data.ReadInt32();
851 std::u16string msg = data.ReadString16();
852 result = StartRtt(callId, msg);
853 if (!reply.WriteInt32(result)) {
854 TELEPHONY_LOGE("fail to write parcel");
855 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
856 }
857 return TELEPHONY_SUCCESS;
858 }
859
OnStopRtt(MessageParcel & data,MessageParcel & reply)860 int32_t CallManagerServiceStub::OnStopRtt(MessageParcel &data, MessageParcel &reply)
861 {
862 int32_t result = TELEPHONY_ERR_FAIL;
863 int32_t callId = data.ReadInt32();
864 result = StopRtt(callId);
865 if (!reply.WriteInt32(result)) {
866 TELEPHONY_LOGE("fail to write parcel");
867 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
868 }
869 return TELEPHONY_SUCCESS;
870 }
871
OnReportOttCallDetailsInfo(MessageParcel & data,MessageParcel & reply)872 int32_t CallManagerServiceStub::OnReportOttCallDetailsInfo(MessageParcel &data, MessageParcel &reply)
873 {
874 int32_t result = TELEPHONY_ERR_FAIL;
875 if (!data.ContainFileDescriptors()) {
876 TELEPHONY_LOGW("sent raw data is less than 32k");
877 }
878 int32_t vecCnt = data.ReadInt32();
879 if (vecCnt <= 0) {
880 TELEPHONY_LOGE("vector is empty");
881 return TELEPHONY_ERR_ARGUMENT_INVALID;
882 }
883 std::vector<OttCallDetailsInfo> ottVec;
884 OttCallDetailsInfo *infoPtr = nullptr;
885 for (int32_t i = 0; i < vecCnt; i++) {
886 if ((infoPtr = (OttCallDetailsInfo *)data.ReadRawData(sizeof(OttCallDetailsInfo))) == nullptr) {
887 TELEPHONY_LOGE("reading raw data failed");
888 return TELEPHONY_ERR_LOCAL_PTR_NULL;
889 }
890 ottVec.push_back(*infoPtr);
891 }
892 result = ReportOttCallDetailsInfo(ottVec);
893 if (!reply.WriteInt32(result)) {
894 TELEPHONY_LOGE("ReportOttCallDetailsInfo fail to write parcel");
895 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
896 }
897 return TELEPHONY_SUCCESS;
898 }
899
OnReportOttCallEventInfo(MessageParcel & data,MessageParcel & reply)900 int32_t CallManagerServiceStub::OnReportOttCallEventInfo(MessageParcel &data, MessageParcel &reply)
901 {
902 int32_t result = TELEPHONY_ERR_FAIL;
903 if (!data.ContainFileDescriptors()) {
904 TELEPHONY_LOGW("sent raw data is less than 32k");
905 }
906 OttCallEventInfo *pEventInfo = (OttCallEventInfo *)data.ReadRawData(sizeof(OttCallEventInfo));
907 result = ReportOttCallEventInfo(*pEventInfo);
908 if (!reply.WriteInt32(result)) {
909 TELEPHONY_LOGE("ReportOttCallDetailsInfo fail to write parcel");
910 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
911 }
912 return TELEPHONY_SUCCESS;
913 }
914
OnGetProxyObjectPtr(MessageParcel & data,MessageParcel & reply)915 int32_t CallManagerServiceStub::OnGetProxyObjectPtr(MessageParcel &data, MessageParcel &reply)
916 {
917 CallManagerProxyType proxyType = static_cast<CallManagerProxyType>(data.ReadInt32());
918 sptr<IRemoteObject> objectPtr = GetProxyObjectPtr(proxyType);
919 if (!reply.WriteRemoteObject(objectPtr)) {
920 TELEPHONY_LOGE("OnGetProxyObjectPtr fail to write parcel");
921 return TELEPHONY_ERR_WRITE_REPLY_FAIL;
922 }
923 return TELEPHONY_SUCCESS;
924 }
925 } // namespace Telephony
926 } // namespace OHOS
927