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