• 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 "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.isCapsuleSticky = data.ReadBool();
215         parcelPtr.voipCallInfo.uid = data.ReadInt32();
216         std::vector<uint8_t> userProfile = {};
217         data.ReadUInt8Vector(&userProfile);
218         (parcelPtr.voipCallInfo.userProfile).assign(userProfile.begin(), userProfile.end());
219     }
220     parcelPtr.name = data.ReadString();
221     parcelPtr.namePresentation = data.ReadInt32();
222     int32_t reason = static_cast<int32_t>(DisconnectedReason::FAILED_UNKNOWN);
223     // only OnUpdateCallsReportInfo() func can read reason, OnUpdateCallReportInfo() func can not read reason
224     if (data.ReadInt32(reason)) {
225         parcelPtr.reason = static_cast<DisconnectedReason>(reason);
226     }
227     parcelPtr.message = data.ReadString();
228     parcelPtr.newCallUseBox = data.ReadInt32();
229 }
230 
OnUpdateDisconnectedCause(MessageParcel & data,MessageParcel & reply)231 int32_t CallStatusCallbackStub::OnUpdateDisconnectedCause(MessageParcel &data, MessageParcel &reply)
232 {
233     int32_t result = TELEPHONY_ERR_FAIL;
234     if (!data.ContainFileDescriptors()) {
235         TELEPHONY_LOGW("sent raw data is less than 32k");
236     }
237     DisconnectedDetails dcDetails;
238     dcDetails.reason = static_cast<DisconnectedReason>(data.ReadInt32());
239     dcDetails.message = data.ReadString();
240     result = UpdateDisconnectedCause(dcDetails);
241     if (!reply.WriteInt32(result)) {
242         TELEPHONY_LOGE("writing parcel failed");
243         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
244     }
245     return TELEPHONY_SUCCESS;
246 }
247 
OnUpdateEventReport(MessageParcel & data,MessageParcel & reply)248 int32_t CallStatusCallbackStub::OnUpdateEventReport(MessageParcel &data, MessageParcel &reply)
249 {
250     int32_t result = TELEPHONY_ERR_FAIL;
251     const CellularCallEventInfo *parcelPtr = nullptr;
252     if (!data.ContainFileDescriptors()) {
253         TELEPHONY_LOGW("sent raw data is less than 32k");
254     }
255     int32_t len = data.ReadInt32();
256     if (len <= 0 || len >= MAX_LEN) {
257         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
258         return TELEPHONY_ERR_ARGUMENT_INVALID;
259     }
260     if ((parcelPtr = reinterpret_cast<const CellularCallEventInfo *>(data.ReadRawData(len))) == nullptr) {
261         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
262         return TELEPHONY_ERR_LOCAL_PTR_NULL;
263     }
264     result = UpdateEventResultInfo(*parcelPtr);
265     if (!reply.WriteInt32(result)) {
266         TELEPHONY_LOGE("writing parcel failed");
267         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
268     }
269     return TELEPHONY_SUCCESS;
270 }
271 
OnUpdateRBTPlayInfo(MessageParcel & data,MessageParcel & reply)272 int32_t CallStatusCallbackStub::OnUpdateRBTPlayInfo(MessageParcel &data, MessageParcel &reply)
273 {
274     int32_t result = TELEPHONY_ERR_FAIL;
275     if (!data.ContainFileDescriptors()) {
276         TELEPHONY_LOGW("sent raw data is less than 32k");
277     }
278     RBTPlayInfo rbtInfo = static_cast<RBTPlayInfo>(data.ReadInt32());
279     result = UpdateRBTPlayInfo(rbtInfo);
280     if (!reply.WriteInt32(result)) {
281         TELEPHONY_LOGE("writing parcel failed");
282         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
283     }
284     return TELEPHONY_SUCCESS;
285 }
286 
OnUpdateGetWaitingResult(MessageParcel & data,MessageParcel & reply)287 int32_t CallStatusCallbackStub::OnUpdateGetWaitingResult(MessageParcel &data, MessageParcel &reply)
288 {
289     int32_t result = TELEPHONY_ERR_FAIL;
290     const CallWaitResponse *parcelPtr = nullptr;
291     if (!data.ContainFileDescriptors()) {
292         TELEPHONY_LOGW("sent raw data is less than 32k");
293     }
294     int32_t len = data.ReadInt32();
295     if (len <= 0 || len >= MAX_LEN) {
296         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
297         return TELEPHONY_ERR_ARGUMENT_INVALID;
298     }
299     if ((parcelPtr = reinterpret_cast<const CallWaitResponse *>(data.ReadRawData(len))) == nullptr) {
300         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
301         return TELEPHONY_ERR_LOCAL_PTR_NULL;
302     }
303     result = UpdateGetWaitingResult(*parcelPtr);
304     if (!reply.WriteInt32(result)) {
305         TELEPHONY_LOGE("writing parcel failed");
306         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
307     }
308     return TELEPHONY_SUCCESS;
309 }
310 
OnUpdateSetWaitingResult(MessageParcel & data,MessageParcel & reply)311 int32_t CallStatusCallbackStub::OnUpdateSetWaitingResult(MessageParcel &data, MessageParcel &reply)
312 {
313     int32_t result = TELEPHONY_ERR_FAIL;
314     if (!data.ContainFileDescriptors()) {
315         TELEPHONY_LOGW("sent raw data is less than 32k");
316     }
317     int32_t callWaitResult = data.ReadInt32();
318     result = UpdateSetWaitingResult(callWaitResult);
319     if (!reply.WriteInt32(result)) {
320         TELEPHONY_LOGE("writing parcel failed");
321         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
322     }
323     return TELEPHONY_SUCCESS;
324 }
325 
OnUpdateGetRestrictionResult(MessageParcel & data,MessageParcel & reply)326 int32_t CallStatusCallbackStub::OnUpdateGetRestrictionResult(MessageParcel &data, MessageParcel &reply)
327 {
328     int32_t result = TELEPHONY_ERR_FAIL;
329     const CallRestrictionResponse *parcelPtr = nullptr;
330     if (!data.ContainFileDescriptors()) {
331         TELEPHONY_LOGW("sent raw data is less than 32k");
332     }
333     int32_t len = data.ReadInt32();
334     if (len <= 0 || len >= MAX_LEN) {
335         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
336         return TELEPHONY_ERR_ARGUMENT_INVALID;
337     }
338     if ((parcelPtr = reinterpret_cast<const CallRestrictionResponse *>(data.ReadRawData(len))) == nullptr) {
339         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
340         return TELEPHONY_ERR_LOCAL_PTR_NULL;
341     }
342     result = UpdateGetRestrictionResult(*parcelPtr);
343     if (!reply.WriteInt32(result)) {
344         TELEPHONY_LOGE("writing parcel failed");
345         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
346     }
347     return TELEPHONY_SUCCESS;
348 }
349 
OnUpdateSetRestrictionResult(MessageParcel & data,MessageParcel & reply)350 int32_t CallStatusCallbackStub::OnUpdateSetRestrictionResult(MessageParcel &data, MessageParcel &reply)
351 {
352     int32_t error = TELEPHONY_ERR_FAIL;
353     int32_t result = TELEPHONY_ERR_FAIL;
354     if (!data.ContainFileDescriptors()) {
355         TELEPHONY_LOGW("sent raw data is less than 32k");
356     }
357     result = data.ReadInt32();
358     error = UpdateSetRestrictionResult(result);
359     if (!reply.WriteInt32(error)) {
360         TELEPHONY_LOGE("writing parcel failed");
361         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
362     }
363     return TELEPHONY_SUCCESS;
364 }
365 
OnUpdateSetRestrictionPasswordResult(MessageParcel & data,MessageParcel & reply)366 int32_t CallStatusCallbackStub::OnUpdateSetRestrictionPasswordResult(MessageParcel &data, MessageParcel &reply)
367 {
368     int32_t error = TELEPHONY_ERR_FAIL;
369     int32_t result = TELEPHONY_ERR_FAIL;
370     if (!data.ContainFileDescriptors()) {
371         TELEPHONY_LOGW("sent raw data is less than 32k");
372     }
373     result = data.ReadInt32();
374     error = UpdateSetRestrictionPasswordResult(result);
375     if (!reply.WriteInt32(error)) {
376         TELEPHONY_LOGE("writing parcel failed");
377         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
378     }
379     return TELEPHONY_SUCCESS;
380 }
381 
OnUpdateGetTransferResult(MessageParcel & data,MessageParcel & reply)382 int32_t CallStatusCallbackStub::OnUpdateGetTransferResult(MessageParcel &data, MessageParcel &reply)
383 {
384     int32_t result = TELEPHONY_ERR_FAIL;
385     const CallTransferResponse *parcelPtr = nullptr;
386     if (!data.ContainFileDescriptors()) {
387         TELEPHONY_LOGW("sent raw data is less than 32k");
388     }
389     int32_t len = data.ReadInt32();
390     if (len <= 0 || len >= MAX_LEN) {
391         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
392         return TELEPHONY_ERR_ARGUMENT_INVALID;
393     }
394     if ((parcelPtr = reinterpret_cast<const CallTransferResponse *>(data.ReadRawData(len))) == nullptr) {
395         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
396         return TELEPHONY_ERR_LOCAL_PTR_NULL;
397     }
398     result = UpdateGetTransferResult(*parcelPtr);
399     if (!reply.WriteInt32(result)) {
400         TELEPHONY_LOGE("writing parcel failed");
401         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
402     }
403     return TELEPHONY_SUCCESS;
404 }
405 
OnUpdateSetTransferResult(MessageParcel & data,MessageParcel & reply)406 int32_t CallStatusCallbackStub::OnUpdateSetTransferResult(MessageParcel &data, MessageParcel &reply)
407 {
408     int32_t error = TELEPHONY_ERR_FAIL;
409     int32_t result = TELEPHONY_ERR_FAIL;
410     if (!data.ContainFileDescriptors()) {
411         TELEPHONY_LOGW("sent raw data is less than 32k");
412     }
413     result = data.ReadInt32();
414     error = UpdateSetTransferResult(result);
415     if (!reply.WriteInt32(error)) {
416         TELEPHONY_LOGE("writing parcel failed");
417         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
418     }
419     return TELEPHONY_SUCCESS;
420 }
421 
OnUpdateGetCallClipResult(MessageParcel & data,MessageParcel & reply)422 int32_t CallStatusCallbackStub::OnUpdateGetCallClipResult(MessageParcel &data, MessageParcel &reply)
423 {
424     int32_t result = TELEPHONY_ERR_FAIL;
425     const ClipResponse *parcelPtr = nullptr;
426     if (!data.ContainFileDescriptors()) {
427         TELEPHONY_LOGW("sent raw data is less than 32k");
428     }
429     int32_t len = data.ReadInt32();
430     if (len <= 0 || len >= MAX_LEN) {
431         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
432         return TELEPHONY_ERR_ARGUMENT_INVALID;
433     }
434     if ((parcelPtr = reinterpret_cast<const ClipResponse *>(data.ReadRawData(len))) == nullptr) {
435         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
436         return TELEPHONY_ERR_LOCAL_PTR_NULL;
437     }
438     result = UpdateGetCallClipResult(*parcelPtr);
439     if (!reply.WriteInt32(result)) {
440         TELEPHONY_LOGE("writing parcel failed");
441         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
442     }
443     return TELEPHONY_SUCCESS;
444 }
445 
OnUpdateGetCallClirResult(MessageParcel & data,MessageParcel & reply)446 int32_t CallStatusCallbackStub::OnUpdateGetCallClirResult(MessageParcel &data, MessageParcel &reply)
447 {
448     int32_t result = TELEPHONY_ERR_FAIL;
449     if (!data.ContainFileDescriptors()) {
450         TELEPHONY_LOGW("sent raw data is less than 32k");
451     }
452     const ClirResponse *parcelPtr = nullptr;
453     int32_t len = data.ReadInt32();
454     if (len <= 0 || len >= MAX_LEN) {
455         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
456         return TELEPHONY_ERR_ARGUMENT_INVALID;
457     }
458     if ((parcelPtr = reinterpret_cast<const ClirResponse *>(data.ReadRawData(len))) == nullptr) {
459         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
460         return TELEPHONY_ERR_LOCAL_PTR_NULL;
461     }
462     result = UpdateGetCallClirResult(*parcelPtr);
463     if (!reply.WriteInt32(result)) {
464         TELEPHONY_LOGE("writing parcel failed");
465         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
466     }
467     return TELEPHONY_SUCCESS;
468 }
469 
OnUpdateSetCallClirResult(MessageParcel & data,MessageParcel & reply)470 int32_t CallStatusCallbackStub::OnUpdateSetCallClirResult(MessageParcel &data, MessageParcel &reply)
471 {
472     int32_t error = TELEPHONY_ERR_FAIL;
473     int32_t result = TELEPHONY_ERR_FAIL;
474     if (!data.ContainFileDescriptors()) {
475         TELEPHONY_LOGW("sent raw data is less than 32k");
476     }
477     result = data.ReadInt32();
478     error = UpdateSetCallClirResult(result);
479     if (!reply.WriteInt32(error)) {
480         TELEPHONY_LOGE("writing parcel failed");
481         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
482     }
483     return TELEPHONY_SUCCESS;
484 }
485 
OnStartRttResult(MessageParcel & data,MessageParcel & reply)486 int32_t CallStatusCallbackStub::OnStartRttResult(MessageParcel &data, MessageParcel &reply)
487 {
488     int32_t error = TELEPHONY_ERR_FAIL;
489     int32_t result = TELEPHONY_ERR_FAIL;
490     if (!data.ContainFileDescriptors()) {
491         TELEPHONY_LOGW("sent raw data is less than 32k");
492     }
493     result = data.ReadInt32();
494     error = StartRttResult(result);
495     if (!reply.WriteInt32(error)) {
496         TELEPHONY_LOGE("writing parcel failed");
497         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
498     }
499     return TELEPHONY_SUCCESS;
500 }
501 
OnStopRttResult(MessageParcel & data,MessageParcel & reply)502 int32_t CallStatusCallbackStub::OnStopRttResult(MessageParcel &data, MessageParcel &reply)
503 {
504     int32_t error = TELEPHONY_ERR_FAIL;
505     int32_t result = TELEPHONY_ERR_FAIL;
506     if (!data.ContainFileDescriptors()) {
507         TELEPHONY_LOGW("sent raw data is less than 32k");
508     }
509     result = data.ReadInt32();
510     error = StopRttResult(result);
511     if (!reply.WriteInt32(error)) {
512         TELEPHONY_LOGE("writing parcel failed");
513         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
514     }
515     return TELEPHONY_SUCCESS;
516 }
517 
OnGetImsConfigResult(MessageParcel & data,MessageParcel & reply)518 int32_t CallStatusCallbackStub::OnGetImsConfigResult(MessageParcel &data, MessageParcel &reply)
519 {
520     int32_t error = TELEPHONY_ERR_FAIL;
521     if (!data.ContainFileDescriptors()) {
522         TELEPHONY_LOGW("sent raw data is less than 32k");
523     }
524     const GetImsConfigResponse *parcelPtr = nullptr;
525     int32_t len = data.ReadInt32();
526     if (len <= 0 || len >= MAX_LEN) {
527         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
528         return TELEPHONY_ERR_ARGUMENT_INVALID;
529     }
530     if ((parcelPtr = reinterpret_cast<const GetImsConfigResponse *>(data.ReadRawData(len))) == nullptr) {
531         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
532         return TELEPHONY_ERR_LOCAL_PTR_NULL;
533     }
534     error = GetImsConfigResult(*parcelPtr);
535     if (!reply.WriteInt32(error)) {
536         TELEPHONY_LOGE("writing parcel failed");
537         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
538     }
539     return TELEPHONY_SUCCESS;
540 }
541 
OnSetImsConfigResult(MessageParcel & data,MessageParcel & reply)542 int32_t CallStatusCallbackStub::OnSetImsConfigResult(MessageParcel &data, MessageParcel &reply)
543 {
544     int32_t error = TELEPHONY_ERR_FAIL;
545     int32_t result = TELEPHONY_ERR_FAIL;
546     if (!data.ContainFileDescriptors()) {
547         TELEPHONY_LOGW("sent raw data is less than 32k");
548     }
549     result = data.ReadInt32();
550     error = SetImsConfigResult(result);
551     if (!reply.WriteInt32(error)) {
552         TELEPHONY_LOGE("writing parcel failed");
553         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
554     }
555     return TELEPHONY_SUCCESS;
556 }
557 
OnGetImsFeatureValueResult(MessageParcel & data,MessageParcel & reply)558 int32_t CallStatusCallbackStub::OnGetImsFeatureValueResult(MessageParcel &data, MessageParcel &reply)
559 {
560     int32_t error = TELEPHONY_ERR_FAIL;
561     if (!data.ContainFileDescriptors()) {
562         TELEPHONY_LOGW("sent raw data is less than 32k");
563     }
564     const GetImsFeatureValueResponse *parcelPtr = nullptr;
565     int32_t len = data.ReadInt32();
566     if (len <= 0 || len >= MAX_LEN) {
567         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
568         return TELEPHONY_ERR_ARGUMENT_INVALID;
569     }
570     if ((parcelPtr = reinterpret_cast<const GetImsFeatureValueResponse *>(data.ReadRawData(len))) == nullptr) {
571         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
572         return TELEPHONY_ERR_LOCAL_PTR_NULL;
573     }
574     error = GetImsFeatureValueResult(*parcelPtr);
575     if (!reply.WriteInt32(error)) {
576         TELEPHONY_LOGE("writing parcel failed");
577         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
578     }
579     return TELEPHONY_SUCCESS;
580 }
581 
OnSetImsFeatureValueResult(MessageParcel & data,MessageParcel & reply)582 int32_t CallStatusCallbackStub::OnSetImsFeatureValueResult(MessageParcel &data, MessageParcel &reply)
583 {
584     int32_t error = TELEPHONY_ERR_FAIL;
585     int32_t result = TELEPHONY_ERR_FAIL;
586     if (!data.ContainFileDescriptors()) {
587         TELEPHONY_LOGW("sent raw data is less than 32k");
588     }
589     result = data.ReadInt32();
590     error = SetImsFeatureValueResult(result);
591     if (!reply.WriteInt32(error)) {
592         TELEPHONY_LOGE("writing parcel failed");
593         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
594     }
595     return TELEPHONY_SUCCESS;
596 }
597 
OnReceiveImsCallModeRequest(MessageParcel & data,MessageParcel & reply)598 int32_t CallStatusCallbackStub::OnReceiveImsCallModeRequest(MessageParcel &data, MessageParcel &reply)
599 {
600     int32_t error = TELEPHONY_ERR_FAIL;
601     if (!data.ContainFileDescriptors()) {
602         TELEPHONY_LOGW("sent raw data is less than 32k");
603     }
604     const CallModeReportInfo *parcelPtr = nullptr;
605     int32_t len = data.ReadInt32();
606     if (len <= 0 || len >= MAX_LEN) {
607         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
608         return TELEPHONY_ERR_ARGUMENT_INVALID;
609     }
610     if ((parcelPtr = reinterpret_cast<const CallModeReportInfo *>(data.ReadRawData(len))) == nullptr) {
611         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
612         return TELEPHONY_ERR_LOCAL_PTR_NULL;
613     }
614     error = ReceiveUpdateCallMediaModeRequest(*parcelPtr);
615     if (!reply.WriteInt32(error)) {
616         TELEPHONY_LOGE("writing parcel failed");
617         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
618     }
619     return TELEPHONY_SUCCESS;
620 }
621 
OnReceiveImsCallModeResponse(MessageParcel & data,MessageParcel & reply)622 int32_t CallStatusCallbackStub::OnReceiveImsCallModeResponse(MessageParcel &data, MessageParcel &reply)
623 {
624     int32_t error = TELEPHONY_ERR_FAIL;
625     if (!data.ContainFileDescriptors()) {
626         TELEPHONY_LOGW("sent raw data is less than 32k");
627     }
628     const CallModeReportInfo *parcelPtr = nullptr;
629     int32_t len = data.ReadInt32();
630     if (len <= 0 || len >= MAX_LEN) {
631         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
632         return TELEPHONY_ERR_ARGUMENT_INVALID;
633     }
634     if ((parcelPtr = reinterpret_cast<const CallModeReportInfo *>(data.ReadRawData(len))) == nullptr) {
635         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
636         return TELEPHONY_ERR_LOCAL_PTR_NULL;
637     }
638     error = ReceiveUpdateCallMediaModeResponse(*parcelPtr);
639     if (!reply.WriteInt32(error)) {
640         TELEPHONY_LOGE("writing parcel failed");
641         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
642     }
643     return TELEPHONY_SUCCESS;
644 }
645 
OnInviteToConferenceResult(MessageParcel & data,MessageParcel & reply)646 int32_t CallStatusCallbackStub::OnInviteToConferenceResult(MessageParcel &data, MessageParcel &reply)
647 {
648     int32_t error = TELEPHONY_ERR_FAIL;
649     int32_t result = TELEPHONY_ERR_FAIL;
650     if (!data.ContainFileDescriptors()) {
651         TELEPHONY_LOGW("sent raw data is less than 32k");
652     }
653     result = data.ReadInt32();
654     error = InviteToConferenceResult(result);
655     if (!reply.WriteInt32(error)) {
656         TELEPHONY_LOGE("writing parcel failed");
657         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
658     }
659     return TELEPHONY_SUCCESS;
660 }
661 
OnStartDtmfResult(MessageParcel & data,MessageParcel & reply)662 int32_t CallStatusCallbackStub::OnStartDtmfResult(MessageParcel &data, MessageParcel &reply)
663 {
664     int32_t error = TELEPHONY_ERR_FAIL;
665     int32_t result = TELEPHONY_ERR_FAIL;
666     if (!data.ContainFileDescriptors()) {
667         TELEPHONY_LOGW("sent raw data is less than 32k");
668     }
669     result = data.ReadInt32();
670     error = StartDtmfResult(result);
671     if (!reply.WriteInt32(error)) {
672         TELEPHONY_LOGE("writing parcel failed");
673         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
674     }
675     return TELEPHONY_SUCCESS;
676 }
677 
OnStopDtmfResult(MessageParcel & data,MessageParcel & reply)678 int32_t CallStatusCallbackStub::OnStopDtmfResult(MessageParcel &data, MessageParcel &reply)
679 {
680     int32_t error = TELEPHONY_ERR_FAIL;
681     int32_t result = TELEPHONY_ERR_FAIL;
682     if (!data.ContainFileDescriptors()) {
683         TELEPHONY_LOGW("sent raw data is less than 32k");
684     }
685     result = data.ReadInt32();
686     error = StopDtmfResult(result);
687     if (!reply.WriteInt32(error)) {
688         TELEPHONY_LOGE("writing parcel failed");
689         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
690     }
691     return TELEPHONY_SUCCESS;
692 }
693 
OnSendUssdResult(MessageParcel & data,MessageParcel & reply)694 int32_t CallStatusCallbackStub::OnSendUssdResult(MessageParcel &data, MessageParcel &reply)
695 {
696     int32_t error = TELEPHONY_ERR_FAIL;
697     int32_t result = TELEPHONY_ERR_FAIL;
698     if (!data.ContainFileDescriptors()) {
699         TELEPHONY_LOGW("sent raw data is less than 32k");
700     }
701     result = data.ReadInt32();
702     error = SendUssdResult(result);
703     if (!reply.WriteInt32(error)) {
704         TELEPHONY_LOGE("writing parcel failed");
705         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
706     }
707     return TELEPHONY_SUCCESS;
708 }
709 
OnSendMmiCodeResult(MessageParcel & data,MessageParcel & reply)710 int32_t CallStatusCallbackStub::OnSendMmiCodeResult(MessageParcel &data, MessageParcel &reply)
711 {
712     int32_t result = TELEPHONY_ERR_FAIL;
713     const MmiCodeInfo *parcelPtr = nullptr;
714     if (!data.ContainFileDescriptors()) {
715         TELEPHONY_LOGW("sent raw data is less than 32k");
716     }
717     int32_t len = data.ReadInt32();
718     if (len <= 0 || len >= MAX_LEN) {
719         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
720         return TELEPHONY_ERR_ARGUMENT_INVALID;
721     }
722     if ((parcelPtr = reinterpret_cast<const MmiCodeInfo *>(data.ReadRawData(len))) == nullptr) {
723         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
724         return TELEPHONY_ERR_LOCAL_PTR_NULL;
725     }
726 
727     result = SendMmiCodeResult(*parcelPtr);
728     if (!reply.WriteInt32(result)) {
729         TELEPHONY_LOGE("writing parcel failed");
730         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
731     }
732     return TELEPHONY_SUCCESS;
733 }
734 
OnGetImsCallDataResult(MessageParcel & data,MessageParcel & reply)735 int32_t CallStatusCallbackStub::OnGetImsCallDataResult(MessageParcel &data, MessageParcel &reply)
736 {
737     int32_t error = TELEPHONY_ERR_FAIL;
738     int32_t result = TELEPHONY_ERR_FAIL;
739     if (!data.ContainFileDescriptors()) {
740         TELEPHONY_LOGW("sent raw data is less than 32k");
741     }
742     result = data.ReadInt32();
743     error = GetImsCallDataResult(result);
744     if (!reply.WriteInt32(error)) {
745         TELEPHONY_LOGE("writing parcel failed");
746         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
747     }
748     return TELEPHONY_SUCCESS;
749 }
750 
OnCloseUnFinishedUssdResult(MessageParcel & data,MessageParcel & reply)751 int32_t CallStatusCallbackStub::OnCloseUnFinishedUssdResult(MessageParcel &data, MessageParcel &reply)
752 {
753     int32_t error = TELEPHONY_ERR_FAIL;
754     int32_t result = TELEPHONY_ERR_FAIL;
755     if (!data.ContainFileDescriptors()) {
756         TELEPHONY_LOGW("sent raw data is less than 32k");
757     }
758     result = data.ReadInt32();
759     error = CloseUnFinishedUssdResult(result);
760     if (!reply.WriteInt32(error)) {
761         TELEPHONY_LOGE("writing parcel failed");
762         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
763     }
764     return TELEPHONY_SUCCESS;
765 }
766 
OnPostDialNextChar(MessageParcel & data,MessageParcel & reply)767 int32_t CallStatusCallbackStub::OnPostDialNextChar(MessageParcel &data, MessageParcel &reply)
768 {
769     int32_t error = TELEPHONY_ERR_FAIL;
770     if (!data.ContainFileDescriptors()) {
771         TELEPHONY_LOGW("sent raw data is less than 32k");
772     }
773     std::string c = data.ReadString();
774     error = ReportPostDialChar(c);
775     if (!reply.WriteInt32(error)) {
776         TELEPHONY_LOGE("writing parcel failed");
777         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
778     }
779     return TELEPHONY_SUCCESS;
780 }
781 
OnReportPostDialDelay(MessageParcel & data,MessageParcel & reply)782 int32_t CallStatusCallbackStub::OnReportPostDialDelay(MessageParcel &data, MessageParcel &reply)
783 {
784     int32_t error = TELEPHONY_ERR_FAIL;
785     if (!data.ContainFileDescriptors()) {
786         TELEPHONY_LOGW("sent raw data is less than 32k");
787     }
788     std::string remainPostDial = data.ReadString();
789     error = ReportPostDialDelay(remainPostDial);
790     if (!reply.WriteInt32(error)) {
791         TELEPHONY_LOGE("writing parcel failed");
792         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
793     }
794     return TELEPHONY_SUCCESS;
795 }
796 
OnCallSessionEventChange(MessageParcel & data,MessageParcel & reply)797 int32_t CallStatusCallbackStub::OnCallSessionEventChange(MessageParcel &data, MessageParcel &reply)
798 {
799     int32_t error = TELEPHONY_ERR_FAIL;
800     if (!data.ContainFileDescriptors()) {
801         TELEPHONY_LOGW("sent raw data is less than 32k");
802     }
803     const CallSessionReportInfo *parcelPtr = nullptr;
804     int32_t len = data.ReadInt32();
805     if (len <= 0 || len >= MAX_LEN) {
806         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
807         return TELEPHONY_ERR_ARGUMENT_INVALID;
808     }
809     if ((parcelPtr = reinterpret_cast<const CallSessionReportInfo *>(data.ReadRawData(len))) == nullptr) {
810         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
811         return TELEPHONY_ERR_LOCAL_PTR_NULL;
812     }
813     error = HandleCallSessionEventChanged(*parcelPtr);
814     if (!reply.WriteInt32(error)) {
815         TELEPHONY_LOGE("writing parcel failed");
816         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
817     }
818     return TELEPHONY_SUCCESS;
819 }
820 
OnPeerDimensionsChange(MessageParcel & data,MessageParcel & reply)821 int32_t CallStatusCallbackStub::OnPeerDimensionsChange(MessageParcel &data, MessageParcel &reply)
822 {
823     int32_t error = TELEPHONY_ERR_FAIL;
824     if (!data.ContainFileDescriptors()) {
825         TELEPHONY_LOGW("sent raw data is less than 32k");
826     }
827     const PeerDimensionsReportInfo *parcelPtr = nullptr;
828     int32_t len = data.ReadInt32();
829     if (len <= 0 || len >= MAX_LEN) {
830         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
831         return TELEPHONY_ERR_ARGUMENT_INVALID;
832     }
833     if ((parcelPtr = reinterpret_cast<const PeerDimensionsReportInfo *>(data.ReadRawData(len))) == nullptr) {
834         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
835         return TELEPHONY_ERR_LOCAL_PTR_NULL;
836     }
837     error = HandlePeerDimensionsChanged(*parcelPtr);
838     if (!reply.WriteInt32(error)) {
839         TELEPHONY_LOGE("writing parcel failed");
840         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
841     }
842     return TELEPHONY_SUCCESS;
843 }
844 
OnCallDataUsageChange(MessageParcel & data,MessageParcel & reply)845 int32_t CallStatusCallbackStub::OnCallDataUsageChange(MessageParcel &data, MessageParcel &reply)
846 {
847     int32_t error = TELEPHONY_ERR_FAIL;
848     if (!data.ContainFileDescriptors()) {
849         TELEPHONY_LOGW("sent raw data is less than 32k");
850     }
851     int64_t result = data.ReadInt64();
852     error = HandleCallDataUsageChanged(result);
853     if (!reply.WriteInt32(error)) {
854         TELEPHONY_LOGE("writing parcel failed");
855         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
856     }
857     return TELEPHONY_SUCCESS;
858 }
859 
OnCameraCapabilitiesChange(MessageParcel & data,MessageParcel & reply)860 int32_t CallStatusCallbackStub::OnCameraCapabilitiesChange(MessageParcel &data, MessageParcel &reply)
861 {
862     int32_t error = TELEPHONY_ERR_FAIL;
863     if (!data.ContainFileDescriptors()) {
864         TELEPHONY_LOGW("sent raw data is less than 32k");
865     }
866     const CameraCapabilitiesReportInfo *parcelPtr = nullptr;
867     int32_t len = data.ReadInt32();
868     if (len <= 0 || len >= MAX_LEN) {
869         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
870         return TELEPHONY_ERR_ARGUMENT_INVALID;
871     }
872     if ((parcelPtr = reinterpret_cast<const CameraCapabilitiesReportInfo *>(data.ReadRawData(len))) == nullptr) {
873         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
874         return TELEPHONY_ERR_LOCAL_PTR_NULL;
875     }
876     error = HandleCameraCapabilitiesChanged(*parcelPtr);
877     if (!reply.WriteInt32(error)) {
878         TELEPHONY_LOGE("writing parcel failed");
879         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
880     }
881     return TELEPHONY_SUCCESS;
882 }
883 
OnUpdateVoipEventInfo(MessageParcel & data,MessageParcel & reply)884 int32_t CallStatusCallbackStub::OnUpdateVoipEventInfo(MessageParcel &data, MessageParcel &reply)
885 {
886     int32_t error = TELEPHONY_ERR_FAIL;
887     if (!data.ContainFileDescriptors()) {
888         TELEPHONY_LOGW("sent raw data is less than 32k");
889     }
890     VoipCallEventInfo parcelPtr;
891     parcelPtr.voipCallId = data.ReadString();
892     parcelPtr.bundleName = data.ReadString();
893     parcelPtr.uid = data.ReadInt32();
894     parcelPtr.voipCallEvent = static_cast<VoipCallEvent>(data.ReadInt32());
895     parcelPtr.errorReason = static_cast<ErrorReason>(data.ReadInt32());
896     error = UpdateVoipEventInfo(parcelPtr);
897     if (!reply.WriteInt32(error)) {
898         TELEPHONY_LOGE("writing parcel failed");
899         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
900     }
901     return TELEPHONY_SUCCESS;
902 }
903 } // namespace Telephony
904 } // namespace OHOS
905