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