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 "call_status_callback_stub.h"
17 
18 #include <securec.h>
19 
20 #include "call_manager_errors.h"
21 #include "telephony_log_wrapper.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 const int32_t MAX_LEN = 100000;
26 const int32_t MAX_CALL_NUM = 10;
CallStatusCallbackStub()27 CallStatusCallbackStub::CallStatusCallbackStub()
28 {
29     InitBasicFuncMap();
30     InitSupplementFuncMap();
31     InitImsFuncMap();
32 }
33 
~CallStatusCallbackStub()34 CallStatusCallbackStub::~CallStatusCallbackStub()
35 {
36     memberFuncMap_.clear();
37 }
38 
InitBasicFuncMap()39 void CallStatusCallbackStub::InitBasicFuncMap()
40 {
41     memberFuncMap_[static_cast<uint32_t>(UPDATE_CALL_INFO)] =
42         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallReportInfo(data, reply); };
43     memberFuncMap_[static_cast<uint32_t>(UPDATE_CALLS_INFO)] =
44         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallsReportInfo(data, reply); };
45     memberFuncMap_[static_cast<uint32_t>(UPDATE_DISCONNECTED_CAUSE)] =
46         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateDisconnectedCause(data, reply); };
47     memberFuncMap_[static_cast<uint32_t>(UPDATE_EVENT_RESULT_INFO)] =
48         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateEventReport(data, reply); };
49     memberFuncMap_[static_cast<uint32_t>(UPDATE_RBT_PLAY_INFO)] =
50         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateRBTPlayInfo(data, reply); };
51     memberFuncMap_[static_cast<uint32_t>(START_DTMF)] =
52         [this](MessageParcel &data, MessageParcel &reply) { return OnStartDtmfResult(data, reply); };
53     memberFuncMap_[static_cast<uint32_t>(STOP_DTMF)] =
54         [this](MessageParcel &data, MessageParcel &reply) { return OnStopDtmfResult(data, reply); };
55     memberFuncMap_[static_cast<uint32_t>(RECEIVE_UPDATE_MEDIA_MODE_RESPONSE)] =
56         [this](MessageParcel &data, MessageParcel &reply) { return OnReceiveImsCallModeResponse(data, reply); };
57     memberFuncMap_[static_cast<uint32_t>(RECEIVE_UPDATE_MEDIA_MODE_REQUEST)] =
58         [this](MessageParcel &data, MessageParcel &reply) { return OnReceiveImsCallModeRequest(data, reply); };
59     memberFuncMap_[static_cast<uint32_t>(UPDATE_STARTRTT_STATUS)] =
60         [this](MessageParcel &data, MessageParcel &reply) { return OnStartRttResult(data, reply); };
61     memberFuncMap_[static_cast<uint32_t>(UPDATE_STOPRTT_STATUS)] =
62         [this](MessageParcel &data, MessageParcel &reply) { return OnStopRttResult(data, reply); };
63     memberFuncMap_[static_cast<uint32_t>(INVITE_TO_CONFERENCE)] =
64         [this](MessageParcel &data, MessageParcel &reply) { return OnInviteToConferenceResult(data, reply); };
65     memberFuncMap_[static_cast<uint32_t>(MMI_CODE_INFO_RESPONSE)] =
66         [this](MessageParcel &data, MessageParcel &reply) { return OnSendMmiCodeResult(data, reply); };
67     memberFuncMap_[static_cast<uint32_t>(CLOSE_UNFINISHED_USSD)] =
68         [this](MessageParcel &data, MessageParcel &reply) { return OnCloseUnFinishedUssdResult(data, reply); };
69     memberFuncMap_[static_cast<uint32_t>(POST_DIAL_CHAR)] =
70         [this](MessageParcel &data, MessageParcel &reply) { return OnPostDialNextChar(data, reply); };
71     memberFuncMap_[static_cast<uint32_t>(POST_DIAL_DELAY)] =
72         [this](MessageParcel &data, MessageParcel &reply) { return OnReportPostDialDelay(data, reply); };
73     memberFuncMap_[static_cast<uint32_t>(CALL_SESSION_EVENT)] =
74         [this](MessageParcel &data, MessageParcel &reply) { return OnCallSessionEventChange(data, reply); };
75     memberFuncMap_[static_cast<uint32_t>(PEER_DIMENSION_CHANGE)] =
76         [this](MessageParcel &data, MessageParcel &reply) { return OnPeerDimensionsChange(data, reply); };
77     memberFuncMap_[static_cast<uint32_t>(CALL_DATA_USAGE)] =
78         [this](MessageParcel &data, MessageParcel &reply) { return OnCallDataUsageChange(data, reply); };
79 }
80 
InitSupplementFuncMap()81 void CallStatusCallbackStub::InitSupplementFuncMap()
82 {
83     memberFuncMap_[static_cast<uint32_t>(SEND_USSD)] =
84         [this](MessageParcel &data, MessageParcel &reply) { return OnSendUssdResult(data, reply); };
85     memberFuncMap_[static_cast<uint32_t>(UPDATE_GET_WAITING)] =
86         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateGetWaitingResult(data, reply); };
87     memberFuncMap_[static_cast<uint32_t>(UPDATE_SET_WAITING)] =
88         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateSetWaitingResult(data, reply); };
89     memberFuncMap_[static_cast<uint32_t>(UPDATE_GET_RESTRICTION)] =
90         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateGetRestrictionResult(data, reply); };
91     memberFuncMap_[static_cast<uint32_t>(UPDATE_SET_RESTRICTION)] =
92         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateSetRestrictionResult(data, reply); };
93     memberFuncMap_[static_cast<uint32_t>(UPDATE_SET_RESTRICTION_PWD)] =
94         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateSetRestrictionPasswordResult(data, reply); };
95     memberFuncMap_[static_cast<uint32_t>(UPDATE_GET_TRANSFER)] =
96         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateGetTransferResult(data, reply); };
97     memberFuncMap_[static_cast<uint32_t>(UPDATE_SET_TRANSFER)] =
98         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateSetTransferResult(data, reply); };
99     memberFuncMap_[static_cast<uint32_t>(UPDATE_GET_CALL_CLIP)] =
100         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateGetCallClipResult(data, reply); };
101     memberFuncMap_[static_cast<uint32_t>(UPDATE_GET_CALL_CLIR)] =
102         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateGetCallClirResult(data, reply); };
103     memberFuncMap_[static_cast<uint32_t>(UPDATE_SET_CALL_CLIR)] =
104         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateSetCallClirResult(data, reply); };
105 }
106 
InitImsFuncMap()107 void CallStatusCallbackStub::InitImsFuncMap()
108 {
109     memberFuncMap_[static_cast<uint32_t>(GET_IMS_CALL_DATA)] =
110         [this](MessageParcel &data, MessageParcel &reply) { return OnGetImsCallDataResult(data, reply); };
111     memberFuncMap_[static_cast<uint32_t>(GET_IMS_CONFIG)] =
112         [this](MessageParcel &data, MessageParcel &reply) { return OnGetImsConfigResult(data, reply); };
113     memberFuncMap_[static_cast<uint32_t>(SET_IMS_CONFIG)] =
114         [this](MessageParcel &data, MessageParcel &reply) { return OnSetImsConfigResult(data, reply); };
115     memberFuncMap_[static_cast<uint32_t>(GET_IMS_FEATURE_VALUE)] =
116         [this](MessageParcel &data, MessageParcel &reply) { return OnGetImsFeatureValueResult(data, reply); };
117     memberFuncMap_[static_cast<uint32_t>(SET_IMS_FEATURE_VALUE)] =
118         [this](MessageParcel &data, MessageParcel &reply) { return OnSetImsFeatureValueResult(data, reply); };
119     memberFuncMap_[static_cast<uint32_t>(CAMERA_CAPBILITIES_CHANGE)] =
120         [this](MessageParcel &data, MessageParcel &reply) { return OnCameraCapabilitiesChange(data, reply); };
121     memberFuncMap_[static_cast<uint32_t>(UPDATE_VOIP_EVENT_INFO)] =
122         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateVoipEventInfo(data, reply); };
123 }
124 
OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)125 int32_t CallStatusCallbackStub::OnRemoteRequest(
126     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
127 {
128     std::u16string myDescriptor = CallStatusCallbackStub::GetDescriptor();
129     std::u16string remoteDescriptor = data.ReadInterfaceToken();
130     if (myDescriptor != remoteDescriptor) {
131         TELEPHONY_LOGE("descriptor checked failed");
132         return TELEPHONY_ERR_DESCRIPTOR_MISMATCH;
133     }
134     TELEPHONY_LOGI("OnReceived, cmd = %{public}u", code);
135     auto itFunc = memberFuncMap_.find(code);
136     if (itFunc != memberFuncMap_.end()) {
137         auto memberFunc = itFunc->second;
138         if (memberFunc != nullptr) {
139             return memberFunc(data, reply);
140         }
141     }
142     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
143 }
144 
OnUpdateCallReportInfo(MessageParcel &data, MessageParcel &reply)145 int32_t CallStatusCallbackStub::OnUpdateCallReportInfo(MessageParcel &data, MessageParcel &reply)
146 {
147     int32_t result = TELEPHONY_ERR_FAIL;
148     CallReportInfo parcelPtr;
149     if (!data.ContainFileDescriptors()) {
150         TELEPHONY_LOGW("sent raw data is less than 32k");
151     }
152     BuildCallReportInfo(data, parcelPtr);
153     result = UpdateCallReportInfo(parcelPtr);
154     if (!reply.WriteInt32(result)) {
155         TELEPHONY_LOGE("writing parcel failed");
156         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
157     }
158     return TELEPHONY_SUCCESS;
159 }
160 
OnUpdateCallsReportInfo(MessageParcel &data, MessageParcel &reply)161 int32_t CallStatusCallbackStub::OnUpdateCallsReportInfo(MessageParcel &data, MessageParcel &reply)
162 {
163     int32_t result = TELEPHONY_ERR_FAIL;
164     if (!data.ContainFileDescriptors()) {
165         TELEPHONY_LOGW("sent raw data is less than 32k");
166     }
167     int32_t cnt = data.ReadInt32();
168     if (cnt <= 0 || cnt > MAX_CALL_NUM) {
169         TELEPHONY_LOGE("invalid parameter, cnt = %{public}d", cnt);
170         return TELEPHONY_ERR_ARGUMENT_INVALID;
171     }
172     TELEPHONY_LOGI("call list size:%{public}d", cnt);
173     CallsReportInfo callReportInfo;
174     CallReportInfo parcelPtr;
175     for (int32_t i = 0; i < cnt; i++) {
176         BuildCallReportInfo(data, parcelPtr);
177         callReportInfo.callVec.push_back(parcelPtr);
178         TELEPHONY_LOGW("accountId:%{public}d,state:%{public}d", parcelPtr.accountId, parcelPtr.state);
179     }
180     callReportInfo.slotId = data.ReadInt32();
181     TELEPHONY_LOGI("slotId:%{public}d", callReportInfo.slotId);
182     result = UpdateCallsReportInfo(callReportInfo);
183     if (!reply.WriteInt32(result)) {
184         TELEPHONY_LOGE("writing parcel failed");
185         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
186     }
187     return TELEPHONY_SUCCESS;
188 }
189 
BuildCallReportInfo(MessageParcel &data, CallReportInfo &parcelPtr)190 void CallStatusCallbackStub::BuildCallReportInfo(MessageParcel &data, CallReportInfo &parcelPtr)
191 {
192     parcelPtr.index = data.ReadInt32();
193     if (strncpy_s(parcelPtr.accountNum, kMaxNumberLen + 1, data.ReadCString(), kMaxNumberLen + 1) != EOK) {
194         TELEPHONY_LOGE("strncpy_s accountNum failed");
195     }
196     parcelPtr.accountId = data.ReadInt32();
197     parcelPtr.callType = static_cast<CallType>(data.ReadInt32());
198     parcelPtr.callMode = static_cast<VideoStateType>(data.ReadInt32());
199     parcelPtr.state = static_cast<TelCallState>(data.ReadInt32());
200     parcelPtr.voiceDomain = data.ReadInt32();
201     parcelPtr.mpty = data.ReadInt32();
202     parcelPtr.crsType = data.ReadInt32();
203     parcelPtr.originalCallType = data.ReadInt32();
204     if (parcelPtr.callType == CallType::TYPE_VOIP) {
205         parcelPtr.voipCallInfo.voipCallId = data.ReadString();
206         parcelPtr.voipCallInfo.userName = data.ReadString();
207         parcelPtr.voipCallInfo.abilityName = data.ReadString();
208         parcelPtr.voipCallInfo.extensionId = data.ReadString();
209         parcelPtr.voipCallInfo.voipBundleName = data.ReadString();
210         parcelPtr.voipCallInfo.showBannerForIncomingCall = data.ReadBool();
211         parcelPtr.voipCallInfo.isConferenceCall = data.ReadBool();
212         parcelPtr.voipCallInfo.isVoiceAnswerSupported = data.ReadBool();
213         parcelPtr.voipCallInfo.hasMicPermission = data.ReadBool();
214         parcelPtr.voipCallInfo.uid = data.ReadInt32();
215         std::vector<uint8_t> userProfile = {};
216         data.ReadUInt8Vector(&userProfile);
217         (parcelPtr.voipCallInfo.userProfile).assign(userProfile.begin(), userProfile.end());
218     }
219 }
220 
OnUpdateDisconnectedCause(MessageParcel &data, MessageParcel &reply)221 int32_t CallStatusCallbackStub::OnUpdateDisconnectedCause(MessageParcel &data, MessageParcel &reply)
222 {
223     int32_t result = TELEPHONY_ERR_FAIL;
224     if (!data.ContainFileDescriptors()) {
225         TELEPHONY_LOGW("sent raw data is less than 32k");
226     }
227     DisconnectedDetails dcDetails;
228     dcDetails.reason = static_cast<DisconnectedReason>(data.ReadInt32());
229     dcDetails.message = data.ReadString();
230     result = UpdateDisconnectedCause(dcDetails);
231     if (!reply.WriteInt32(result)) {
232         TELEPHONY_LOGE("writing parcel failed");
233         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
234     }
235     return TELEPHONY_SUCCESS;
236 }
237 
OnUpdateEventReport(MessageParcel &data, MessageParcel &reply)238 int32_t CallStatusCallbackStub::OnUpdateEventReport(MessageParcel &data, MessageParcel &reply)
239 {
240     int32_t result = TELEPHONY_ERR_FAIL;
241     const CellularCallEventInfo *parcelPtr = nullptr;
242     if (!data.ContainFileDescriptors()) {
243         TELEPHONY_LOGW("sent raw data is less than 32k");
244     }
245     int32_t len = data.ReadInt32();
246     if (len <= 0 || len >= MAX_LEN) {
247         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
248         return TELEPHONY_ERR_ARGUMENT_INVALID;
249     }
250     if ((parcelPtr = reinterpret_cast<const CellularCallEventInfo *>(data.ReadRawData(len))) == nullptr) {
251         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
252         return TELEPHONY_ERR_LOCAL_PTR_NULL;
253     }
254     result = UpdateEventResultInfo(*parcelPtr);
255     if (!reply.WriteInt32(result)) {
256         TELEPHONY_LOGE("writing parcel failed");
257         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
258     }
259     return TELEPHONY_SUCCESS;
260 }
261 
OnUpdateRBTPlayInfo(MessageParcel &data, MessageParcel &reply)262 int32_t CallStatusCallbackStub::OnUpdateRBTPlayInfo(MessageParcel &data, MessageParcel &reply)
263 {
264     int32_t result = TELEPHONY_ERR_FAIL;
265     if (!data.ContainFileDescriptors()) {
266         TELEPHONY_LOGW("sent raw data is less than 32k");
267     }
268     RBTPlayInfo rbtInfo = static_cast<RBTPlayInfo>(data.ReadInt32());
269     result = UpdateRBTPlayInfo(rbtInfo);
270     if (!reply.WriteInt32(result)) {
271         TELEPHONY_LOGE("writing parcel failed");
272         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
273     }
274     return TELEPHONY_SUCCESS;
275 }
276 
OnUpdateGetWaitingResult(MessageParcel &data, MessageParcel &reply)277 int32_t CallStatusCallbackStub::OnUpdateGetWaitingResult(MessageParcel &data, MessageParcel &reply)
278 {
279     int32_t result = TELEPHONY_ERR_FAIL;
280     const CallWaitResponse *parcelPtr = nullptr;
281     if (!data.ContainFileDescriptors()) {
282         TELEPHONY_LOGW("sent raw data is less than 32k");
283     }
284     int32_t len = data.ReadInt32();
285     if (len <= 0 || len >= MAX_LEN) {
286         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
287         return TELEPHONY_ERR_ARGUMENT_INVALID;
288     }
289     if ((parcelPtr = reinterpret_cast<const CallWaitResponse *>(data.ReadRawData(len))) == nullptr) {
290         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
291         return TELEPHONY_ERR_LOCAL_PTR_NULL;
292     }
293     result = UpdateGetWaitingResult(*parcelPtr);
294     if (!reply.WriteInt32(result)) {
295         TELEPHONY_LOGE("writing parcel failed");
296         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
297     }
298     return TELEPHONY_SUCCESS;
299 }
300 
OnUpdateSetWaitingResult(MessageParcel &data, MessageParcel &reply)301 int32_t CallStatusCallbackStub::OnUpdateSetWaitingResult(MessageParcel &data, MessageParcel &reply)
302 {
303     int32_t result = TELEPHONY_ERR_FAIL;
304     if (!data.ContainFileDescriptors()) {
305         TELEPHONY_LOGW("sent raw data is less than 32k");
306     }
307     int32_t callWaitResult = data.ReadInt32();
308     result = UpdateSetWaitingResult(callWaitResult);
309     if (!reply.WriteInt32(result)) {
310         TELEPHONY_LOGE("writing parcel failed");
311         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
312     }
313     return TELEPHONY_SUCCESS;
314 }
315 
OnUpdateGetRestrictionResult(MessageParcel &data, MessageParcel &reply)316 int32_t CallStatusCallbackStub::OnUpdateGetRestrictionResult(MessageParcel &data, MessageParcel &reply)
317 {
318     int32_t result = TELEPHONY_ERR_FAIL;
319     const CallRestrictionResponse *parcelPtr = nullptr;
320     if (!data.ContainFileDescriptors()) {
321         TELEPHONY_LOGW("sent raw data is less than 32k");
322     }
323     int32_t len = data.ReadInt32();
324     if (len <= 0 || len >= MAX_LEN) {
325         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
326         return TELEPHONY_ERR_ARGUMENT_INVALID;
327     }
328     if ((parcelPtr = reinterpret_cast<const CallRestrictionResponse *>(data.ReadRawData(len))) == nullptr) {
329         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
330         return TELEPHONY_ERR_LOCAL_PTR_NULL;
331     }
332     result = UpdateGetRestrictionResult(*parcelPtr);
333     if (!reply.WriteInt32(result)) {
334         TELEPHONY_LOGE("writing parcel failed");
335         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
336     }
337     return TELEPHONY_SUCCESS;
338 }
339 
OnUpdateSetRestrictionResult(MessageParcel &data, MessageParcel &reply)340 int32_t CallStatusCallbackStub::OnUpdateSetRestrictionResult(MessageParcel &data, MessageParcel &reply)
341 {
342     int32_t error = TELEPHONY_ERR_FAIL;
343     int32_t result = TELEPHONY_ERR_FAIL;
344     if (!data.ContainFileDescriptors()) {
345         TELEPHONY_LOGW("sent raw data is less than 32k");
346     }
347     result = data.ReadInt32();
348     error = UpdateSetRestrictionResult(result);
349     if (!reply.WriteInt32(error)) {
350         TELEPHONY_LOGE("writing parcel failed");
351         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
352     }
353     return TELEPHONY_SUCCESS;
354 }
355 
OnUpdateSetRestrictionPasswordResult(MessageParcel &data, MessageParcel &reply)356 int32_t CallStatusCallbackStub::OnUpdateSetRestrictionPasswordResult(MessageParcel &data, MessageParcel &reply)
357 {
358     int32_t error = TELEPHONY_ERR_FAIL;
359     int32_t result = TELEPHONY_ERR_FAIL;
360     if (!data.ContainFileDescriptors()) {
361         TELEPHONY_LOGW("sent raw data is less than 32k");
362     }
363     result = data.ReadInt32();
364     error = UpdateSetRestrictionPasswordResult(result);
365     if (!reply.WriteInt32(error)) {
366         TELEPHONY_LOGE("writing parcel failed");
367         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
368     }
369     return TELEPHONY_SUCCESS;
370 }
371 
OnUpdateGetTransferResult(MessageParcel &data, MessageParcel &reply)372 int32_t CallStatusCallbackStub::OnUpdateGetTransferResult(MessageParcel &data, MessageParcel &reply)
373 {
374     int32_t result = TELEPHONY_ERR_FAIL;
375     const CallTransferResponse *parcelPtr = nullptr;
376     if (!data.ContainFileDescriptors()) {
377         TELEPHONY_LOGW("sent raw data is less than 32k");
378     }
379     int32_t len = data.ReadInt32();
380     if (len <= 0 || len >= MAX_LEN) {
381         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
382         return TELEPHONY_ERR_ARGUMENT_INVALID;
383     }
384     if ((parcelPtr = reinterpret_cast<const CallTransferResponse *>(data.ReadRawData(len))) == nullptr) {
385         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
386         return TELEPHONY_ERR_LOCAL_PTR_NULL;
387     }
388     result = UpdateGetTransferResult(*parcelPtr);
389     if (!reply.WriteInt32(result)) {
390         TELEPHONY_LOGE("writing parcel failed");
391         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
392     }
393     return TELEPHONY_SUCCESS;
394 }
395 
OnUpdateSetTransferResult(MessageParcel &data, MessageParcel &reply)396 int32_t CallStatusCallbackStub::OnUpdateSetTransferResult(MessageParcel &data, MessageParcel &reply)
397 {
398     int32_t error = TELEPHONY_ERR_FAIL;
399     int32_t result = TELEPHONY_ERR_FAIL;
400     if (!data.ContainFileDescriptors()) {
401         TELEPHONY_LOGW("sent raw data is less than 32k");
402     }
403     result = data.ReadInt32();
404     error = UpdateSetTransferResult(result);
405     if (!reply.WriteInt32(error)) {
406         TELEPHONY_LOGE("writing parcel failed");
407         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
408     }
409     return TELEPHONY_SUCCESS;
410 }
411 
OnUpdateGetCallClipResult(MessageParcel &data, MessageParcel &reply)412 int32_t CallStatusCallbackStub::OnUpdateGetCallClipResult(MessageParcel &data, MessageParcel &reply)
413 {
414     int32_t result = TELEPHONY_ERR_FAIL;
415     const ClipResponse *parcelPtr = nullptr;
416     if (!data.ContainFileDescriptors()) {
417         TELEPHONY_LOGW("sent raw data is less than 32k");
418     }
419     int32_t len = data.ReadInt32();
420     if (len <= 0 || len >= MAX_LEN) {
421         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
422         return TELEPHONY_ERR_ARGUMENT_INVALID;
423     }
424     if ((parcelPtr = reinterpret_cast<const ClipResponse *>(data.ReadRawData(len))) == nullptr) {
425         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
426         return TELEPHONY_ERR_LOCAL_PTR_NULL;
427     }
428     result = UpdateGetCallClipResult(*parcelPtr);
429     if (!reply.WriteInt32(result)) {
430         TELEPHONY_LOGE("writing parcel failed");
431         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
432     }
433     return TELEPHONY_SUCCESS;
434 }
435 
OnUpdateGetCallClirResult(MessageParcel &data, MessageParcel &reply)436 int32_t CallStatusCallbackStub::OnUpdateGetCallClirResult(MessageParcel &data, MessageParcel &reply)
437 {
438     int32_t result = TELEPHONY_ERR_FAIL;
439     if (!data.ContainFileDescriptors()) {
440         TELEPHONY_LOGW("sent raw data is less than 32k");
441     }
442     const ClirResponse *parcelPtr = nullptr;
443     int32_t len = data.ReadInt32();
444     if (len <= 0 || len >= MAX_LEN) {
445         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
446         return TELEPHONY_ERR_ARGUMENT_INVALID;
447     }
448     if ((parcelPtr = reinterpret_cast<const ClirResponse *>(data.ReadRawData(len))) == nullptr) {
449         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
450         return TELEPHONY_ERR_LOCAL_PTR_NULL;
451     }
452     result = UpdateGetCallClirResult(*parcelPtr);
453     if (!reply.WriteInt32(result)) {
454         TELEPHONY_LOGE("writing parcel failed");
455         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
456     }
457     return TELEPHONY_SUCCESS;
458 }
459 
OnUpdateSetCallClirResult(MessageParcel &data, MessageParcel &reply)460 int32_t CallStatusCallbackStub::OnUpdateSetCallClirResult(MessageParcel &data, MessageParcel &reply)
461 {
462     int32_t error = TELEPHONY_ERR_FAIL;
463     int32_t result = TELEPHONY_ERR_FAIL;
464     if (!data.ContainFileDescriptors()) {
465         TELEPHONY_LOGW("sent raw data is less than 32k");
466     }
467     result = data.ReadInt32();
468     error = UpdateSetCallClirResult(result);
469     if (!reply.WriteInt32(error)) {
470         TELEPHONY_LOGE("writing parcel failed");
471         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
472     }
473     return TELEPHONY_SUCCESS;
474 }
475 
OnStartRttResult(MessageParcel &data, MessageParcel &reply)476 int32_t CallStatusCallbackStub::OnStartRttResult(MessageParcel &data, MessageParcel &reply)
477 {
478     int32_t error = TELEPHONY_ERR_FAIL;
479     int32_t result = TELEPHONY_ERR_FAIL;
480     if (!data.ContainFileDescriptors()) {
481         TELEPHONY_LOGW("sent raw data is less than 32k");
482     }
483     result = data.ReadInt32();
484     error = StartRttResult(result);
485     if (!reply.WriteInt32(error)) {
486         TELEPHONY_LOGE("writing parcel failed");
487         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
488     }
489     return TELEPHONY_SUCCESS;
490 }
491 
OnStopRttResult(MessageParcel &data, MessageParcel &reply)492 int32_t CallStatusCallbackStub::OnStopRttResult(MessageParcel &data, MessageParcel &reply)
493 {
494     int32_t error = TELEPHONY_ERR_FAIL;
495     int32_t result = TELEPHONY_ERR_FAIL;
496     if (!data.ContainFileDescriptors()) {
497         TELEPHONY_LOGW("sent raw data is less than 32k");
498     }
499     result = data.ReadInt32();
500     error = StopRttResult(result);
501     if (!reply.WriteInt32(error)) {
502         TELEPHONY_LOGE("writing parcel failed");
503         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
504     }
505     return TELEPHONY_SUCCESS;
506 }
507 
OnGetImsConfigResult(MessageParcel &data, MessageParcel &reply)508 int32_t CallStatusCallbackStub::OnGetImsConfigResult(MessageParcel &data, MessageParcel &reply)
509 {
510     int32_t error = TELEPHONY_ERR_FAIL;
511     if (!data.ContainFileDescriptors()) {
512         TELEPHONY_LOGW("sent raw data is less than 32k");
513     }
514     const GetImsConfigResponse *parcelPtr = nullptr;
515     int32_t len = data.ReadInt32();
516     if (len <= 0 || len >= MAX_LEN) {
517         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
518         return TELEPHONY_ERR_ARGUMENT_INVALID;
519     }
520     if ((parcelPtr = reinterpret_cast<const GetImsConfigResponse *>(data.ReadRawData(len))) == nullptr) {
521         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
522         return TELEPHONY_ERR_LOCAL_PTR_NULL;
523     }
524     error = GetImsConfigResult(*parcelPtr);
525     if (!reply.WriteInt32(error)) {
526         TELEPHONY_LOGE("writing parcel failed");
527         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
528     }
529     return TELEPHONY_SUCCESS;
530 }
531 
OnSetImsConfigResult(MessageParcel &data, MessageParcel &reply)532 int32_t CallStatusCallbackStub::OnSetImsConfigResult(MessageParcel &data, MessageParcel &reply)
533 {
534     int32_t error = TELEPHONY_ERR_FAIL;
535     int32_t result = TELEPHONY_ERR_FAIL;
536     if (!data.ContainFileDescriptors()) {
537         TELEPHONY_LOGW("sent raw data is less than 32k");
538     }
539     result = data.ReadInt32();
540     error = SetImsConfigResult(result);
541     if (!reply.WriteInt32(error)) {
542         TELEPHONY_LOGE("writing parcel failed");
543         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
544     }
545     return TELEPHONY_SUCCESS;
546 }
547 
OnGetImsFeatureValueResult(MessageParcel &data, MessageParcel &reply)548 int32_t CallStatusCallbackStub::OnGetImsFeatureValueResult(MessageParcel &data, MessageParcel &reply)
549 {
550     int32_t error = TELEPHONY_ERR_FAIL;
551     if (!data.ContainFileDescriptors()) {
552         TELEPHONY_LOGW("sent raw data is less than 32k");
553     }
554     const GetImsFeatureValueResponse *parcelPtr = nullptr;
555     int32_t len = data.ReadInt32();
556     if (len <= 0 || len >= MAX_LEN) {
557         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
558         return TELEPHONY_ERR_ARGUMENT_INVALID;
559     }
560     if ((parcelPtr = reinterpret_cast<const GetImsFeatureValueResponse *>(data.ReadRawData(len))) == nullptr) {
561         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
562         return TELEPHONY_ERR_LOCAL_PTR_NULL;
563     }
564     error = GetImsFeatureValueResult(*parcelPtr);
565     if (!reply.WriteInt32(error)) {
566         TELEPHONY_LOGE("writing parcel failed");
567         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
568     }
569     return TELEPHONY_SUCCESS;
570 }
571 
OnSetImsFeatureValueResult(MessageParcel &data, MessageParcel &reply)572 int32_t CallStatusCallbackStub::OnSetImsFeatureValueResult(MessageParcel &data, MessageParcel &reply)
573 {
574     int32_t error = TELEPHONY_ERR_FAIL;
575     int32_t result = TELEPHONY_ERR_FAIL;
576     if (!data.ContainFileDescriptors()) {
577         TELEPHONY_LOGW("sent raw data is less than 32k");
578     }
579     result = data.ReadInt32();
580     error = SetImsFeatureValueResult(result);
581     if (!reply.WriteInt32(error)) {
582         TELEPHONY_LOGE("writing parcel failed");
583         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
584     }
585     return TELEPHONY_SUCCESS;
586 }
587 
OnReceiveImsCallModeRequest(MessageParcel &data, MessageParcel &reply)588 int32_t CallStatusCallbackStub::OnReceiveImsCallModeRequest(MessageParcel &data, MessageParcel &reply)
589 {
590     int32_t error = TELEPHONY_ERR_FAIL;
591     if (!data.ContainFileDescriptors()) {
592         TELEPHONY_LOGW("sent raw data is less than 32k");
593     }
594     const CallModeReportInfo *parcelPtr = nullptr;
595     int32_t len = data.ReadInt32();
596     if (len <= 0 || len >= MAX_LEN) {
597         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
598         return TELEPHONY_ERR_ARGUMENT_INVALID;
599     }
600     if ((parcelPtr = reinterpret_cast<const CallModeReportInfo *>(data.ReadRawData(len))) == nullptr) {
601         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
602         return TELEPHONY_ERR_LOCAL_PTR_NULL;
603     }
604     error = ReceiveUpdateCallMediaModeRequest(*parcelPtr);
605     if (!reply.WriteInt32(error)) {
606         TELEPHONY_LOGE("writing parcel failed");
607         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
608     }
609     return TELEPHONY_SUCCESS;
610 }
611 
OnReceiveImsCallModeResponse(MessageParcel &data, MessageParcel &reply)612 int32_t CallStatusCallbackStub::OnReceiveImsCallModeResponse(MessageParcel &data, MessageParcel &reply)
613 {
614     int32_t error = TELEPHONY_ERR_FAIL;
615     if (!data.ContainFileDescriptors()) {
616         TELEPHONY_LOGW("sent raw data is less than 32k");
617     }
618     const CallModeReportInfo *parcelPtr = nullptr;
619     int32_t len = data.ReadInt32();
620     if (len <= 0 || len >= MAX_LEN) {
621         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
622         return TELEPHONY_ERR_ARGUMENT_INVALID;
623     }
624     if ((parcelPtr = reinterpret_cast<const CallModeReportInfo *>(data.ReadRawData(len))) == nullptr) {
625         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
626         return TELEPHONY_ERR_LOCAL_PTR_NULL;
627     }
628     error = ReceiveUpdateCallMediaModeResponse(*parcelPtr);
629     if (!reply.WriteInt32(error)) {
630         TELEPHONY_LOGE("writing parcel failed");
631         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
632     }
633     return TELEPHONY_SUCCESS;
634 }
635 
OnInviteToConferenceResult(MessageParcel &data, MessageParcel &reply)636 int32_t CallStatusCallbackStub::OnInviteToConferenceResult(MessageParcel &data, MessageParcel &reply)
637 {
638     int32_t error = TELEPHONY_ERR_FAIL;
639     int32_t result = TELEPHONY_ERR_FAIL;
640     if (!data.ContainFileDescriptors()) {
641         TELEPHONY_LOGW("sent raw data is less than 32k");
642     }
643     result = data.ReadInt32();
644     error = InviteToConferenceResult(result);
645     if (!reply.WriteInt32(error)) {
646         TELEPHONY_LOGE("writing parcel failed");
647         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
648     }
649     return TELEPHONY_SUCCESS;
650 }
651 
OnStartDtmfResult(MessageParcel &data, MessageParcel &reply)652 int32_t CallStatusCallbackStub::OnStartDtmfResult(MessageParcel &data, MessageParcel &reply)
653 {
654     int32_t error = TELEPHONY_ERR_FAIL;
655     int32_t result = TELEPHONY_ERR_FAIL;
656     if (!data.ContainFileDescriptors()) {
657         TELEPHONY_LOGW("sent raw data is less than 32k");
658     }
659     result = data.ReadInt32();
660     error = StartDtmfResult(result);
661     if (!reply.WriteInt32(error)) {
662         TELEPHONY_LOGE("writing parcel failed");
663         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
664     }
665     return TELEPHONY_SUCCESS;
666 }
667 
OnStopDtmfResult(MessageParcel &data, MessageParcel &reply)668 int32_t CallStatusCallbackStub::OnStopDtmfResult(MessageParcel &data, MessageParcel &reply)
669 {
670     int32_t error = TELEPHONY_ERR_FAIL;
671     int32_t result = TELEPHONY_ERR_FAIL;
672     if (!data.ContainFileDescriptors()) {
673         TELEPHONY_LOGW("sent raw data is less than 32k");
674     }
675     result = data.ReadInt32();
676     error = StopDtmfResult(result);
677     if (!reply.WriteInt32(error)) {
678         TELEPHONY_LOGE("writing parcel failed");
679         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
680     }
681     return TELEPHONY_SUCCESS;
682 }
683 
OnSendUssdResult(MessageParcel &data, MessageParcel &reply)684 int32_t CallStatusCallbackStub::OnSendUssdResult(MessageParcel &data, MessageParcel &reply)
685 {
686     int32_t error = TELEPHONY_ERR_FAIL;
687     int32_t result = TELEPHONY_ERR_FAIL;
688     if (!data.ContainFileDescriptors()) {
689         TELEPHONY_LOGW("sent raw data is less than 32k");
690     }
691     result = data.ReadInt32();
692     error = SendUssdResult(result);
693     if (!reply.WriteInt32(error)) {
694         TELEPHONY_LOGE("writing parcel failed");
695         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
696     }
697     return TELEPHONY_SUCCESS;
698 }
699 
OnSendMmiCodeResult(MessageParcel &data, MessageParcel &reply)700 int32_t CallStatusCallbackStub::OnSendMmiCodeResult(MessageParcel &data, MessageParcel &reply)
701 {
702     int32_t result = TELEPHONY_ERR_FAIL;
703     const MmiCodeInfo *parcelPtr = nullptr;
704     if (!data.ContainFileDescriptors()) {
705         TELEPHONY_LOGW("sent raw data is less than 32k");
706     }
707     int32_t len = data.ReadInt32();
708     if (len <= 0 || len >= MAX_LEN) {
709         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
710         return TELEPHONY_ERR_ARGUMENT_INVALID;
711     }
712     if ((parcelPtr = reinterpret_cast<const MmiCodeInfo *>(data.ReadRawData(len))) == nullptr) {
713         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
714         return TELEPHONY_ERR_LOCAL_PTR_NULL;
715     }
716 
717     result = SendMmiCodeResult(*parcelPtr);
718     if (!reply.WriteInt32(result)) {
719         TELEPHONY_LOGE("writing parcel failed");
720         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
721     }
722     return TELEPHONY_SUCCESS;
723 }
724 
OnGetImsCallDataResult(MessageParcel &data, MessageParcel &reply)725 int32_t CallStatusCallbackStub::OnGetImsCallDataResult(MessageParcel &data, MessageParcel &reply)
726 {
727     int32_t error = TELEPHONY_ERR_FAIL;
728     int32_t result = TELEPHONY_ERR_FAIL;
729     if (!data.ContainFileDescriptors()) {
730         TELEPHONY_LOGW("sent raw data is less than 32k");
731     }
732     result = data.ReadInt32();
733     error = GetImsCallDataResult(result);
734     if (!reply.WriteInt32(error)) {
735         TELEPHONY_LOGE("writing parcel failed");
736         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
737     }
738     return TELEPHONY_SUCCESS;
739 }
740 
OnCloseUnFinishedUssdResult(MessageParcel &data, MessageParcel &reply)741 int32_t CallStatusCallbackStub::OnCloseUnFinishedUssdResult(MessageParcel &data, MessageParcel &reply)
742 {
743     int32_t error = TELEPHONY_ERR_FAIL;
744     int32_t result = TELEPHONY_ERR_FAIL;
745     if (!data.ContainFileDescriptors()) {
746         TELEPHONY_LOGW("sent raw data is less than 32k");
747     }
748     result = data.ReadInt32();
749     error = CloseUnFinishedUssdResult(result);
750     if (!reply.WriteInt32(error)) {
751         TELEPHONY_LOGE("writing parcel failed");
752         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
753     }
754     return TELEPHONY_SUCCESS;
755 }
756 
OnPostDialNextChar(MessageParcel &data, MessageParcel &reply)757 int32_t CallStatusCallbackStub::OnPostDialNextChar(MessageParcel &data, MessageParcel &reply)
758 {
759     int32_t error = TELEPHONY_ERR_FAIL;
760     if (!data.ContainFileDescriptors()) {
761         TELEPHONY_LOGW("sent raw data is less than 32k");
762     }
763     std::string c = data.ReadString();
764     error = ReportPostDialChar(c);
765     if (!reply.WriteInt32(error)) {
766         TELEPHONY_LOGE("writing parcel failed");
767         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
768     }
769     return TELEPHONY_SUCCESS;
770 }
771 
OnReportPostDialDelay(MessageParcel &data, MessageParcel &reply)772 int32_t CallStatusCallbackStub::OnReportPostDialDelay(MessageParcel &data, MessageParcel &reply)
773 {
774     int32_t error = TELEPHONY_ERR_FAIL;
775     if (!data.ContainFileDescriptors()) {
776         TELEPHONY_LOGW("sent raw data is less than 32k");
777     }
778     std::string remainPostDial = data.ReadString();
779     error = ReportPostDialDelay(remainPostDial);
780     if (!reply.WriteInt32(error)) {
781         TELEPHONY_LOGE("writing parcel failed");
782         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
783     }
784     return TELEPHONY_SUCCESS;
785 }
786 
OnCallSessionEventChange(MessageParcel &data, MessageParcel &reply)787 int32_t CallStatusCallbackStub::OnCallSessionEventChange(MessageParcel &data, MessageParcel &reply)
788 {
789     int32_t error = TELEPHONY_ERR_FAIL;
790     if (!data.ContainFileDescriptors()) {
791         TELEPHONY_LOGW("sent raw data is less than 32k");
792     }
793     const CallSessionReportInfo *parcelPtr = nullptr;
794     int32_t len = data.ReadInt32();
795     if (len <= 0 || len >= MAX_LEN) {
796         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
797         return TELEPHONY_ERR_ARGUMENT_INVALID;
798     }
799     if ((parcelPtr = reinterpret_cast<const CallSessionReportInfo *>(data.ReadRawData(len))) == nullptr) {
800         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
801         return TELEPHONY_ERR_LOCAL_PTR_NULL;
802     }
803     error = HandleCallSessionEventChanged(*parcelPtr);
804     if (!reply.WriteInt32(error)) {
805         TELEPHONY_LOGE("writing parcel failed");
806         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
807     }
808     return TELEPHONY_SUCCESS;
809 }
810 
OnPeerDimensionsChange(MessageParcel &data, MessageParcel &reply)811 int32_t CallStatusCallbackStub::OnPeerDimensionsChange(MessageParcel &data, MessageParcel &reply)
812 {
813     int32_t error = TELEPHONY_ERR_FAIL;
814     if (!data.ContainFileDescriptors()) {
815         TELEPHONY_LOGW("sent raw data is less than 32k");
816     }
817     const PeerDimensionsReportInfo *parcelPtr = nullptr;
818     int32_t len = data.ReadInt32();
819     if (len <= 0 || len >= MAX_LEN) {
820         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
821         return TELEPHONY_ERR_ARGUMENT_INVALID;
822     }
823     if ((parcelPtr = reinterpret_cast<const PeerDimensionsReportInfo *>(data.ReadRawData(len))) == nullptr) {
824         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
825         return TELEPHONY_ERR_LOCAL_PTR_NULL;
826     }
827     error = HandlePeerDimensionsChanged(*parcelPtr);
828     if (!reply.WriteInt32(error)) {
829         TELEPHONY_LOGE("writing parcel failed");
830         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
831     }
832     return TELEPHONY_SUCCESS;
833 }
834 
OnCallDataUsageChange(MessageParcel &data, MessageParcel &reply)835 int32_t CallStatusCallbackStub::OnCallDataUsageChange(MessageParcel &data, MessageParcel &reply)
836 {
837     int32_t error = TELEPHONY_ERR_FAIL;
838     if (!data.ContainFileDescriptors()) {
839         TELEPHONY_LOGW("sent raw data is less than 32k");
840     }
841     int64_t result = data.ReadInt64();
842     error = HandleCallDataUsageChanged(result);
843     if (!reply.WriteInt32(error)) {
844         TELEPHONY_LOGE("writing parcel failed");
845         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
846     }
847     return TELEPHONY_SUCCESS;
848 }
849 
OnCameraCapabilitiesChange(MessageParcel &data, MessageParcel &reply)850 int32_t CallStatusCallbackStub::OnCameraCapabilitiesChange(MessageParcel &data, MessageParcel &reply)
851 {
852     int32_t error = TELEPHONY_ERR_FAIL;
853     if (!data.ContainFileDescriptors()) {
854         TELEPHONY_LOGW("sent raw data is less than 32k");
855     }
856     const CameraCapabilitiesReportInfo *parcelPtr = nullptr;
857     int32_t len = data.ReadInt32();
858     if (len <= 0 || len >= MAX_LEN) {
859         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
860         return TELEPHONY_ERR_ARGUMENT_INVALID;
861     }
862     if ((parcelPtr = reinterpret_cast<const CameraCapabilitiesReportInfo *>(data.ReadRawData(len))) == nullptr) {
863         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
864         return TELEPHONY_ERR_LOCAL_PTR_NULL;
865     }
866     error = HandleCameraCapabilitiesChanged(*parcelPtr);
867     if (!reply.WriteInt32(error)) {
868         TELEPHONY_LOGE("writing parcel failed");
869         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
870     }
871     return TELEPHONY_SUCCESS;
872 }
873 
OnUpdateVoipEventInfo(MessageParcel &data, MessageParcel &reply)874 int32_t CallStatusCallbackStub::OnUpdateVoipEventInfo(MessageParcel &data, MessageParcel &reply)
875 {
876     int32_t error = TELEPHONY_ERR_FAIL;
877     if (!data.ContainFileDescriptors()) {
878         TELEPHONY_LOGW("sent raw data is less than 32k");
879     }
880     VoipCallEventInfo parcelPtr;
881     parcelPtr.voipCallId = data.ReadString();
882     parcelPtr.bundleName = data.ReadString();
883     parcelPtr.uid = data.ReadInt32();
884     parcelPtr.voipCallEvent = static_cast<VoipCallEvent>(data.ReadInt32());
885     parcelPtr.errorReason = static_cast<ErrorReason>(data.ReadInt32());
886     error = UpdateVoipEventInfo(parcelPtr);
887     if (!reply.WriteInt32(error)) {
888         TELEPHONY_LOGE("writing parcel failed");
889         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
890     }
891     return TELEPHONY_SUCCESS;
892 }
893 } // namespace Telephony
894 } // namespace OHOS
895