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