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