• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "cellular_call_stub.h"
17 
18 #include "call_manager_errors.h"
19 #include "call_status_callback_proxy.h"
20 #include "emergency_utils.h"
21 #include "ipc_skeleton.h"
22 #include "i_call_status_callback.h"
23 #include "telephony_log_wrapper.h"
24 #include "telephony_permission.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 const int32_t MAX_SIZE = 10;
29 const int32_t MAX_ECC_SIZE = 1000;
30 const int32_t FOUNDATION_UID = 5523;
31 const int32_t MAX_CALL_NUM = 10;
32 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)33 int32_t CellularCallStub::OnRemoteRequest(
34     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
35 {
36     std::u16string myDescriptor = CellularCallStub::GetDescriptor();
37     std::u16string remoteDescriptor = data.ReadInterfaceToken();
38     if (myDescriptor != remoteDescriptor) {
39         TELEPHONY_LOGE("descriptor checked fail");
40         return TELEPHONY_ERR_DESCRIPTOR_MISMATCH;
41     }
42 
43     auto itFunc = requestFuncMap_.find(static_cast<CellularCallInterfaceCode>(code));
44     if (itFunc != requestFuncMap_.end()) {
45         auto callingUid = IPCSkeleton::GetCallingUid();
46         if (callingUid != FOUNDATION_UID &&
47             !TelephonyPermission::CheckPermission(Permission::CONNECT_CELLULAR_CALL_SERVICE)) {
48             TELEPHONY_LOGE("Check permission failed, no CONNECT_CELLULAR_CALL_SERVICE permisson.");
49             return TELEPHONY_ERR_PERMISSION_ERR;
50         }
51         auto requestFunc = itFunc->second;
52         if (requestFunc != nullptr) {
53             return requestFunc(data, reply);
54         }
55     }
56     TELEPHONY_LOGI("CellularCallStub::OnRemoteRequest, default case, need check.");
57     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
58 }
59 
CellularCallStub()60 CellularCallStub::CellularCallStub()
61 {
62     TELEPHONY_LOGI("CellularCallStub::CellularCallStub");
63     InitFuncMap();
64 }
65 
~CellularCallStub()66 CellularCallStub::~CellularCallStub()
67 {
68     TELEPHONY_LOGI("CellularCallStub::~CellularCallStub");
69     requestFuncMap_.clear();
70 }
71 
InitFuncMap()72 void CellularCallStub::InitFuncMap()
73 {
74     InitDialFuncMap();
75     InitDtmfFuncMap();
76     InitConfigFuncMap();
77     InitVideoFuncMap();
78     InitSupplementFuncMap();
79 }
80 
InitDialFuncMap()81 void CellularCallStub::InitDialFuncMap()
82 {
83     requestFuncMap_[CellularCallInterfaceCode::DIAL] =
84         [this](MessageParcel &data, MessageParcel &reply) { return OnDialInner(data, reply); };
85     requestFuncMap_[CellularCallInterfaceCode::HANG_UP] =
86         [this](MessageParcel &data, MessageParcel &reply) { return OnHangUpInner(data, reply); };
87     requestFuncMap_[CellularCallInterfaceCode::REJECT] =
88         [this](MessageParcel &data, MessageParcel &reply) { return OnRejectInner(data, reply); };
89     requestFuncMap_[CellularCallInterfaceCode::ANSWER] =
90         [this](MessageParcel &data, MessageParcel &reply) { return OnAnswerInner(data, reply); };
91     requestFuncMap_[CellularCallInterfaceCode::EMERGENCY_CALL] =
92         [this](MessageParcel &data, MessageParcel &reply) { return OnIsEmergencyPhoneNumberInner(data, reply); };
93     requestFuncMap_[CellularCallInterfaceCode::SET_EMERGENCY_CALL_LIST] =
94         [this](MessageParcel &data, MessageParcel &reply) { return OnSetEmergencyCallList(data, reply); };
95     requestFuncMap_[CellularCallInterfaceCode::HOLD_CALL] =
96         [this](MessageParcel &data, MessageParcel &reply) { return OnHoldCallInner(data, reply); };
97     requestFuncMap_[CellularCallInterfaceCode::UN_HOLD_CALL] =
98         [this](MessageParcel &data, MessageParcel &reply) { return OnUnHoldCallInner(data, reply); };
99     requestFuncMap_[CellularCallInterfaceCode::SWITCH_CALL] =
100         [this](MessageParcel &data, MessageParcel &reply) { return OnSwitchCallInner(data, reply); };
101     requestFuncMap_[CellularCallInterfaceCode::COMBINE_CONFERENCE] =
102         [this](MessageParcel &data, MessageParcel &reply) { return OnCombineConferenceInner(data, reply); };
103     requestFuncMap_[CellularCallInterfaceCode::SEPARATE_CONFERENCE] =
104         [this](MessageParcel &data, MessageParcel &reply) { return OnSeparateConferenceInner(data, reply); };
105     requestFuncMap_[CellularCallInterfaceCode::INVITE_TO_CONFERENCE] =
106         [this](MessageParcel &data, MessageParcel &reply) { return OnInviteToConferenceInner(data, reply); };
107     requestFuncMap_[CellularCallInterfaceCode::KICK_OUT_CONFERENCE] =
108         [this](MessageParcel &data, MessageParcel &reply) { return OnKickOutFromConferenceInner(data, reply); };
109     requestFuncMap_[CellularCallInterfaceCode::HANG_UP_ALL_CONNECTION] =
110         [this](MessageParcel &data, MessageParcel &reply) { return OnHangUpAllConnectionInner(data, reply); };
111     requestFuncMap_[CellularCallInterfaceCode::SET_READY_TO_CALL] =
112         [this](MessageParcel &data, MessageParcel &reply) { return OnSetReadyToCallInner(data, reply); };
113     requestFuncMap_[CellularCallInterfaceCode::CLEAR_ALL_CALLS] =
114         [this](MessageParcel &data, MessageParcel &reply) { return OnClearAllCallsInner(data, reply); };
115 }
116 
InitDtmfFuncMap()117 void CellularCallStub::InitDtmfFuncMap()
118 {
119     requestFuncMap_[CellularCallInterfaceCode::START_DTMF] =
120         [this](MessageParcel &data, MessageParcel &reply) { return OnStartDtmfInner(data, reply); };
121     requestFuncMap_[CellularCallInterfaceCode::STOP_DTMF] =
122         [this](MessageParcel &data, MessageParcel &reply) { return OnStopDtmfInner(data, reply); };
123     requestFuncMap_[CellularCallInterfaceCode::POST_DIAL_PROCEED] =
124         [this](MessageParcel &data, MessageParcel &reply) { return OnPostDialProceedInner(data, reply); };
125     requestFuncMap_[CellularCallInterfaceCode::SEND_DTMF] =
126         [this](MessageParcel &data, MessageParcel &reply) { return OnSendDtmfInner(data, reply); };
127     requestFuncMap_[CellularCallInterfaceCode::START_RTT] =
128         [this](MessageParcel &data, MessageParcel &reply) { return OnStartRttInner(data, reply); };
129     requestFuncMap_[CellularCallInterfaceCode::STOP_RTT] =
130         [this](MessageParcel &data, MessageParcel &reply) { return OnStopRttInner(data, reply); };
131 }
132 
InitConfigFuncMap()133 void CellularCallStub::InitConfigFuncMap()
134 {
135     requestFuncMap_[CellularCallInterfaceCode::SET_DOMAIN_PREFERENCE_MODE] =
136         [this](MessageParcel &data, MessageParcel &reply) { return OnSetDomainPreferenceModeInner(data, reply); };
137     requestFuncMap_[CellularCallInterfaceCode::GET_DOMAIN_PREFERENCE_MODE] =
138         [this](MessageParcel &data, MessageParcel &reply) { return OnGetDomainPreferenceModeInner(data, reply); };
139     requestFuncMap_[CellularCallInterfaceCode::SET_IMS_SWITCH_STATUS] =
140         [this](MessageParcel &data, MessageParcel &reply) { return OnSetImsSwitchStatusInner(data, reply); };
141     requestFuncMap_[CellularCallInterfaceCode::GET_IMS_SWITCH_STATUS] =
142         [this](MessageParcel &data, MessageParcel &reply) { return OnGetImsSwitchStatusInner(data, reply); };
143     requestFuncMap_[CellularCallInterfaceCode::GET_CARRIER_VT_CONFIG] =
144         [this](MessageParcel &data, MessageParcel &reply) { return OnGetCarrierVtConfigInner(data, reply); };
145     requestFuncMap_[CellularCallInterfaceCode::SET_VONR_SWITCH_STATUS] =
146         [this](MessageParcel &data, MessageParcel &reply) { return OnSetVoNRStateInner(data, reply); };
147     requestFuncMap_[CellularCallInterfaceCode::GET_VONR_SWITCH_STATUS] =
148         [this](MessageParcel &data, MessageParcel &reply) { return OnGetVoNRStateInner(data, reply); };
149     requestFuncMap_[CellularCallInterfaceCode::SET_IMS_CONFIG_STRING] =
150         [this](MessageParcel &data, MessageParcel &reply) { return OnSetImsConfigStringInner(data, reply); };
151     requestFuncMap_[CellularCallInterfaceCode::SET_IMS_CONFIG_INT] =
152         [this](MessageParcel &data, MessageParcel &reply) { return OnSetImsConfigIntInner(data, reply); };
153     requestFuncMap_[CellularCallInterfaceCode::GET_IMS_CONFIG] =
154         [this](MessageParcel &data, MessageParcel &reply) { return OnGetImsConfigInner(data, reply); };
155     requestFuncMap_[CellularCallInterfaceCode::SET_IMS_FEATURE] =
156         [this](MessageParcel &data, MessageParcel &reply) { return OnSetImsFeatureValueInner(data, reply); };
157     requestFuncMap_[CellularCallInterfaceCode::GET_IMS_FEATURE] =
158         [this](MessageParcel &data, MessageParcel &reply) { return OnGetImsFeatureValueInner(data, reply); };
159     requestFuncMap_[CellularCallInterfaceCode::SET_MUTE] =
160         [this](MessageParcel &data, MessageParcel &reply) { return OnSetMuteInner(data, reply); };
161     requestFuncMap_[CellularCallInterfaceCode::GET_MUTE] =
162         [this](MessageParcel &data, MessageParcel &reply) { return OnGetMuteInner(data, reply); };
163 }
164 
InitVideoFuncMap()165 void CellularCallStub::InitVideoFuncMap()
166 {
167     requestFuncMap_[CellularCallInterfaceCode::CTRL_CAMERA] =
168         [this](MessageParcel &data, MessageParcel &reply) { return OnControlCameraInner(data, reply); };
169     requestFuncMap_[CellularCallInterfaceCode::SET_PREVIEW_WINDOW] =
170         [this](MessageParcel &data, MessageParcel &reply) { return OnSetPreviewWindowInner(data, reply); };
171     requestFuncMap_[CellularCallInterfaceCode::SET_DISPLAY_WINDOW] =
172         [this](MessageParcel &data, MessageParcel &reply) { return OnSetDisplayWindowInner(data, reply); };
173     requestFuncMap_[CellularCallInterfaceCode::SET_CAMERA_ZOOM] =
174         [this](MessageParcel &data, MessageParcel &reply) { return OnSetCameraZoomInner(data, reply); };
175     requestFuncMap_[CellularCallInterfaceCode::SET_PAUSE_IMAGE] =
176         [this](MessageParcel &data, MessageParcel &reply) { return OnSetPausePictureInner(data, reply); };
177     requestFuncMap_[CellularCallInterfaceCode::SET_DEVICE_DIRECTION] =
178         [this](MessageParcel &data, MessageParcel &reply) { return OnSetDeviceDirectionInner(data, reply); };
179     requestFuncMap_[CellularCallInterfaceCode::SEND_CALL_MEDIA_MODE_REQUEST] =
180         [this](MessageParcel &data, MessageParcel &reply) {
181             return OnSendUpdateCallMediaModeRequestInner(data, reply);
182         };
183     requestFuncMap_[CellularCallInterfaceCode::SEND_CALL_MEDIA_MODE_RESPONSE] =
184         [this](MessageParcel &data, MessageParcel &reply) {
185             return OnSendUpdateCallMediaModeResponseInner(data, reply);
186         };
187     requestFuncMap_[CellularCallInterfaceCode::CANCEL_CALL_UPGRADE] =
188         [this](MessageParcel &data, MessageParcel &reply) { return OnCancelCallUpgradeInner(data, reply); };
189     requestFuncMap_[CellularCallInterfaceCode::REQUEST_CAMERA_CAPABILITY] =
190         [this](MessageParcel &data, MessageParcel &reply) { return OnRequestCameraCapabilitiesInner(data, reply); };
191 }
192 
InitSupplementFuncMap()193 void CellularCallStub::InitSupplementFuncMap()
194 {
195     requestFuncMap_[CellularCallInterfaceCode::SET_CALL_TRANSFER] =
196         [this](MessageParcel &data, MessageParcel &reply) { return OnSetCallTransferInner(data, reply); };
197     requestFuncMap_[CellularCallInterfaceCode::GET_CALL_TRANSFER] =
198         [this](MessageParcel &data, MessageParcel &reply) { return OnGetCallTransferInner(data, reply); };
199     requestFuncMap_[CellularCallInterfaceCode::CAN_SET_CALL_TRANSFER_TIME] =
200         [this](MessageParcel &data, MessageParcel &reply) { return OnCanSetCallTransferTimeInner(data, reply); };
201     requestFuncMap_[CellularCallInterfaceCode::SET_CALL_WAITING] =
202         [this](MessageParcel &data, MessageParcel &reply) { return OnSetCallWaitingInner(data, reply); };
203     requestFuncMap_[CellularCallInterfaceCode::GET_CALL_WAITING] =
204         [this](MessageParcel &data, MessageParcel &reply) { return OnGetCallWaitingInner(data, reply); };
205     requestFuncMap_[CellularCallInterfaceCode::SET_CALL_RESTRICTION] =
206         [this](MessageParcel &data, MessageParcel &reply) { return OnSetCallRestrictionInner(data, reply); };
207     requestFuncMap_[CellularCallInterfaceCode::GET_CALL_RESTRICTION] =
208         [this](MessageParcel &data, MessageParcel &reply) { return OnGetCallRestrictionInner(data, reply); };
209     requestFuncMap_[CellularCallInterfaceCode::SET_CALL_RESTRICTION_PWD] =
210         [this](MessageParcel &data, MessageParcel &reply) { return OnSetCallRestrictionPasswordInner(data, reply); };
211     requestFuncMap_[CellularCallInterfaceCode::REGISTER_CALLBACK] =
212         [this](MessageParcel &data, MessageParcel &reply) { return OnRegisterCallBackInner(data, reply); };
213     requestFuncMap_[CellularCallInterfaceCode::UNREGISTER_CALLBACK] =
214         [this](MessageParcel &data, MessageParcel &reply) { return OnUnRegisterCallBackInner(data, reply); };
215     requestFuncMap_[CellularCallInterfaceCode::CLOSE_UNFINISHED_USSD] =
216         [this](MessageParcel &data, MessageParcel &reply) { return OnCloseUnFinishedUssdInner(data, reply); };
217     requestFuncMap_[CellularCallInterfaceCode::GET_VIDEO_CALL_WAITING] =
218         [this](MessageParcel &data, MessageParcel &reply) { return OnGetVideoCallWaitingInner(data, reply); };
219     requestFuncMap_[CellularCallInterfaceCode::SEND_USSD_RESPONSE] =
220         [this](MessageParcel &data, MessageParcel &reply) { return OnSendUssdResponse(data, reply); };
221     requestFuncMap_[CellularCallInterfaceCode::IS_MMI_CODE] =
222         [this](MessageParcel &data, MessageParcel &reply) { return OnIsMmiCodeInner(data, reply); };
223 }
224 
OnDialInner(MessageParcel & data,MessageParcel & reply)225 int32_t CellularCallStub::OnDialInner(MessageParcel &data, MessageParcel &reply)
226 {
227     TELEPHONY_LOGI("CellularCallStub::OnDialInner entry");
228     int32_t size = data.ReadInt32();
229     size = ((size > MAX_SIZE) ? 0 : size);
230     if (size <= 0) {
231         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
232         return TELEPHONY_ERR_FAIL;
233     }
234     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
235     if (pCallInfo == nullptr) {
236         TELEPHONY_LOGE("OnDialInner return, pCallInfo is nullptr.");
237         return TELEPHONY_ERR_ARGUMENT_INVALID;
238     }
239 
240     reply.WriteInt32(Dial(*pCallInfo));
241     return TELEPHONY_SUCCESS;
242 }
243 
OnIsMmiCodeInner(MessageParcel & data,MessageParcel & reply)244 int32_t CellularCallStub::OnIsMmiCodeInner(MessageParcel &data, MessageParcel &reply)
245 {
246     TELEPHONY_LOGI("OnIsMmiCodeInner entry");
247     int32_t size = data.ReadInt32();
248     size = ((size > MAX_SIZE) ? 0 : size);
249     if (size <= 0) {
250         TELEPHONY_LOGE("data size error");
251         return TELEPHONY_ERR_FAIL;
252     }
253     int32_t slotId = data.ReadInt32();
254     std::string number = data.ReadString();
255     bool result = IsMmiCode(slotId, number);
256     if (!reply.WriteBool(result)) {
257         TELEPHONY_LOGE("write reply failed.");
258     }
259     return TELEPHONY_SUCCESS;
260 }
261 
OnHangUpInner(MessageParcel & data,MessageParcel & reply)262 int32_t CellularCallStub::OnHangUpInner(MessageParcel &data, MessageParcel &reply)
263 {
264     TELEPHONY_LOGI("CellularCallStub::OnHangUpInner entry");
265     int32_t size = data.ReadInt32();
266     size = ((size > MAX_SIZE) ? 0 : size);
267     if (size <= 0) {
268         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
269         return TELEPHONY_ERR_FAIL;
270     }
271     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
272     if (pCallInfo == nullptr) {
273         TELEPHONY_LOGE("OnHangUpInner return, pCallInfo is nullptr.");
274         return TELEPHONY_ERR_ARGUMENT_INVALID;
275     }
276     auto type = static_cast<CallSupplementType>(data.ReadInt32());
277 
278     reply.WriteInt32(HangUp(*pCallInfo, type));
279     return TELEPHONY_SUCCESS;
280 }
281 
OnRejectInner(MessageParcel & data,MessageParcel & reply)282 int32_t CellularCallStub::OnRejectInner(MessageParcel &data, MessageParcel &reply)
283 {
284     TELEPHONY_LOGI("CellularCallStub::OnRejectInner entry");
285     int32_t size = data.ReadInt32();
286     size = ((size > MAX_SIZE) ? 0 : size);
287     if (size <= 0) {
288         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
289         return TELEPHONY_ERR_FAIL;
290     }
291     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
292     if (pCallInfo == nullptr) {
293         TELEPHONY_LOGE("OnRejectInner return, pCallInfo is nullptr.");
294         return TELEPHONY_ERR_ARGUMENT_INVALID;
295     }
296 
297     reply.WriteInt32(Reject(*pCallInfo));
298     return TELEPHONY_SUCCESS;
299 }
300 
OnAnswerInner(MessageParcel & data,MessageParcel & reply)301 int32_t CellularCallStub::OnAnswerInner(MessageParcel &data, MessageParcel &reply)
302 {
303     TELEPHONY_LOGI("CellularCallStub::OnAnswerInner entry");
304     int32_t size = data.ReadInt32();
305     size = ((size > MAX_SIZE) ? 0 : size);
306     if (size <= 0) {
307         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
308         return TELEPHONY_ERR_FAIL;
309     }
310     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
311     if (pCallInfo == nullptr) {
312         TELEPHONY_LOGE("OnAnswerInner return, pCallInfo is nullptr.");
313         return TELEPHONY_ERR_ARGUMENT_INVALID;
314     }
315 
316     reply.WriteInt32(Answer(*pCallInfo));
317     return TELEPHONY_SUCCESS;
318 }
319 
OnIsEmergencyPhoneNumberInner(MessageParcel & data,MessageParcel & reply)320 int32_t CellularCallStub::OnIsEmergencyPhoneNumberInner(MessageParcel &data, MessageParcel &reply)
321 {
322     TELEPHONY_LOGD("CellularCallStub::OnIsEmergencyPhoneNumberInner entry.");
323     int32_t size = data.ReadInt32();
324     size = ((size > MAX_SIZE) ? 0 : size);
325     if (size <= 0) {
326         TELEPHONY_LOGE("CellularCallStub::OnIsEmergencyPhoneNumberInner data size error");
327         return TELEPHONY_ERR_FAIL;
328     }
329     int32_t slotId = data.ReadInt32();
330     std::string phoneNum = data.ReadString();
331     bool enabled = false;
332     int32_t ret = IsEmergencyPhoneNumber(slotId, phoneNum, enabled);
333     if (!reply.WriteInt32(ret)) {
334         TELEPHONY_LOGE("fail to write ret");
335         return TELEPHONY_ERR_WRITE_DATA_FAIL;
336     }
337     if (ret != TELEPHONY_SUCCESS) {
338         return ret;
339     }
340     if (!reply.WriteBool(enabled)) {
341         TELEPHONY_LOGE("fail to write enabled");
342         return TELEPHONY_ERR_WRITE_DATA_FAIL;
343     }
344     return TELEPHONY_SUCCESS;
345 }
346 
OnSetEmergencyCallList(MessageParcel & data,MessageParcel & reply)347 int32_t CellularCallStub::OnSetEmergencyCallList(MessageParcel &data, MessageParcel &reply)
348 {
349     TELEPHONY_LOGI("CellularCallStub::OnSetEmergencyCallList entry.");
350     int32_t size = data.ReadInt32();
351     size = ((size > MAX_SIZE) ? 0 : size);
352     if (size <= 0) {
353         TELEPHONY_LOGE("CellularCallStub::OnSetEmergencyCallList data size error");
354         return TELEPHONY_ERR_FAIL;
355     }
356     int32_t slotId = data.ReadInt32();
357     int32_t len = data.ReadInt32();
358     if (len <= 0 || len >= MAX_ECC_SIZE) {
359         TELEPHONY_LOGE("CellularCallStub::OnSetEmergencyCallList ecc size error");
360         return TELEPHONY_ERR_FAIL;
361     }
362     std::vector<EmergencyCall> eccVec;
363     for (int i = 0; i < len; i++) {
364         EmergencyCall emergencyCall;
365         emergencyCall.eccNum = data.ReadString();
366         emergencyCall.mcc = data.ReadString();
367         emergencyCall.eccType = static_cast<EccType>(data.ReadInt32());
368         emergencyCall.simpresent = static_cast<SimpresentType>(data.ReadInt32());
369         emergencyCall.abnormalService = static_cast<AbnormalServiceType>(data.ReadInt32());
370         eccVec.push_back(emergencyCall);
371     }
372     for (auto ecc : eccVec) {
373         TELEPHONY_LOGE("OnSetEmergencyCallList, data: eccNum %{public}s mcc %{public}s",
374             ecc.eccNum.c_str(), ecc.mcc.c_str());
375     }
376     reply.WriteInt32(SetEmergencyCallList(slotId, eccVec));
377     return TELEPHONY_SUCCESS;
378 }
379 
OnRegisterCallBackInner(MessageParcel & data,MessageParcel & reply)380 int32_t CellularCallStub::OnRegisterCallBackInner(MessageParcel &data, MessageParcel &reply)
381 {
382     TELEPHONY_LOGI("CellularCallStub::OnRegisterCallBackInner entry.");
383     int32_t size = data.ReadInt32();
384     size = ((size > MAX_SIZE) ? 0 : size);
385     if (size <= 0) {
386         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
387         return TELEPHONY_ERR_FAIL;
388     }
389 
390     int32_t result = TELEPHONY_ERR_LOCAL_PTR_NULL;
391     auto remote = data.ReadRemoteObject();
392     if (remote == nullptr) {
393         TELEPHONY_LOGE("CellularCallStub::OnRegisterCallBackInner return, remote is nullptr.");
394         reply.WriteInt32(result);
395         return result;
396     }
397     result = RegisterCallManagerCallBack(iface_cast<ICallStatusCallback>(remote));
398 
399     reply.WriteInt32(result);
400     return TELEPHONY_SUCCESS;
401 }
402 
OnUnRegisterCallBackInner(MessageParcel & data,MessageParcel & reply)403 int32_t CellularCallStub::OnUnRegisterCallBackInner(MessageParcel &data, MessageParcel &reply)
404 {
405     TELEPHONY_LOGI("CellularCallStub::OnUnRegisterCallBackInner entry.");
406     int32_t size = data.ReadInt32();
407     size = ((size > MAX_SIZE) ? 0 : size);
408     if (size <= 0) {
409         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
410         return TELEPHONY_ERR_FAIL;
411     }
412     int32_t result = UnRegisterCallManagerCallBack();
413 
414     reply.WriteInt32(result);
415     return result;
416 }
417 
OnHoldCallInner(MessageParcel & data,MessageParcel & reply)418 int32_t CellularCallStub::OnHoldCallInner(MessageParcel &data, MessageParcel &reply)
419 {
420     TELEPHONY_LOGI("CellularCallStub::OnHoldCallInner entry");
421     int32_t size = data.ReadInt32();
422     size = ((size > MAX_SIZE) ? 0 : size);
423     if (size <= 0) {
424         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
425         return TELEPHONY_ERR_FAIL;
426     }
427     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
428     if (pCallInfo == nullptr) {
429         TELEPHONY_LOGE("OnHoldCallInner return, pCallInfo is nullptr.");
430         return TELEPHONY_ERR_ARGUMENT_INVALID;
431     }
432 
433     reply.WriteInt32(HoldCall(*pCallInfo));
434     return TELEPHONY_SUCCESS;
435 }
436 
OnUnHoldCallInner(MessageParcel & data,MessageParcel & reply)437 int32_t CellularCallStub::OnUnHoldCallInner(MessageParcel &data, MessageParcel &reply)
438 {
439     TELEPHONY_LOGI("CellularCallStub::OnUnHoldCallInner entry");
440     int32_t size = data.ReadInt32();
441     size = ((size > MAX_SIZE) ? 0 : size);
442     if (size <= 0) {
443         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
444         return TELEPHONY_ERR_FAIL;
445     }
446     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
447     if (pCallInfo == nullptr) {
448         TELEPHONY_LOGE("OnUnHoldCallInner return, pCallInfo is nullptr.");
449         return TELEPHONY_ERR_ARGUMENT_INVALID;
450     }
451 
452     reply.WriteInt32(UnHoldCall(*pCallInfo));
453     return TELEPHONY_SUCCESS;
454 }
455 
OnSwitchCallInner(MessageParcel & data,MessageParcel & reply)456 int32_t CellularCallStub::OnSwitchCallInner(MessageParcel &data, MessageParcel &reply)
457 {
458     TELEPHONY_LOGI("CellularCallStub::OnSwitchCallInner entry");
459     int32_t size = data.ReadInt32();
460     size = ((size > MAX_SIZE) ? 0 : size);
461     if (size <= 0) {
462         TELEPHONY_LOGE("CellularCallStub::OnRemoteRequest data size error");
463         return TELEPHONY_ERR_FAIL;
464     }
465     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
466     if (pCallInfo == nullptr) {
467         TELEPHONY_LOGE("OnSwitchCallInner return, pCallInfo is nullptr.");
468         return TELEPHONY_ERR_ARGUMENT_INVALID;
469     }
470 
471     reply.WriteInt32(SwitchCall(*pCallInfo));
472     return TELEPHONY_SUCCESS;
473 }
474 
OnCombineConferenceInner(MessageParcel & data,MessageParcel & reply)475 int32_t CellularCallStub::OnCombineConferenceInner(MessageParcel &data, MessageParcel &reply)
476 {
477     TELEPHONY_LOGI("CellularCallStub::OnCombineConferenceInner entry");
478     int32_t size = data.ReadInt32();
479     size = ((size > MAX_SIZE) ? 0 : size);
480     if (size <= 0) {
481         TELEPHONY_LOGE("CellularCallStub::OnCombineConferenceInner data size error");
482         return TELEPHONY_ERR_FAIL;
483     }
484     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
485     if (pCallInfo == nullptr) {
486         TELEPHONY_LOGE("OnCombineConferenceInner return, pCallInfo is nullptr.");
487         return TELEPHONY_ERR_ARGUMENT_INVALID;
488     }
489 
490     reply.WriteInt32(CombineConference(*pCallInfo));
491     return TELEPHONY_SUCCESS;
492 }
493 
OnSeparateConferenceInner(MessageParcel & data,MessageParcel & reply)494 int32_t CellularCallStub::OnSeparateConferenceInner(MessageParcel &data, MessageParcel &reply)
495 {
496     TELEPHONY_LOGI("CellularCallStub::OnSeparateConferenceInner entry");
497     int32_t size = data.ReadInt32();
498     size = ((size > MAX_SIZE) ? 0 : size);
499     if (size <= 0) {
500         TELEPHONY_LOGE("CellularCallStub::OnSeparateConferenceInner data size error");
501         return TELEPHONY_ERR_FAIL;
502     }
503 
504     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
505     if (pCallInfo == nullptr) {
506         TELEPHONY_LOGE("OnSeparateConferenceInner return, pCallInfo is nullptr.");
507         return TELEPHONY_ERR_ARGUMENT_INVALID;
508     }
509 
510     reply.WriteInt32(SeparateConference(*pCallInfo));
511     return TELEPHONY_SUCCESS;
512 }
513 
OnInviteToConferenceInner(MessageParcel & data,MessageParcel & reply)514 int32_t CellularCallStub::OnInviteToConferenceInner(MessageParcel &data, MessageParcel &reply)
515 {
516     TELEPHONY_LOGI("CellularCallStub::OnInviteToConferenceInner entry");
517     int32_t size = data.ReadInt32();
518     size = ((size > MAX_SIZE) ? 0 : size);
519     if (size <= 0) {
520         TELEPHONY_LOGE("CellularCallStub::OnInviteToConferenceInner data size error");
521         return TELEPHONY_ERR_FAIL;
522     }
523 
524     int32_t slotId = data.ReadInt32();
525     std::vector<std::string> numberList;
526     bool bRead = data.ReadStringVector(&numberList);
527     if (!bRead) {
528         TELEPHONY_LOGE("InviteToConferenceInner return, read fail.");
529         return TELEPHONY_ERR_ARGUMENT_INVALID;
530     }
531     reply.WriteInt32(InviteToConference(slotId, numberList));
532     return TELEPHONY_SUCCESS;
533 }
534 
OnKickOutFromConferenceInner(MessageParcel & data,MessageParcel & reply)535 int32_t CellularCallStub::OnKickOutFromConferenceInner(MessageParcel &data, MessageParcel &reply)
536 {
537     TELEPHONY_LOGI("CellularCallStub::OnKickOutFromConferenceInner entry");
538     int32_t size = data.ReadInt32();
539     size = ((size > MAX_SIZE) ? 0 : size);
540     if (size <= 0) {
541         TELEPHONY_LOGE("CellularCallStub::OnKickOutFromConferenceInner data size error");
542         return TELEPHONY_ERR_FAIL;
543     }
544 
545     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
546     if (pCallInfo == nullptr) {
547         TELEPHONY_LOGE("OnKickOutFromConferenceInner return, pCallInfo is nullptr.");
548         return TELEPHONY_ERR_ARGUMENT_INVALID;
549     }
550     reply.WriteInt32(KickOutFromConference(*pCallInfo));
551     return TELEPHONY_SUCCESS;
552 }
553 
OnHangUpAllConnectionInner(MessageParcel & data,MessageParcel & reply)554 int32_t CellularCallStub::OnHangUpAllConnectionInner(MessageParcel &data, MessageParcel &reply)
555 {
556     TELEPHONY_LOGI("CellularCallStub::OnHangUpAllConnectionInner entry");
557     int32_t size = data.ReadInt32();
558     size = ((size > MAX_SIZE) ? 0 : size);
559     if (size <= 0) {
560         TELEPHONY_LOGE("OnHangUpAllConnectionInner data size error");
561         return TELEPHONY_ERR_FAIL;
562     }
563 
564     reply.WriteInt32(HangUpAllConnection());
565     return TELEPHONY_SUCCESS;
566 }
567 
OnSetReadyToCallInner(MessageParcel & data,MessageParcel & reply)568 int32_t CellularCallStub::OnSetReadyToCallInner(MessageParcel &data, MessageParcel &reply)
569 {
570     int32_t slotId = data.ReadInt32();
571     int32_t callType = data.ReadInt32();
572     bool isReadyToCall = data.ReadBool();
573     int32_t error = SetReadyToCall(slotId, callType, isReadyToCall);
574     if (!reply.WriteInt32(error)) {
575         TELEPHONY_LOGE("OnSetReadyToCallInner WriteInt32 fail");
576         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
577     }
578     return TELEPHONY_SUCCESS;
579 }
580 
OnSendUpdateCallMediaModeRequestInner(MessageParcel & data,MessageParcel & reply)581 int32_t CellularCallStub::OnSendUpdateCallMediaModeRequestInner(MessageParcel &data, MessageParcel &reply)
582 {
583     TELEPHONY_LOGI("CellularCallStub::OnSendUpdateCallMediaModeRequestInner entry");
584     int32_t size = data.ReadInt32();
585     size = ((size > MAX_SIZE) ? 0 : size);
586     if (size <= 0) {
587         TELEPHONY_LOGE("OnSendUpdateCallMediaModeRequestInner data size error");
588         return TELEPHONY_ERR_FAIL;
589     }
590     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
591     if (pCallInfo == nullptr) {
592         TELEPHONY_LOGE("OnSendUpdateCallMediaModeRequestInner return, pCallInfo is nullptr.");
593         return TELEPHONY_ERR_ARGUMENT_INVALID;
594     }
595     auto mode = static_cast<ImsCallMode>(data.ReadInt32());
596 
597     reply.WriteInt32(SendUpdateCallMediaModeRequest(*pCallInfo, mode));
598     return TELEPHONY_SUCCESS;
599 }
600 
OnSendUpdateCallMediaModeResponseInner(MessageParcel & data,MessageParcel & reply)601 int32_t CellularCallStub::OnSendUpdateCallMediaModeResponseInner(MessageParcel &data, MessageParcel &reply)
602 {
603     TELEPHONY_LOGI("CellularCallStub::OnSendUpdateCallMediaModeResponseInner entry");
604     int32_t size = data.ReadInt32();
605     size = ((size > MAX_SIZE) ? 0 : size);
606     if (size <= 0) {
607         TELEPHONY_LOGE("OnSendUpdateCallMediaModeResponseInner data size error");
608         return TELEPHONY_ERR_FAIL;
609     }
610     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
611     if (pCallInfo == nullptr) {
612         TELEPHONY_LOGE("OnSendUpdateCallMediaModeResponseInner return, pCallInfo is nullptr.");
613         return TELEPHONY_ERR_ARGUMENT_INVALID;
614     }
615     auto mode = static_cast<ImsCallMode>(data.ReadInt32());
616 
617     reply.WriteInt32(SendUpdateCallMediaModeResponse(*pCallInfo, mode));
618     return TELEPHONY_SUCCESS;
619 }
620 
OnCancelCallUpgradeInner(MessageParcel & data,MessageParcel & reply)621 int32_t CellularCallStub::OnCancelCallUpgradeInner(MessageParcel &data, MessageParcel &reply)
622 {
623     TELEPHONY_LOGI("CellularCallStub::OnCancelCallUpgradeInner entry");
624     int32_t size = data.ReadInt32();
625     size = ((size > MAX_SIZE) ? 0 : size);
626     if (size <= 0) {
627         TELEPHONY_LOGE("OnCancelCallUpgradeInner data size error");
628         return TELEPHONY_ERR_FAIL;
629     }
630     int32_t slotId = data.ReadInt32();
631     int32_t callIndex = data.ReadInt32();
632     reply.WriteInt32(CancelCallUpgrade(slotId, callIndex));
633     return TELEPHONY_SUCCESS;
634 }
635 
OnRequestCameraCapabilitiesInner(MessageParcel & data,MessageParcel & reply)636 int32_t CellularCallStub::OnRequestCameraCapabilitiesInner(MessageParcel &data, MessageParcel &reply)
637 {
638     TELEPHONY_LOGI("CellularCallStub::OnRequestCameraCapabilitiesInner entry");
639     int32_t size = data.ReadInt32();
640     size = ((size > MAX_SIZE) ? 0 : size);
641     if (size <= 0) {
642         TELEPHONY_LOGE("OnRequestCameraCapabilitiesInner data size error");
643         return TELEPHONY_ERR_FAIL;
644     }
645     int32_t slotId = data.ReadInt32();
646     int32_t callIndex = data.ReadInt32();
647     reply.WriteInt32(RequestCameraCapabilities(slotId, callIndex));
648     return TELEPHONY_SUCCESS;
649 }
650 
OnStartDtmfInner(MessageParcel & data,MessageParcel & reply)651 int32_t CellularCallStub::OnStartDtmfInner(MessageParcel &data, MessageParcel &reply)
652 {
653     TELEPHONY_LOGI("CellularCallStub::OnStartDtmfInner entry");
654     int32_t size = data.ReadInt32();
655     size = ((size > MAX_SIZE) ? 0 : size);
656     if (size <= 0) {
657         TELEPHONY_LOGE("CellularCallStub::OnStartDtmfInner data size error");
658         return TELEPHONY_ERR_FAIL;
659     }
660 
661     char pDtmf = data.ReadInt8();
662     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
663     if (pCallInfo == nullptr) {
664         TELEPHONY_LOGE("OnStartDtmfInner return, pCallInfo is nullptr.");
665         return TELEPHONY_ERR_ARGUMENT_INVALID;
666     }
667 
668     reply.WriteInt32(StartDtmf(pDtmf, *pCallInfo));
669     return TELEPHONY_SUCCESS;
670 }
671 
OnStopDtmfInner(MessageParcel & data,MessageParcel & reply)672 int32_t CellularCallStub::OnStopDtmfInner(MessageParcel &data, MessageParcel &reply)
673 {
674     TELEPHONY_LOGI("CellularCallStub::OnStopDtmfInner entry");
675     int32_t size = data.ReadInt32();
676     size = ((size > MAX_SIZE) ? 0 : size);
677     if (size <= 0) {
678         TELEPHONY_LOGE("CellularCallStub::OnStopDtmfInner data size error");
679         return TELEPHONY_ERR_FAIL;
680     }
681 
682     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
683     if (pCallInfo == nullptr) {
684         TELEPHONY_LOGE("OnStopDtmfInner return, pCallInfo is nullptr.");
685         return TELEPHONY_ERR_ARGUMENT_INVALID;
686     }
687 
688     reply.WriteInt32(StopDtmf(*pCallInfo));
689     return TELEPHONY_SUCCESS;
690 }
691 
OnPostDialProceedInner(MessageParcel & data,MessageParcel & reply)692 int32_t CellularCallStub::OnPostDialProceedInner(MessageParcel &data, MessageParcel &reply)
693 {
694     TELEPHONY_LOGI("CellularCallStub::OnPostDialProceedInner entry");
695     int32_t size = data.ReadInt32();
696     size = ((size > MAX_SIZE) ? 0 : size);
697     if (size <= 0) {
698         TELEPHONY_LOGE("CellularCallStub::OnPostDialProceedInner data size error");
699         return TELEPHONY_ERR_FAIL;
700     }
701 
702     auto info = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
703     if (info == nullptr) {
704         TELEPHONY_LOGE("OnStopDtmfInner return, info is nullptr.");
705         return TELEPHONY_ERR_ARGUMENT_INVALID;
706     }
707     bool proceed = data.ReadBool();
708 
709     reply.WriteInt32(PostDialProceed(*info, proceed));
710     return TELEPHONY_SUCCESS;
711 }
712 
OnSendDtmfInner(MessageParcel & data,MessageParcel & reply)713 int32_t CellularCallStub::OnSendDtmfInner(MessageParcel &data, MessageParcel &reply)
714 {
715     TELEPHONY_LOGI("CellularCallStub::OnSendDtmfInner entry");
716     int32_t size = data.ReadInt32();
717     size = ((size > MAX_SIZE) ? 0 : size);
718     if (size <= 0) {
719         TELEPHONY_LOGE("CellularCallStub::OnSendDtmfInner data size error");
720         return TELEPHONY_ERR_FAIL;
721     }
722 
723     char pDtmf = data.ReadInt8();
724     auto pCallInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
725     if (pCallInfo == nullptr) {
726         TELEPHONY_LOGE("OnSendDtmfInner return, pCallInfo is nullptr.");
727         return TELEPHONY_ERR_ARGUMENT_INVALID;
728     }
729 
730     reply.WriteInt32(SendDtmf(pDtmf, *pCallInfo));
731     return TELEPHONY_SUCCESS;
732 }
733 
OnStartRttInner(MessageParcel & data,MessageParcel & reply)734 int32_t CellularCallStub::OnStartRttInner(MessageParcel &data, MessageParcel &reply)
735 {
736     TELEPHONY_LOGI("CellularCallStub::OnStartRttInner entry");
737     int32_t size = data.ReadInt32();
738     size = ((size > MAX_SIZE) ? 0 : size);
739     if (size <= 0) {
740         TELEPHONY_LOGE("CellularCallStub::OnStartRttInner data size error");
741         return TELEPHONY_ERR_FAIL;
742     }
743     int32_t slotId = data.ReadInt32();
744     std::string msg = data.ReadString();
745 
746     reply.WriteInt32(StartRtt(slotId, msg));
747     return TELEPHONY_SUCCESS;
748 }
749 
OnStopRttInner(MessageParcel & data,MessageParcel & reply)750 int32_t CellularCallStub::OnStopRttInner(MessageParcel &data, MessageParcel &reply)
751 {
752     TELEPHONY_LOGI("CellularCallStub::OnStopRttInner entry");
753     int32_t size = data.ReadInt32();
754     size = ((size > MAX_SIZE) ? 0 : size);
755     if (size <= 0) {
756         TELEPHONY_LOGE("CellularCallStub::OnStopRttInner data size error");
757         return TELEPHONY_ERR_FAIL;
758     }
759     int32_t slotId = data.ReadInt32();
760 
761     reply.WriteInt32(StopRtt(slotId));
762     return TELEPHONY_SUCCESS;
763 }
764 
OnSetCallTransferInner(MessageParcel & data,MessageParcel & reply)765 int32_t CellularCallStub::OnSetCallTransferInner(MessageParcel &data, MessageParcel &reply)
766 {
767     TELEPHONY_LOGI("CellularCallStub::OnSetCallTransferInner entry");
768     int32_t size = data.ReadInt32();
769     size = ((size > MAX_SIZE) ? 0 : size);
770     if (size <= 0) {
771         TELEPHONY_LOGE("CellularCallStub::OnSetCallTransferInner data size error");
772         return TELEPHONY_ERR_FAIL;
773     }
774     int32_t slotId = data.ReadInt32();
775     auto pCTInfo = (CallTransferInfo *)data.ReadRawData(sizeof(CallTransferInfo));
776     if (pCTInfo == nullptr) {
777         TELEPHONY_LOGE("OnSetCallTransferInner return, pCTInfo is nullptr.");
778         return TELEPHONY_ERR_ARGUMENT_INVALID;
779     }
780 
781     reply.WriteInt32(SetCallTransferInfo(slotId, *pCTInfo));
782     return TELEPHONY_SUCCESS;
783 }
784 
OnCanSetCallTransferTimeInner(MessageParcel & data,MessageParcel & reply)785 int32_t CellularCallStub::OnCanSetCallTransferTimeInner(MessageParcel &data, MessageParcel &reply)
786 {
787     TELEPHONY_LOGI("entry");
788     int32_t size = data.ReadInt32();
789     size = ((size > MAX_SIZE) ? 0 : size);
790     if (size <= 0) {
791         TELEPHONY_LOGE("data size error");
792         return TELEPHONY_ERR_FAIL;
793     }
794     int32_t slotId = data.ReadInt32();
795     bool result = data.ReadBool();
796 
797     int32_t callResult = CanSetCallTransferTime(slotId, result);
798     reply.WriteBool(result);
799     reply.WriteInt32(callResult);
800     return TELEPHONY_SUCCESS;
801 }
802 
OnGetCallTransferInner(MessageParcel & data,MessageParcel & reply)803 int32_t CellularCallStub::OnGetCallTransferInner(MessageParcel &data, MessageParcel &reply)
804 {
805     TELEPHONY_LOGI("CellularCallStub::OnGetCallTransferInner entry");
806     int32_t size = data.ReadInt32();
807     size = ((size > MAX_SIZE) ? 0 : size);
808     if (size <= 0) {
809         TELEPHONY_LOGE("CellularCallStub::OnGetCallTransferInner data size error");
810         return TELEPHONY_ERR_FAIL;
811     }
812     int32_t slotId = data.ReadInt32();
813     auto type = static_cast<CallTransferType>(data.ReadInt32());
814 
815     reply.WriteInt32(GetCallTransferInfo(slotId, type));
816     return TELEPHONY_SUCCESS;
817 }
818 
OnSetCallWaitingInner(MessageParcel & data,MessageParcel & reply)819 int32_t CellularCallStub::OnSetCallWaitingInner(MessageParcel &data, MessageParcel &reply)
820 {
821     TELEPHONY_LOGI("CellularCallStub::OnSetCallWaitingInner entry");
822     int32_t size = data.ReadInt32();
823     size = ((size > MAX_SIZE) ? 0 : size);
824     if (size <= 0) {
825         TELEPHONY_LOGE("CellularCallStub::OnSetCallWaitingInner data size error");
826         return TELEPHONY_ERR_FAIL;
827     }
828     int32_t slotId = data.ReadInt32();
829     bool enable = data.ReadBool();
830 
831     reply.WriteInt32(SetCallWaiting(slotId, enable));
832     return TELEPHONY_SUCCESS;
833 }
834 
OnGetCallWaitingInner(MessageParcel & data,MessageParcel & reply)835 int32_t CellularCallStub::OnGetCallWaitingInner(MessageParcel &data, MessageParcel &reply)
836 {
837     TELEPHONY_LOGI("CellularCallStub::OnGetCallWaitingInner entry");
838     int32_t size = data.ReadInt32();
839     size = ((size > MAX_SIZE) ? 0 : size);
840     if (size <= 0) {
841         TELEPHONY_LOGE("CellularCallStub::OnGetCallWaitingInner data size error");
842         return TELEPHONY_ERR_FAIL;
843     }
844     int32_t slotId = data.ReadInt32();
845     TELEPHONY_LOGI("CellularCallStub::OnGetCallWaitingInner data.ReadInt32()");
846     reply.WriteInt32(GetCallWaiting(slotId));
847     return TELEPHONY_SUCCESS;
848 }
849 
OnGetVideoCallWaitingInner(MessageParcel & data,MessageParcel & reply)850 int32_t CellularCallStub::OnGetVideoCallWaitingInner(MessageParcel &data, MessageParcel &reply)
851 {
852     TELEPHONY_LOGI("CellularCallStub::OnGetVideoCallWaitingInner entry");
853     int32_t size = data.ReadInt32();
854     size = ((size > MAX_SIZE) ? 0 : size);
855     if (size <= 0) {
856         TELEPHONY_LOGE("CellularCallStub::OnGetVideoCallWaitingInner data size error");
857         return TELEPHONY_ERR_FAIL;
858     }
859     int32_t slotId = data.ReadInt32();
860     TELEPHONY_LOGI("CellularCallStub::OnGetVideoCallWaitingInner data.ReadInt32()");
861     bool enable = false;
862     int32_t result = GetVideoCallWaiting(slotId, enable);
863     reply.WriteBool(enable);
864     reply.WriteInt32(result);
865     return TELEPHONY_SUCCESS;
866 }
867 
OnSetCallRestrictionInner(MessageParcel & data,MessageParcel & reply)868 int32_t CellularCallStub::OnSetCallRestrictionInner(MessageParcel &data, MessageParcel &reply)
869 {
870     TELEPHONY_LOGI("CellularCallStub::OnSetCallRestrictionInner entry");
871     int32_t size = data.ReadInt32();
872     size = ((size > MAX_SIZE) ? 0 : size);
873     if (size <= 0) {
874         TELEPHONY_LOGE("CellularCallStub::OnSetCallRestrictionInner data size error");
875         return TELEPHONY_ERR_FAIL;
876     }
877     int32_t slotId = data.ReadInt32();
878     auto pCRInfo = (CallRestrictionInfo *)data.ReadRawData(sizeof(CallRestrictionInfo));
879     if (pCRInfo == nullptr) {
880         TELEPHONY_LOGE("OnSetCallRestrictionInner return, pCRInfo is nullptr.");
881         return TELEPHONY_ERR_ARGUMENT_INVALID;
882     }
883 
884     reply.WriteInt32(SetCallRestriction(slotId, *pCRInfo));
885     return TELEPHONY_SUCCESS;
886 }
887 
OnGetCallRestrictionInner(MessageParcel & data,MessageParcel & reply)888 int32_t CellularCallStub::OnGetCallRestrictionInner(MessageParcel &data, MessageParcel &reply)
889 {
890     TELEPHONY_LOGI("CellularCallStub::OnGetCallRestrictionInner entry");
891     int32_t size = data.ReadInt32();
892     size = ((size > MAX_SIZE) ? 0 : size);
893     if (size <= 0) {
894         TELEPHONY_LOGE("CellularCallStub::OnGetCallRestrictionInner data size error");
895         return TELEPHONY_ERR_FAIL;
896     }
897     int32_t slotId = data.ReadInt32();
898     auto facType = static_cast<CallRestrictionType>(data.ReadInt32());
899 
900     reply.WriteInt32(GetCallRestriction(slotId, facType));
901     return TELEPHONY_SUCCESS;
902 }
903 
OnSetCallRestrictionPasswordInner(MessageParcel & data,MessageParcel & reply)904 int32_t CellularCallStub::OnSetCallRestrictionPasswordInner(MessageParcel &data, MessageParcel &reply)
905 {
906     int32_t size = data.ReadInt32();
907     size = ((size > MAX_SIZE) ? 0 : size);
908     if (size <= 0) {
909         TELEPHONY_LOGE("data size error");
910         return TELEPHONY_ERR_FAIL;
911     }
912     int32_t slotId = data.ReadInt32();
913     auto facType = static_cast<CallRestrictionType>(data.ReadInt32());
914     auto oldPassword = data.ReadCString();
915     auto newPassword = data.ReadCString();
916 
917     reply.WriteInt32(SetCallRestrictionPassword(slotId, facType, oldPassword, newPassword));
918     return TELEPHONY_SUCCESS;
919 }
920 
OnSetDomainPreferenceModeInner(MessageParcel & data,MessageParcel & reply)921 int32_t CellularCallStub::OnSetDomainPreferenceModeInner(MessageParcel &data, MessageParcel &reply)
922 {
923     TELEPHONY_LOGI("CellularCallStub::OnSetDomainPreferenceModeInner entry");
924     int32_t size = data.ReadInt32();
925     size = ((size > MAX_SIZE) ? 0 : size);
926     if (size <= 0) {
927         TELEPHONY_LOGE("CellularCallStub::OnSetDomainPreferenceModeInner data size error");
928         return TELEPHONY_ERR_FAIL;
929     }
930     int32_t slotId = data.ReadInt32();
931     int32_t mode = data.ReadInt32();
932 
933     reply.WriteInt32(SetDomainPreferenceMode(slotId, mode));
934     return TELEPHONY_SUCCESS;
935 }
936 
OnGetDomainPreferenceModeInner(MessageParcel & data,MessageParcel & reply)937 int32_t CellularCallStub::OnGetDomainPreferenceModeInner(MessageParcel &data, MessageParcel &reply)
938 {
939     TELEPHONY_LOGI("CellularCallStub::OnGetDomainPreferenceModeInner entry");
940     int32_t size = data.ReadInt32();
941     size = ((size > MAX_SIZE) ? 0 : size);
942     if (size <= 0) {
943         TELEPHONY_LOGE("CellularCallStub::OnGetDomainPreferenceModeInner data size error");
944         return TELEPHONY_ERR_FAIL;
945     }
946     int32_t slotId = data.ReadInt32();
947 
948     reply.WriteInt32(GetDomainPreferenceMode(slotId));
949     return TELEPHONY_SUCCESS;
950 }
951 
OnSetImsSwitchStatusInner(MessageParcel & data,MessageParcel & reply)952 int32_t CellularCallStub::OnSetImsSwitchStatusInner(MessageParcel &data, MessageParcel &reply)
953 {
954     TELEPHONY_LOGI("CellularCallStub::OnSetImsSwitchStatusInner entry");
955     int32_t size = data.ReadInt32();
956     size = ((size > MAX_SIZE) ? 0 : size);
957     if (size <= 0) {
958         TELEPHONY_LOGE("CellularCallStub::OnSetImsSwitchStatusInner data size error");
959         return TELEPHONY_ERR_FAIL;
960     }
961     int32_t slotId = data.ReadInt32();
962     bool active = data.ReadBool();
963 
964     reply.WriteInt32(SetImsSwitchStatus(slotId, active));
965     return TELEPHONY_SUCCESS;
966 }
967 
OnGetImsSwitchStatusInner(MessageParcel & data,MessageParcel & reply)968 int32_t CellularCallStub::OnGetImsSwitchStatusInner(MessageParcel &data, MessageParcel &reply)
969 {
970     TELEPHONY_LOGD("CellularCallStub::OnGetImsSwitchStatusInner entry");
971     int32_t size = data.ReadInt32();
972     size = ((size > MAX_SIZE) ? 0 : size);
973     if (size <= 0) {
974         TELEPHONY_LOGE("CellularCallStub::OnGetImsSwitchStatusInner data size error");
975         return TELEPHONY_ERR_FAIL;
976     }
977     int32_t slotId = data.ReadInt32();
978     bool enabled;
979     int32_t result = GetImsSwitchStatus(slotId, enabled);
980     reply.WriteBool(enabled);
981     reply.WriteInt32(result);
982     return TELEPHONY_SUCCESS;
983 }
984 
OnGetCarrierVtConfigInner(MessageParcel & data,MessageParcel & reply)985 int32_t CellularCallStub::OnGetCarrierVtConfigInner(MessageParcel &data, MessageParcel &reply)
986 {
987     TELEPHONY_LOGD("CellularCallStub::OnGetCarrierVtConfigInner entry");
988     int32_t size = data.ReadInt32();
989     size = ((size > MAX_SIZE) ? 0 : size);
990     if (size <= 0) {
991         TELEPHONY_LOGE("CellularCallStub::OnGetCarrierVtConfigInner data size error");
992         return TELEPHONY_ERR_FAIL;
993     }
994     int32_t slotId = data.ReadInt32();
995     bool enabled;
996     int32_t result = GetCarrierVtConfig(slotId, enabled);
997     reply.WriteBool(enabled);
998     reply.WriteInt32(result);
999     return TELEPHONY_SUCCESS;
1000 }
1001 
OnSetVoNRStateInner(MessageParcel & data,MessageParcel & reply)1002 int32_t CellularCallStub::OnSetVoNRStateInner(MessageParcel &data, MessageParcel &reply)
1003 {
1004     TELEPHONY_LOGI("CellularCallStub::OnSetVoNRSwitchStatusInner entry");
1005     int32_t size = data.ReadInt32();
1006     size = ((size > MAX_SIZE) ? 0 : size);
1007     if (size <= 0) {
1008         TELEPHONY_LOGE("CellularCallStub::OnSetVoNRSwitchStatusInner data size error");
1009         return TELEPHONY_ERR_FAIL;
1010     }
1011     int32_t slotId = data.ReadInt32();
1012     int32_t state = data.ReadInt32();
1013     reply.WriteInt32(SetVoNRState(slotId, state));
1014     return TELEPHONY_SUCCESS;
1015 }
1016 
OnGetVoNRStateInner(MessageParcel & data,MessageParcel & reply)1017 int32_t CellularCallStub::OnGetVoNRStateInner(MessageParcel &data, MessageParcel &reply)
1018 {
1019     TELEPHONY_LOGI("CellularCallStub::OnGetVoNRSwitchStatusInner entry");
1020     int32_t size = data.ReadInt32();
1021     size = ((size > MAX_SIZE) ? 0 : size);
1022     if (size <= 0) {
1023         TELEPHONY_LOGE("CellularCallStub::OnGetVoNRSwitchStatusInner data size error");
1024         return TELEPHONY_ERR_FAIL;
1025     }
1026     int32_t slotId = data.ReadInt32();
1027     int32_t state;
1028     int32_t result = GetVoNRState(slotId, state);
1029     reply.WriteInt32(state);
1030     reply.WriteInt32(result);
1031     return TELEPHONY_SUCCESS;
1032 }
1033 
OnSetImsConfigStringInner(MessageParcel & data,MessageParcel & reply)1034 int32_t CellularCallStub::OnSetImsConfigStringInner(MessageParcel &data, MessageParcel &reply)
1035 {
1036     TELEPHONY_LOGI("CellularCallStub::OnSetImsConfigStringInner entry");
1037     int32_t size = data.ReadInt32();
1038     size = ((size > MAX_SIZE) ? 0 : size);
1039     if (size <= 0) {
1040         TELEPHONY_LOGE("CellularCallStub::OnSetImsConfigStringInner data size error");
1041         return TELEPHONY_ERR_FAIL;
1042     }
1043     int32_t slotId = data.ReadInt32();
1044     auto item = static_cast<ImsConfigItem>(data.ReadInt32());
1045     std::string value = data.ReadString();
1046 
1047     reply.WriteInt32(SetImsConfig(slotId, item, value));
1048     return TELEPHONY_SUCCESS;
1049 }
1050 
OnSetImsConfigIntInner(MessageParcel & data,MessageParcel & reply)1051 int32_t CellularCallStub::OnSetImsConfigIntInner(MessageParcel &data, MessageParcel &reply)
1052 {
1053     TELEPHONY_LOGI("CellularCallStub::OnSetImsConfigIntInner entry");
1054     int32_t size = data.ReadInt32();
1055     size = ((size > MAX_SIZE) ? 0 : size);
1056     if (size <= 0) {
1057         TELEPHONY_LOGE("CellularCallStub::OnSetImsConfigIntInner data size error");
1058         return TELEPHONY_ERR_FAIL;
1059     }
1060     int32_t slotId = data.ReadInt32();
1061     auto item = static_cast<ImsConfigItem>(data.ReadInt32());
1062     int32_t value = data.ReadInt32();
1063 
1064     reply.WriteInt32(SetImsConfig(slotId, item, value));
1065     return TELEPHONY_SUCCESS;
1066 }
1067 
OnGetImsConfigInner(MessageParcel & data,MessageParcel & reply)1068 int32_t CellularCallStub::OnGetImsConfigInner(MessageParcel &data, MessageParcel &reply)
1069 {
1070     TELEPHONY_LOGI("CellularCallStub::OnGetImsConfigInner entry");
1071     int32_t size = data.ReadInt32();
1072     size = ((size > MAX_SIZE) ? 0 : size);
1073     if (size <= 0) {
1074         TELEPHONY_LOGE("CellularCallStub::OnGetImsConfigInner data size error");
1075         return TELEPHONY_ERR_FAIL;
1076     }
1077     int32_t slotId = data.ReadInt32();
1078     auto item = static_cast<ImsConfigItem>(data.ReadInt32());
1079 
1080     reply.WriteInt32(GetImsConfig(slotId, item));
1081     return TELEPHONY_SUCCESS;
1082 }
1083 
OnSetImsFeatureValueInner(MessageParcel & data,MessageParcel & reply)1084 int32_t CellularCallStub::OnSetImsFeatureValueInner(MessageParcel &data, MessageParcel &reply)
1085 {
1086     TELEPHONY_LOGI("CellularCallStub::OnSetImsFeatureValueInner entry");
1087     int32_t size = data.ReadInt32();
1088     size = ((size > MAX_SIZE) ? 0 : size);
1089     if (size <= 0) {
1090         TELEPHONY_LOGE("CellularCallStub::OnSetImsFeatureValueInner data size error");
1091         return TELEPHONY_ERR_FAIL;
1092     }
1093     int32_t slotId = data.ReadInt32();
1094     auto type = static_cast<FeatureType>(data.ReadInt32());
1095     int32_t value = data.ReadInt32();
1096 
1097     reply.WriteInt32(SetImsFeatureValue(slotId, type, value));
1098     return TELEPHONY_SUCCESS;
1099 }
1100 
OnGetImsFeatureValueInner(MessageParcel & data,MessageParcel & reply)1101 int32_t CellularCallStub::OnGetImsFeatureValueInner(MessageParcel &data, MessageParcel &reply)
1102 {
1103     TELEPHONY_LOGI("CellularCallStub::OnGetImsFeatureValueInner entry");
1104     int32_t size = data.ReadInt32();
1105     size = ((size > MAX_SIZE) ? 0 : size);
1106     if (size <= 0) {
1107         TELEPHONY_LOGE("CellularCallStub::OnGetImsFeatureValueInner data size error");
1108         return TELEPHONY_ERR_FAIL;
1109     }
1110     int32_t slotId = data.ReadInt32();
1111     auto type = static_cast<FeatureType>(data.ReadInt32());
1112 
1113     reply.WriteInt32(GetImsFeatureValue(slotId, type));
1114     return TELEPHONY_SUCCESS;
1115 }
1116 
OnControlCameraInner(MessageParcel & data,MessageParcel & reply)1117 int32_t CellularCallStub::OnControlCameraInner(MessageParcel &data, MessageParcel &reply)
1118 {
1119     TELEPHONY_LOGI("CellularCallStub::OnControlCameraInner entry");
1120     int32_t size = data.ReadInt32();
1121     size = ((size > MAX_SIZE) ? 0 : size);
1122     if (size <= 0) {
1123         TELEPHONY_LOGE("CellularCallStub::OnControlCameraInner data size error");
1124         return TELEPHONY_ERR_FAIL;
1125     }
1126     int32_t slotId = data.ReadInt32();
1127     int32_t callIndex = data.ReadInt32();
1128     std::string cameraId = data.ReadString();
1129     reply.WriteInt32(ControlCamera(slotId, callIndex, cameraId));
1130     return TELEPHONY_SUCCESS;
1131 }
1132 
OnSetPreviewWindowInner(MessageParcel & data,MessageParcel & reply)1133 int32_t CellularCallStub::OnSetPreviewWindowInner(MessageParcel &data, MessageParcel &reply)
1134 {
1135     TELEPHONY_LOGI("CellularCallStub::OnSetPreviewWindowInner entry");
1136     int32_t size = data.ReadInt32();
1137     size = ((size > MAX_SIZE) ? 0 : size);
1138     if (size <= 0) {
1139         TELEPHONY_LOGE("CellularCallStub::OnSetPreviewWindowInner data size error");
1140         return TELEPHONY_ERR_FAIL;
1141     }
1142     int32_t slotId = data.ReadInt32();
1143     int32_t callIndex = data.ReadInt32();
1144     const std::string surfaceID = data.ReadString();
1145     sptr<Surface> surface = nullptr;
1146     sptr<IRemoteObject> object = data.ReadRemoteObject();
1147     if (object != nullptr) {
1148         sptr<IBufferProducer> producer = iface_cast<IBufferProducer>(object);
1149         surface = Surface::CreateSurfaceAsProducer(producer);
1150     }
1151     TELEPHONY_LOGI("surfaceId:%{public}s", surfaceID.c_str());
1152     reply.WriteInt32(SetPreviewWindow(slotId, callIndex, surfaceID, surface));
1153     return TELEPHONY_SUCCESS;
1154 }
1155 
OnSetDisplayWindowInner(MessageParcel & data,MessageParcel & reply)1156 int32_t CellularCallStub::OnSetDisplayWindowInner(MessageParcel &data, MessageParcel &reply)
1157 {
1158     TELEPHONY_LOGI("CellularCallStub::OnSetDisplayWindowInner entry");
1159     int32_t size = data.ReadInt32();
1160     size = ((size > MAX_SIZE) ? 0 : size);
1161     if (size <= 0) {
1162         TELEPHONY_LOGE("CellularCallStub::OnSetDisplayWindowInner data size error");
1163         return TELEPHONY_ERR_FAIL;
1164     }
1165     int32_t slotId = data.ReadInt32();
1166     int32_t callIndex = data.ReadInt32();
1167     const std::string surfaceID = data.ReadString();
1168     sptr<Surface> surface = nullptr;
1169     sptr<IRemoteObject> object = data.ReadRemoteObject();
1170     if (object != nullptr) {
1171         sptr<IBufferProducer> producer = iface_cast<IBufferProducer>(object);
1172         surface = Surface::CreateSurfaceAsProducer(producer);
1173     }
1174     TELEPHONY_LOGI("surfaceId:%{public}s", surfaceID.c_str());
1175     reply.WriteInt32(SetDisplayWindow(slotId, callIndex, surfaceID, surface));
1176     return TELEPHONY_SUCCESS;
1177 }
1178 
OnSetCameraZoomInner(MessageParcel & data,MessageParcel & reply)1179 int32_t CellularCallStub::OnSetCameraZoomInner(MessageParcel &data, MessageParcel &reply)
1180 {
1181     TELEPHONY_LOGI("CellularCallStub::OnSetCameraZoomInner entry");
1182     int32_t size = data.ReadInt32();
1183     size = ((size > MAX_SIZE) ? 0 : size);
1184     if (size <= 0) {
1185         TELEPHONY_LOGE("CellularCallStub::OnSetCameraZoomInner data size error");
1186         return TELEPHONY_ERR_FAIL;
1187     }
1188     float zoomRatio = data.ReadFloat();
1189 
1190     reply.WriteInt32(SetCameraZoom(zoomRatio));
1191     return TELEPHONY_SUCCESS;
1192 }
1193 
OnSetPausePictureInner(MessageParcel & data,MessageParcel & reply)1194 int32_t CellularCallStub::OnSetPausePictureInner(MessageParcel &data, MessageParcel &reply)
1195 {
1196     TELEPHONY_LOGI("CellularCallStub::OnSetPausePictureInner entry");
1197     int32_t size = data.ReadInt32();
1198     size = ((size > MAX_SIZE) ? 0 : size);
1199     if (size <= 0) {
1200         TELEPHONY_LOGE("CellularCallStub::OnSetPausePictureInner data size error");
1201         return TELEPHONY_ERR_FAIL;
1202     }
1203     int32_t slotId = data.ReadInt32();
1204     int32_t callIndex = data.ReadInt32();
1205     std::string imagePath = data.ReadString();
1206     reply.WriteInt32(SetPausePicture(slotId, callIndex, imagePath));
1207     return TELEPHONY_SUCCESS;
1208 }
1209 
OnSetDeviceDirectionInner(MessageParcel & data,MessageParcel & reply)1210 int32_t CellularCallStub::OnSetDeviceDirectionInner(MessageParcel &data, MessageParcel &reply)
1211 {
1212     TELEPHONY_LOGI("CellularCallStub::OnSetDeviceDirectionInner entry");
1213     int32_t size = data.ReadInt32();
1214     size = ((size > MAX_SIZE) ? 0 : size);
1215     if (size <= 0) {
1216         TELEPHONY_LOGE("CellularCallStub::OnSetDeviceDirectionInner data size error");
1217         return TELEPHONY_ERR_FAIL;
1218     }
1219     int32_t slotId = data.ReadInt32();
1220     int32_t callIndex = data.ReadInt32();
1221     int32_t rotation = data.ReadInt32();
1222     reply.WriteInt32(SetDeviceDirection(slotId, callIndex, rotation));
1223     return TELEPHONY_SUCCESS;
1224 }
1225 
OnSetMuteInner(MessageParcel & data,MessageParcel & reply)1226 int32_t CellularCallStub::OnSetMuteInner(MessageParcel &data, MessageParcel &reply)
1227 {
1228     TELEPHONY_LOGI("CellularCallStub::OnSetMuteInner entry");
1229     int32_t size = data.ReadInt32();
1230     size = ((size > MAX_SIZE) ? 0 : size);
1231     if (size <= 0) {
1232         TELEPHONY_LOGE("CellularCallStub::OnSetMuteInner data size error");
1233         return TELEPHONY_ERR_FAIL;
1234     }
1235     int32_t slotId = data.ReadInt32();
1236     int32_t mute = data.ReadInt32();
1237 
1238     reply.WriteInt32(SetMute(slotId, mute));
1239     return TELEPHONY_SUCCESS;
1240 }
1241 
OnGetMuteInner(MessageParcel & data,MessageParcel & reply)1242 int32_t CellularCallStub::OnGetMuteInner(MessageParcel &data, MessageParcel &reply)
1243 {
1244     TELEPHONY_LOGI("CellularCallStub::OnGetMuteInner entry");
1245     int32_t size = data.ReadInt32();
1246     size = ((size > MAX_SIZE) ? 0 : size);
1247     if (size <= 0) {
1248         TELEPHONY_LOGE("CellularCallStub::OnGetMuteInner data size error");
1249         return TELEPHONY_ERR_FAIL;
1250     }
1251     int32_t slotId = data.ReadInt32();
1252 
1253     reply.WriteInt32(GetMute(slotId));
1254     return TELEPHONY_SUCCESS;
1255 }
1256 
OnCloseUnFinishedUssdInner(MessageParcel & data,MessageParcel & reply)1257 int32_t CellularCallStub::OnCloseUnFinishedUssdInner(MessageParcel &data, MessageParcel &reply)
1258 {
1259     TELEPHONY_LOGI("CellularCallStub::OnCloseUnFinishedUssdInner entry");
1260     int32_t size = data.ReadInt32();
1261     size = ((size > MAX_SIZE) ? 0 : size);
1262     if (size <= 0) {
1263         TELEPHONY_LOGE("CellularCallStub::OnCloseUnFinishedUssdInner data size error");
1264         return TELEPHONY_ERR_FAIL;
1265     }
1266     int32_t slotId = data.ReadInt32();
1267 
1268     reply.WriteInt32(CloseUnFinishedUssd(slotId));
1269     return TELEPHONY_SUCCESS;
1270 }
1271 
OnClearAllCallsInner(MessageParcel & data,MessageParcel & reply)1272 int32_t CellularCallStub::OnClearAllCallsInner(MessageParcel &data, MessageParcel &reply)
1273 {
1274     TELEPHONY_LOGI("CellularCallStub::OnClearAllCallsInner entry");
1275     int32_t size = data.ReadInt32();
1276     if (size <= 0 || size > MAX_CALL_NUM) {
1277         TELEPHONY_LOGE("data size error");
1278         return TELEPHONY_ERR_ARGUMENT_INVALID;
1279     }
1280     std::vector<CellularCallInfo> callInfos;
1281     for (int32_t i = 0; i < size; i++) {
1282         CellularCallInfo *callInfo = (CellularCallInfo *)data.ReadRawData(sizeof(CellularCallInfo));
1283         if (callInfo != nullptr) {
1284             callInfos.push_back(*callInfo);
1285         }
1286     }
1287     reply.WriteInt32(ClearAllCalls(callInfos));
1288     return TELEPHONY_SUCCESS;
1289 }
1290 
OnSendUssdResponse(MessageParcel & data,MessageParcel & reply)1291 int32_t CellularCallStub::OnSendUssdResponse(MessageParcel &data, MessageParcel &reply)
1292 {
1293     TELEPHONY_LOGI("CellularCallStub::OnSendUssdResponse entry");
1294     int32_t size = data.ReadInt32();
1295     if (size <= 0 || size > MAX_CALL_NUM) {
1296         TELEPHONY_LOGE("data size error");
1297         return TELEPHONY_ERR_FAIL;
1298     }
1299     int32_t slotId = data.ReadInt32();
1300     std::string content = data.ReadString();
1301     bool enable = false;
1302     int32_t ret = SendUssdResponse(slotId, content);
1303     if (!reply.WriteInt32(ret)) {
1304         TELEPHONY_LOGE("fail to write ret");
1305         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1306     }
1307     if (ret != TELEPHONY_SUCCESS) {
1308         return ret;
1309     }
1310     if (!reply.WriteBool(enable)) {
1311         TELEPHONY_LOGE("fail to write enabled");
1312         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1313     }
1314     return TELEPHONY_SUCCESS;
1315 }
1316 } // namespace Telephony
1317 } // namespace OHOS
1318