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