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_proxy.h"
17 #include "call_manager_errors.h"
18 #include "telephony_log_wrapper.h"
19 
20 namespace OHOS {
21 namespace Telephony {
22 constexpr int32_t MAX_SIZE = 10;
23 
Dial(const CellularCallInfo & callInfo)24 int32_t CellularCallProxy::Dial(const CellularCallInfo &callInfo)
25 {
26     MessageOption option;
27     MessageParcel in;
28     MessageParcel out;
29     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
30         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
31     }
32     if (!in.WriteInt32(MAX_SIZE)) {
33         return TELEPHONY_ERR_WRITE_DATA_FAIL;
34     }
35     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
36         return TELEPHONY_ERR_WRITE_DATA_FAIL;
37     }
38     auto remote = Remote();
39     if (remote == nullptr) {
40         TELEPHONY_LOGE("function Remote() return nullptr!");
41         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
42     }
43     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::DIAL), in, out, option);
44     if (error == ERR_NONE) {
45         return out.ReadInt32();
46     }
47     return error;
48 }
49 
HangUp(const CellularCallInfo & callInfo,CallSupplementType type)50 int32_t CellularCallProxy::HangUp(const CellularCallInfo &callInfo, CallSupplementType type)
51 {
52     MessageOption option;
53     MessageParcel in;
54     MessageParcel out;
55     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
56         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
57     }
58     if (!in.WriteInt32(MAX_SIZE)) {
59         return TELEPHONY_ERR_WRITE_DATA_FAIL;
60     }
61     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
62         return TELEPHONY_ERR_WRITE_DATA_FAIL;
63     }
64     if (!in.WriteInt32((int32_t)type)) {
65         return TELEPHONY_ERR_WRITE_DATA_FAIL;
66     }
67     auto remote = Remote();
68     if (remote == nullptr) {
69         TELEPHONY_LOGE("function Remote() return nullptr!");
70         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
71     }
72     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::HANG_UP), in, out, option);
73     if (error == ERR_NONE) {
74         return out.ReadInt32();
75     }
76     return error;
77 }
78 
Reject(const CellularCallInfo & callInfo)79 int32_t CellularCallProxy::Reject(const CellularCallInfo &callInfo)
80 {
81     MessageOption option;
82     MessageParcel in;
83     MessageParcel out;
84     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
85         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
86     }
87     if (!in.WriteInt32(MAX_SIZE)) {
88         return TELEPHONY_ERR_WRITE_DATA_FAIL;
89     }
90     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
91         return TELEPHONY_ERR_WRITE_DATA_FAIL;
92     }
93     auto remote = Remote();
94     if (remote == nullptr) {
95         TELEPHONY_LOGE("function Remote() return nullptr!");
96         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
97     }
98     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::REJECT), in, out, option);
99     if (error == ERR_NONE) {
100         return out.ReadInt32();
101     }
102     return error;
103 }
104 
Answer(const CellularCallInfo & callInfo)105 int32_t CellularCallProxy::Answer(const CellularCallInfo &callInfo)
106 {
107     MessageOption option;
108     MessageParcel in;
109     MessageParcel out;
110     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
111         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
112     }
113     if (!in.WriteInt32(MAX_SIZE)) {
114         return TELEPHONY_ERR_WRITE_DATA_FAIL;
115     }
116     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
117         return TELEPHONY_ERR_WRITE_DATA_FAIL;
118     }
119     auto remote = Remote();
120     if (remote == nullptr) {
121         TELEPHONY_LOGE("function Remote() return nullptr!");
122         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
123     }
124     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::ANSWER), in, out, option);
125     if (error == ERR_NONE) {
126         return out.ReadInt32();
127     }
128     return error;
129 }
130 
HoldCall(const CellularCallInfo & callInfo)131 int32_t CellularCallProxy::HoldCall(const CellularCallInfo &callInfo)
132 {
133     MessageOption option;
134     MessageParcel in;
135     MessageParcel out;
136     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
137         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
138     }
139     if (!in.WriteInt32(MAX_SIZE)) {
140         return TELEPHONY_ERR_WRITE_DATA_FAIL;
141     }
142     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
143         return TELEPHONY_ERR_WRITE_DATA_FAIL;
144     }
145     auto remote = Remote();
146     if (remote == nullptr) {
147         TELEPHONY_LOGE("function Remote() return nullptr!");
148         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
149     }
150     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::HOLD_CALL), in, out, option);
151     if (error == ERR_NONE) {
152         return out.ReadInt32();
153     }
154     return error;
155 }
156 
UnHoldCall(const CellularCallInfo & callInfo)157 int32_t CellularCallProxy::UnHoldCall(const CellularCallInfo &callInfo)
158 {
159     MessageOption option;
160     MessageParcel in;
161     MessageParcel out;
162     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
163         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
164     }
165     if (!in.WriteInt32(MAX_SIZE)) {
166         return TELEPHONY_ERR_WRITE_DATA_FAIL;
167     }
168     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
169         return TELEPHONY_ERR_WRITE_DATA_FAIL;
170     }
171     auto remote = Remote();
172     if (remote == nullptr) {
173         TELEPHONY_LOGE("function Remote() return nullptr!");
174         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
175     }
176     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::UN_HOLD_CALL), in,
177         out, option);
178     if (error == ERR_NONE) {
179         return out.ReadInt32();
180     }
181     return error;
182 }
183 
SwitchCall(const CellularCallInfo & callInfo)184 int32_t CellularCallProxy::SwitchCall(const CellularCallInfo &callInfo)
185 {
186     MessageOption option;
187     MessageParcel in;
188     MessageParcel out;
189     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
190         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
191     }
192     if (!in.WriteInt32(MAX_SIZE)) {
193         return TELEPHONY_ERR_WRITE_DATA_FAIL;
194     }
195     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
196         return TELEPHONY_ERR_WRITE_DATA_FAIL;
197     }
198     auto remote = Remote();
199     if (remote == nullptr) {
200         TELEPHONY_LOGE("function Remote() return nullptr!");
201         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
202     }
203     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SWITCH_CALL), in, out, option);
204     if (error == ERR_NONE) {
205         return out.ReadInt32();
206     }
207     return error;
208 }
209 
RegisterCallManagerCallBack(const sptr<ICallStatusCallback> & callback)210 int32_t CellularCallProxy::RegisterCallManagerCallBack(const sptr<ICallStatusCallback> &callback)
211 {
212     if (callback == nullptr) {
213         return TELEPHONY_ERR_ARGUMENT_INVALID;
214     }
215 
216     MessageOption option;
217     MessageParcel in;
218     MessageParcel out;
219     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
220         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
221     }
222     if (!in.WriteInt32(MAX_SIZE)) {
223         return TELEPHONY_ERR_WRITE_DATA_FAIL;
224     }
225     if (!in.WriteRemoteObject(callback->AsObject().GetRefPtr())) {
226         return TELEPHONY_ERR_WRITE_DATA_FAIL;
227     }
228     auto remote = Remote();
229     if (remote == nullptr) {
230         TELEPHONY_LOGE("function Remote() return nullptr!");
231         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
232     }
233     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::REGISTER_CALLBACK), in,
234         out, option);
235     if (error == ERR_NONE) {
236         return out.ReadInt32();
237     }
238     return error;
239 }
240 
UnRegisterCallManagerCallBack()241 int32_t CellularCallProxy::UnRegisterCallManagerCallBack()
242 {
243     MessageOption option;
244     MessageParcel in;
245     MessageParcel out;
246     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
247         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
248     }
249     if (!in.WriteInt32(MAX_SIZE)) {
250         return TELEPHONY_ERR_WRITE_DATA_FAIL;
251     }
252     auto remote = Remote();
253     if (remote == nullptr) {
254         TELEPHONY_LOGE("function Remote() return nullptr!");
255         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
256     }
257     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::UNREGISTER_CALLBACK), in,
258         out, option);
259     if (error == ERR_NONE) {
260         return out.ReadInt32();
261     }
262     return error;
263 }
264 
IsEmergencyPhoneNumber(int32_t slotId,const std::string & phoneNum,bool & enabled)265 int32_t CellularCallProxy::IsEmergencyPhoneNumber(int32_t slotId, const std::string &phoneNum, bool &enabled)
266 {
267     MessageOption option;
268     MessageParcel in;
269     MessageParcel out;
270     int32_t result = TELEPHONY_SUCCESS;
271     result = SetCommonParamForMessageParcel(slotId, in);
272     if (result != TELEPHONY_SUCCESS) {
273         return result;
274     }
275     if (!in.WriteString(phoneNum)) {
276         return TELEPHONY_ERR_WRITE_DATA_FAIL;
277     }
278     auto remote = Remote();
279     if (remote == nullptr) {
280         TELEPHONY_LOGE("function Remote() return nullptr!");
281         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
282     }
283     int32_t ret = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::EMERGENCY_CALL), in,
284         out, option);
285     if (ret != TELEPHONY_SUCCESS) {
286         TELEPHONY_LOGE("Function FormatPhoneNumberToE164 call failed! errCode:%{public}d", ret);
287         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
288     }
289     result = out.ReadInt32();
290     if (result == TELEPHONY_SUCCESS) {
291         enabled = out.ReadBool();
292     }
293     return result;
294 }
295 
CombineConference(const CellularCallInfo & callInfo)296 int32_t CellularCallProxy::CombineConference(const CellularCallInfo &callInfo)
297 {
298     MessageOption option;
299     MessageParcel in;
300     MessageParcel out;
301     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
302         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
303     }
304     if (!in.WriteInt32(MAX_SIZE)) {
305         return TELEPHONY_ERR_WRITE_DATA_FAIL;
306     }
307     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
308         return TELEPHONY_ERR_WRITE_DATA_FAIL;
309     }
310     auto remote = Remote();
311     if (remote == nullptr) {
312         TELEPHONY_LOGE("function Remote() return nullptr!");
313         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
314     }
315     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::COMBINE_CONFERENCE), in,
316         out, option);
317     if (error == ERR_NONE) {
318         return out.ReadInt32();
319     }
320     return error;
321 }
322 
SeparateConference(const CellularCallInfo & callInfo)323 int32_t CellularCallProxy::SeparateConference(const CellularCallInfo &callInfo)
324 {
325     MessageOption option;
326     MessageParcel in;
327     MessageParcel out;
328     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
329         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
330     }
331     if (!in.WriteInt32(MAX_SIZE)) {
332         return TELEPHONY_ERR_WRITE_DATA_FAIL;
333     }
334     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
335         return TELEPHONY_ERR_WRITE_DATA_FAIL;
336     }
337     auto remote = Remote();
338     if (remote == nullptr) {
339         TELEPHONY_LOGE("function Remote() return nullptr!");
340         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
341     }
342     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SEPARATE_CONFERENCE), in,
343         out, option);
344     if (error == ERR_NONE) {
345         return out.ReadInt32();
346     }
347     return error;
348 }
349 
InviteToConference(int32_t slotId,const std::vector<std::string> & numberList)350 int32_t CellularCallProxy::InviteToConference(int32_t slotId, const std::vector<std::string> &numberList)
351 {
352     MessageOption option;
353     MessageParcel in;
354     MessageParcel out;
355     int32_t result = TELEPHONY_SUCCESS;
356     result = SetCommonParamForMessageParcel(slotId, in);
357     if (result != TELEPHONY_SUCCESS) {
358         return result;
359     }
360     if (!in.WriteStringVector(numberList)) {
361         return TELEPHONY_ERR_WRITE_DATA_FAIL;
362     }
363     auto remote = Remote();
364     if (remote == nullptr) {
365         TELEPHONY_LOGE("function Remote() return nullptr!");
366         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
367     }
368     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::INVITE_TO_CONFERENCE), in,
369         out, option);
370     if (error == ERR_NONE) {
371         return out.ReadInt32();
372     }
373     return error;
374 }
375 
KickOutFromConference(const CellularCallInfo & callInfo)376 int32_t CellularCallProxy::KickOutFromConference(const CellularCallInfo &callInfo)
377 {
378     MessageOption option;
379     MessageParcel in;
380     MessageParcel out;
381     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
382         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
383     }
384     if (!in.WriteInt32(MAX_SIZE)) {
385         return TELEPHONY_ERR_WRITE_DATA_FAIL;
386     }
387     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
388         return TELEPHONY_ERR_WRITE_DATA_FAIL;
389     }
390     auto remote = Remote();
391     if (remote == nullptr) {
392         TELEPHONY_LOGE("function Remote() return nullptr!");
393         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
394     }
395     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::KICK_OUT_CONFERENCE), in,
396         out, option);
397     if (error == ERR_NONE) {
398         return out.ReadInt32();
399     }
400     return error;
401 }
402 
HangUpAllConnection()403 int32_t CellularCallProxy::HangUpAllConnection()
404 {
405     MessageOption option;
406     MessageParcel in;
407     MessageParcel out;
408     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
409         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
410     }
411     if (!in.WriteInt32(MAX_SIZE)) {
412         return TELEPHONY_ERR_WRITE_DATA_FAIL;
413     }
414     auto remote = Remote();
415     if (remote == nullptr) {
416         TELEPHONY_LOGE("function Remote() return nullptr!");
417         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
418     }
419     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::HANG_UP_ALL_CONNECTION), in,
420         out, option);
421     if (error == ERR_NONE) {
422         return out.ReadInt32();
423     }
424     return error;
425 }
426 
SetReadyToCall(int32_t slotId,int32_t callType,bool isReadyToCall)427 int32_t CellularCallProxy::SetReadyToCall(int32_t slotId, int32_t callType, bool isReadyToCall)
428 {
429     MessageOption option;
430     MessageParcel in;
431     MessageParcel out;
432     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
433         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
434     }
435     if (!in.WriteInt32(slotId)) {
436         return TELEPHONY_ERR_WRITE_DATA_FAIL;
437     }
438     if (!in.WriteInt32(callType)) {
439         return TELEPHONY_ERR_WRITE_DATA_FAIL;
440     }
441     if (!in.WriteBool(isReadyToCall)) {
442         return TELEPHONY_ERR_WRITE_DATA_FAIL;
443     }
444     auto remote = Remote();
445     if (remote == nullptr) {
446         TELEPHONY_LOGE("[slot%{public}d] function Remote() return nullptr!", slotId);
447         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
448     }
449     int32_t error =
450         remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_READY_TO_CALL), in, out, option);
451     if (error != ERR_NONE) {
452         TELEPHONY_LOGE("Function SetReadyToCall! errCode:%{public}d", error);
453         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
454     }
455     return out.ReadInt32();
456 }
457 
HangUpAllConnection(int32_t slotId)458 int32_t CellularCallProxy::HangUpAllConnection(int32_t slotId)
459 {
460     return TELEPHONY_ERR_SUCCESS;
461 }
462 
SendUpdateCallMediaModeRequest(const CellularCallInfo & callInfo,ImsCallMode mode)463 int32_t CellularCallProxy::SendUpdateCallMediaModeRequest(const CellularCallInfo &callInfo, ImsCallMode mode)
464 {
465     MessageOption option;
466     MessageParcel in;
467     MessageParcel out;
468     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
469         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
470     }
471     if (!in.WriteInt32(MAX_SIZE)) {
472         return TELEPHONY_ERR_WRITE_DATA_FAIL;
473     }
474     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
475         return TELEPHONY_ERR_WRITE_DATA_FAIL;
476     }
477     if (!in.WriteInt32(static_cast<int32_t>(mode))) {
478         return TELEPHONY_ERR_WRITE_DATA_FAIL;
479     }
480     auto remote = Remote();
481     if (remote == nullptr) {
482         TELEPHONY_LOGE("function Remote() return nullptr!");
483         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
484     }
485     int32_t error = remote->SendRequest(
486         static_cast<uint32_t>(CellularCallInterfaceCode::SEND_CALL_MEDIA_MODE_REQUEST), in, out, option);
487     if (error == ERR_NONE) {
488         return out.ReadInt32();
489     }
490     return error;
491 }
492 
SendUpdateCallMediaModeResponse(const CellularCallInfo & callInfo,ImsCallMode mode)493 int32_t CellularCallProxy::SendUpdateCallMediaModeResponse(const CellularCallInfo &callInfo, ImsCallMode mode)
494 {
495     MessageOption option;
496     MessageParcel in;
497     MessageParcel out;
498     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
499         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
500     }
501     if (!in.WriteInt32(MAX_SIZE)) {
502         return TELEPHONY_ERR_WRITE_DATA_FAIL;
503     }
504     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
505         return TELEPHONY_ERR_WRITE_DATA_FAIL;
506     }
507     if (!in.WriteInt32(static_cast<int32_t>(mode))) {
508         return TELEPHONY_ERR_WRITE_DATA_FAIL;
509     }
510     auto remote = Remote();
511     if (remote == nullptr) {
512         TELEPHONY_LOGE("function Remote() return nullptr!");
513         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
514     }
515     int32_t error = remote->SendRequest(
516         static_cast<uint32_t>(CellularCallInterfaceCode::SEND_CALL_MEDIA_MODE_RESPONSE), in, out, option);
517     if (error == ERR_NONE) {
518         return out.ReadInt32();
519     }
520     return error;
521 }
522 
StartDtmf(char cDtmfCode,const CellularCallInfo & callInfo)523 int32_t CellularCallProxy::StartDtmf(char cDtmfCode, const CellularCallInfo &callInfo)
524 {
525     MessageOption option;
526     MessageParcel in;
527     MessageParcel out;
528     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
529         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
530     }
531     if (!in.WriteInt32(MAX_SIZE)) {
532         return TELEPHONY_ERR_WRITE_DATA_FAIL;
533     }
534     if (!in.WriteInt8(cDtmfCode)) {
535         return TELEPHONY_ERR_WRITE_DATA_FAIL;
536     }
537     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
538         return TELEPHONY_ERR_WRITE_DATA_FAIL;
539     }
540     auto remote = Remote();
541     if (remote == nullptr) {
542         TELEPHONY_LOGE("function Remote() return nullptr!");
543         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
544     }
545     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::START_DTMF), in, out, option);
546     if (error == ERR_NONE) {
547         return out.ReadInt32();
548     }
549     return error;
550 }
551 
StopDtmf(const CellularCallInfo & callInfo)552 int32_t CellularCallProxy::StopDtmf(const CellularCallInfo &callInfo)
553 {
554     MessageOption option;
555     MessageParcel in;
556     MessageParcel out;
557     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
558         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
559     }
560     if (!in.WriteInt32(MAX_SIZE)) {
561         return TELEPHONY_ERR_WRITE_DATA_FAIL;
562     }
563     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
564         return TELEPHONY_ERR_WRITE_DATA_FAIL;
565     }
566     auto remote = Remote();
567     if (remote == nullptr) {
568         TELEPHONY_LOGE("function Remote() return nullptr!");
569         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
570     }
571     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::STOP_DTMF), in, out, option);
572     if (error == ERR_NONE) {
573         return out.ReadInt32();
574     }
575     return error;
576 }
577 
PostDialProceed(const CellularCallInfo & callInfo,const bool proceed)578 int32_t CellularCallProxy::PostDialProceed(const CellularCallInfo &callInfo, const bool proceed)
579 {
580     MessageOption option;
581     MessageParcel in;
582     MessageParcel out;
583     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
584         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
585     }
586     if (!in.WriteInt32(MAX_SIZE)) {
587         TELEPHONY_LOGE("WriteInt32 fail!");
588         return TELEPHONY_ERR_WRITE_DATA_FAIL;
589     }
590     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
591         TELEPHONY_LOGE("WriteRawData fail!");
592         return TELEPHONY_ERR_WRITE_DATA_FAIL;
593     }
594     if (!in.WriteBool(proceed)) {
595         TELEPHONY_LOGE("WriteBool fail!");
596         return TELEPHONY_ERR_WRITE_DATA_FAIL;
597     }
598     auto remote = Remote();
599     if (remote == nullptr) {
600         TELEPHONY_LOGE("function Remote() return nullptr!");
601         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
602     }
603     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::POST_DIAL_PROCEED),
604         in, out, option);
605     if (error == ERR_NONE) {
606         return out.ReadInt32();
607     }
608     return error;
609 }
610 
SendDtmf(char cDtmfCode,const CellularCallInfo & callInfo)611 int32_t CellularCallProxy::SendDtmf(char cDtmfCode, const CellularCallInfo &callInfo)
612 {
613     MessageOption option;
614     MessageParcel in;
615     MessageParcel out;
616     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
617         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
618     }
619     if (!in.WriteInt32(MAX_SIZE)) {
620         return TELEPHONY_ERR_WRITE_DATA_FAIL;
621     }
622     if (!in.WriteInt8(cDtmfCode)) {
623         return TELEPHONY_ERR_WRITE_DATA_FAIL;
624     }
625     if (!in.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo))) {
626         return TELEPHONY_ERR_WRITE_DATA_FAIL;
627     }
628     auto remote = Remote();
629     if (remote == nullptr) {
630         TELEPHONY_LOGE("function Remote() return nullptr!");
631         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
632     }
633     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SEND_DTMF), in, out, option);
634     if (error == ERR_NONE) {
635         return out.ReadInt32();
636     }
637     return error;
638 }
639 
StartRtt(int32_t slotId,const std::string & msg)640 int32_t CellularCallProxy::StartRtt(int32_t slotId, const std::string &msg)
641 {
642     MessageOption option;
643     MessageParcel in;
644     MessageParcel out;
645     int32_t result = TELEPHONY_SUCCESS;
646     result = SetCommonParamForMessageParcel(slotId, in);
647     if (result != TELEPHONY_SUCCESS) {
648         return result;
649     }
650     if (!in.WriteString(msg)) {
651         return TELEPHONY_ERR_WRITE_DATA_FAIL;
652     }
653     auto remote = Remote();
654     if (remote == nullptr) {
655         TELEPHONY_LOGE("function Remote() return nullptr!");
656         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
657     }
658     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::START_RTT), in, out, option);
659     if (error == ERR_NONE) {
660         return out.ReadInt32();
661     }
662     return error;
663 }
664 
StopRtt(int32_t slotId)665 int32_t CellularCallProxy::StopRtt(int32_t slotId)
666 {
667     MessageOption option;
668     MessageParcel in;
669     MessageParcel out;
670     int32_t result = TELEPHONY_SUCCESS;
671     result = SetCommonParamForMessageParcel(slotId, in);
672     if (result != TELEPHONY_SUCCESS) {
673         return result;
674     }
675     auto remote = Remote();
676     if (remote == nullptr) {
677         TELEPHONY_LOGE("function Remote() return nullptr!");
678         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
679     }
680     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::STOP_RTT), in, out, option);
681     if (error == ERR_NONE) {
682         return out.ReadInt32();
683     }
684     return error;
685 }
686 
SetCallTransferInfo(int32_t slotId,const CallTransferInfo & ctInfo)687 int32_t CellularCallProxy::SetCallTransferInfo(int32_t slotId, const CallTransferInfo &ctInfo)
688 {
689     MessageOption option;
690     MessageParcel in;
691     MessageParcel out;
692     int32_t result = TELEPHONY_SUCCESS;
693     result = SetCommonParamForMessageParcel(slotId, in);
694     if (result != TELEPHONY_SUCCESS) {
695         return result;
696     }
697     if (!in.WriteRawData((const void *)&ctInfo, sizeof(CallTransferInfo))) {
698         return TELEPHONY_ERR_WRITE_DATA_FAIL;
699     }
700     auto remote = Remote();
701     if (remote == nullptr) {
702         TELEPHONY_LOGE("function Remote() return nullptr!");
703         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
704     }
705     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_CALL_TRANSFER), in,
706         out, option);
707     if (error == ERR_NONE) {
708         return out.ReadInt32();
709     }
710     return error;
711 }
712 
CanSetCallTransferTime(int32_t slotId,bool & result)713 int32_t CellularCallProxy::CanSetCallTransferTime(int32_t slotId, bool &result)
714 {
715     MessageOption option;
716     MessageParcel in;
717     MessageParcel out;
718     int32_t ret = TELEPHONY_SUCCESS;
719     ret = SetCommonParamForMessageParcel(slotId, in);
720     if (ret != TELEPHONY_SUCCESS) {
721         return ret;
722     }
723     if (!in.WriteBool(result)) {
724         return TELEPHONY_ERR_WRITE_DATA_FAIL;
725     }
726     auto remote = Remote();
727     if (remote == nullptr) {
728         TELEPHONY_LOGE("[slot%{public}d] function Remote() return nullptr!", slotId);
729         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
730     }
731     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::CAN_SET_CALL_TRANSFER_TIME),
732         in, out, option);
733     if (error == ERR_NONE) {
734         result = out.ReadBool();
735         return out.ReadInt32();
736     }
737 
738     return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
739 }
740 
GetCallTransferInfo(int32_t slotId,CallTransferType type)741 int32_t CellularCallProxy::GetCallTransferInfo(int32_t slotId, CallTransferType type)
742 {
743     MessageOption option;
744     MessageParcel in;
745     MessageParcel out;
746     int32_t result = TELEPHONY_SUCCESS;
747     result = SetCommonParamForMessageParcel(slotId, in);
748     if (result != TELEPHONY_SUCCESS) {
749         return result;
750     }
751     if (!in.WriteInt32((int32_t)type)) {
752         return TELEPHONY_ERR_WRITE_DATA_FAIL;
753     }
754     auto remote = Remote();
755     if (remote == nullptr) {
756         TELEPHONY_LOGE("function Remote() return nullptr!");
757         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
758     }
759     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_CALL_TRANSFER), in,
760         out, option);
761     if (error == ERR_NONE) {
762         return out.ReadInt32();
763     }
764     return error;
765 }
766 
SetCallWaiting(int32_t slotId,bool activate)767 int32_t CellularCallProxy::SetCallWaiting(int32_t slotId, bool activate)
768 {
769     MessageOption option;
770     MessageParcel in;
771     MessageParcel out;
772     int32_t result = TELEPHONY_SUCCESS;
773     result = SetCommonParamForMessageParcel(slotId, in);
774     if (result != TELEPHONY_SUCCESS) {
775         return result;
776     }
777     if (!in.WriteBool(activate)) {
778         return TELEPHONY_ERR_WRITE_DATA_FAIL;
779     }
780     auto remote = Remote();
781     if (remote == nullptr) {
782         TELEPHONY_LOGE("function Remote() return nullptr!");
783         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
784     }
785     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_CALL_WAITING), in,
786         out, option);
787     if (error == ERR_NONE) {
788         return out.ReadInt32();
789     }
790     return error;
791 }
792 
GetCallWaiting(int32_t slotId)793 int32_t CellularCallProxy::GetCallWaiting(int32_t slotId)
794 {
795     MessageOption option;
796     MessageParcel in;
797     MessageParcel out;
798     int32_t result = TELEPHONY_SUCCESS;
799     result = SetCommonParamForMessageParcel(slotId, in);
800     if (result != TELEPHONY_SUCCESS) {
801         return result;
802     }
803     auto remote = Remote();
804     if (remote == nullptr) {
805         TELEPHONY_LOGE("function Remote() return nullptr!");
806         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
807     }
808     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_CALL_WAITING), in,
809         out, option);
810     if (error == ERR_NONE) {
811         return out.ReadInt32();
812     }
813     return error;
814 }
815 
SetCallRestriction(int32_t slotId,const CallRestrictionInfo & crInfo)816 int32_t CellularCallProxy::SetCallRestriction(int32_t slotId, const CallRestrictionInfo &crInfo)
817 {
818     MessageOption option;
819     MessageParcel in;
820     MessageParcel out;
821     int32_t result = TELEPHONY_SUCCESS;
822     result = SetCommonParamForMessageParcel(slotId, in);
823     if (result != TELEPHONY_SUCCESS) {
824         return result;
825     }
826     if (!in.WriteRawData((const void *)&crInfo, sizeof(CallRestrictionInfo))) {
827         return TELEPHONY_ERR_WRITE_DATA_FAIL;
828     }
829     auto remote = Remote();
830     if (remote == nullptr) {
831         TELEPHONY_LOGE("function Remote() return nullptr!");
832         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
833     }
834     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_CALL_RESTRICTION), in,
835         out, option);
836     if (error == ERR_NONE) {
837         return out.ReadInt32();
838     }
839     return error;
840 }
841 
GetCallRestriction(int32_t slotId,CallRestrictionType facType)842 int32_t CellularCallProxy::GetCallRestriction(int32_t slotId, CallRestrictionType facType)
843 {
844     MessageOption option;
845     MessageParcel in;
846     MessageParcel out;
847     int32_t result = TELEPHONY_SUCCESS;
848     result = SetCommonParamForMessageParcel(slotId, in);
849     if (result != TELEPHONY_SUCCESS) {
850         return result;
851     }
852     if (!in.WriteInt32((int32_t)facType)) {
853         return TELEPHONY_ERR_WRITE_DATA_FAIL;
854     }
855     auto remote = Remote();
856     if (remote == nullptr) {
857         TELEPHONY_LOGE("function Remote() return nullptr!");
858         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
859     }
860     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_CALL_RESTRICTION), in,
861         out, option);
862     if (error == ERR_NONE) {
863         return out.ReadInt32();
864     }
865     return error;
866 }
867 
SetCallRestrictionPassword(int32_t slotId,CallRestrictionType fac,const char * oldPassword,const char * newPassword)868 int32_t CellularCallProxy::SetCallRestrictionPassword(
869     int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword)
870 {
871     MessageOption option;
872     MessageParcel in;
873     MessageParcel out;
874     int32_t result = TELEPHONY_SUCCESS;
875     result = SetCommonParamForMessageParcel(slotId, in);
876     if (result != TELEPHONY_SUCCESS) {
877         return result;
878     }
879     if (!in.WriteInt32(static_cast<int32_t>(fac))) {
880         return TELEPHONY_ERR_WRITE_DATA_FAIL;
881     }
882     if (!in.WriteCString(oldPassword)) {
883         return TELEPHONY_ERR_WRITE_DATA_FAIL;
884     }
885     if (!in.WriteCString(newPassword)) {
886         return TELEPHONY_ERR_WRITE_DATA_FAIL;
887     }
888     auto remote = Remote();
889     if (remote == nullptr) {
890         TELEPHONY_LOGE("function Remote() return nullptr!");
891         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
892     }
893     int32_t error = remote->SendRequest(
894         static_cast<uint32_t>(CellularCallInterfaceCode::SET_CALL_RESTRICTION_PWD), in, out, option);
895     if (error == ERR_NONE) {
896         return out.ReadInt32();
897     }
898     return error;
899 }
900 
SetDomainPreferenceMode(int32_t slotId,int32_t mode)901 int32_t CellularCallProxy::SetDomainPreferenceMode(int32_t slotId, int32_t mode)
902 {
903     MessageOption option;
904     MessageParcel in;
905     MessageParcel out;
906     int32_t result = TELEPHONY_SUCCESS;
907     result = SetCommonParamForMessageParcel(slotId, in);
908     if (result != TELEPHONY_SUCCESS) {
909         return result;
910     }
911     if (!in.WriteInt32(mode)) {
912         return TELEPHONY_ERR_WRITE_DATA_FAIL;
913     }
914     auto remote = Remote();
915     if (remote == nullptr) {
916         TELEPHONY_LOGE("function Remote() return nullptr!");
917         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
918     }
919     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_DOMAIN_PREFERENCE_MODE),
920         in, out, option);
921     if (error == ERR_NONE) {
922         return out.ReadInt32();
923     }
924     return error;
925 }
926 
GetDomainPreferenceMode(int32_t slotId)927 int32_t CellularCallProxy::GetDomainPreferenceMode(int32_t slotId)
928 {
929     MessageOption option;
930     MessageParcel in;
931     MessageParcel out;
932     int32_t result = TELEPHONY_SUCCESS;
933     result = SetCommonParamForMessageParcel(slotId, in);
934     if (result != TELEPHONY_SUCCESS) {
935         return result;
936     }
937     auto remote = Remote();
938     if (remote == nullptr) {
939         TELEPHONY_LOGE("function Remote() return nullptr!");
940         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
941     }
942     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_DOMAIN_PREFERENCE_MODE),
943         in, out, option);
944     if (error == ERR_NONE) {
945         return out.ReadInt32();
946     }
947     return error;
948 }
949 
SetImsSwitchStatus(int32_t slotId,bool active)950 int32_t CellularCallProxy::SetImsSwitchStatus(int32_t slotId, bool active)
951 {
952     MessageOption option;
953     MessageParcel in;
954     MessageParcel out;
955     int32_t result = TELEPHONY_SUCCESS;
956     result = SetCommonParamForMessageParcel(slotId, in);
957     if (result != TELEPHONY_SUCCESS) {
958         return result;
959     }
960     if (!in.WriteBool(active)) {
961         return TELEPHONY_ERR_WRITE_DATA_FAIL;
962     }
963     auto remote = Remote();
964     if (remote == nullptr) {
965         TELEPHONY_LOGE("function Remote() return nullptr!");
966         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
967     }
968     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_IMS_SWITCH_STATUS),
969         in, out, option);
970     if (error != ERR_NONE) {
971         TELEPHONY_LOGE("function SetImsSwitchStatus failed! errCode:%{public}d", error);
972         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
973     }
974     return out.ReadInt32();
975 }
976 
GetImsSwitchStatus(int32_t slotId,bool & enabled)977 int32_t CellularCallProxy::GetImsSwitchStatus(int32_t slotId, bool &enabled)
978 {
979     MessageOption option;
980     MessageParcel out;
981     MessageParcel in;
982     int32_t result = TELEPHONY_SUCCESS;
983     result = SetCommonParamForMessageParcel(slotId, in);
984     if (result != TELEPHONY_SUCCESS) {
985         return result;
986     }
987     auto remote = Remote();
988     if (remote == nullptr) {
989         TELEPHONY_LOGE("function Remote() return nullptr!");
990         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
991     }
992     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_IMS_SWITCH_STATUS),
993         in, out, option);
994     if (error != ERR_NONE) {
995         TELEPHONY_LOGE("function GetImsSwitchStatus failed! errCode:%{public}d", error);
996         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
997     }
998     enabled = out.ReadBool();
999     return out.ReadInt32();
1000 }
1001 
SetVoNRState(int32_t slotId,int32_t state)1002 int32_t CellularCallProxy::SetVoNRState(int32_t slotId, int32_t state)
1003 {
1004     MessageOption option;
1005     MessageParcel in;
1006     MessageParcel out;
1007     int32_t result = TELEPHONY_SUCCESS;
1008     result = SetCommonParamForMessageParcel(slotId, in);
1009     if (result != TELEPHONY_SUCCESS) {
1010         return result;
1011     }
1012     if (!in.WriteInt32(state)) {
1013         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1014     }
1015     auto remote = Remote();
1016     if (remote == nullptr) {
1017         TELEPHONY_LOGE("function Remote() return nullptr!");
1018         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1019     }
1020     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_VONR_SWITCH_STATUS), in,
1021         out, option);
1022     if (error != ERR_NONE) {
1023         TELEPHONY_LOGE("function SetVoNRState failed! errCode:%{public}d", error);
1024         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1025     }
1026     return out.ReadInt32();
1027 }
1028 
GetVoNRState(int32_t slotId,int32_t & state)1029 int32_t CellularCallProxy::GetVoNRState(int32_t slotId, int32_t &state)
1030 {
1031     MessageOption option;
1032     MessageParcel out;
1033     MessageParcel in;
1034     int32_t result = TELEPHONY_SUCCESS;
1035     result = SetCommonParamForMessageParcel(slotId, in);
1036     if (result != TELEPHONY_SUCCESS) {
1037         return result;
1038     }
1039     auto remote = Remote();
1040     if (remote == nullptr) {
1041         TELEPHONY_LOGE("function Remote() return nullptr!");
1042         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1043     }
1044     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_VONR_SWITCH_STATUS), in,
1045         out, option);
1046     if (error != ERR_NONE) {
1047         TELEPHONY_LOGE("function GetImsSwitchStatus failed! errCode:%{public}d", error);
1048         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1049     }
1050     state = out.ReadInt32();
1051     return out.ReadInt32();
1052 }
1053 
SetImsConfig(int32_t slotId,ImsConfigItem item,const std::string & value)1054 int32_t CellularCallProxy::SetImsConfig(int32_t slotId, ImsConfigItem item, const std::string &value)
1055 {
1056     MessageOption option;
1057     MessageParcel in;
1058     MessageParcel out;
1059     int32_t result = TELEPHONY_SUCCESS;
1060     result = SetCommonParamForMessageParcel(slotId, in);
1061     if (result != TELEPHONY_SUCCESS) {
1062         return result;
1063     }
1064     if (!in.WriteInt32(item)) {
1065         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1066     }
1067     if (!in.WriteString(value)) {
1068         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1069     }
1070     auto remote = Remote();
1071     if (remote == nullptr) {
1072         TELEPHONY_LOGE("function Remote() return nullptr!");
1073         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1074     }
1075     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_IMS_CONFIG_STRING), in,
1076         out, option);
1077     if (error == ERR_NONE) {
1078         return out.ReadInt32();
1079     }
1080     return error;
1081 }
1082 
SetImsConfig(int32_t slotId,ImsConfigItem item,int32_t value)1083 int32_t CellularCallProxy::SetImsConfig(int32_t slotId, ImsConfigItem item, int32_t value)
1084 {
1085     MessageOption option;
1086     MessageParcel in;
1087     MessageParcel out;
1088     int32_t result = TELEPHONY_SUCCESS;
1089     result = SetCommonParamForMessageParcel(slotId, in);
1090     if (result != TELEPHONY_SUCCESS) {
1091         return result;
1092     }
1093     if (!in.WriteInt32(item)) {
1094         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1095     }
1096     if (!in.WriteInt32(value)) {
1097         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1098     }
1099     auto remote = Remote();
1100     if (remote == nullptr) {
1101         TELEPHONY_LOGE("function Remote() return nullptr!");
1102         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1103     }
1104     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_IMS_CONFIG_INT), in,
1105         out, option);
1106     if (error == ERR_NONE) {
1107         return out.ReadInt32();
1108     }
1109     return error;
1110 }
1111 
GetImsConfig(int32_t slotId,ImsConfigItem item)1112 int32_t CellularCallProxy::GetImsConfig(int32_t slotId, ImsConfigItem item)
1113 {
1114     MessageOption option;
1115     MessageParcel in;
1116     MessageParcel out;
1117     int32_t result = TELEPHONY_SUCCESS;
1118     result = SetCommonParamForMessageParcel(slotId, in);
1119     if (result != TELEPHONY_SUCCESS) {
1120         return result;
1121     }
1122     if (!in.WriteInt32(item)) {
1123         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1124     }
1125     auto remote = Remote();
1126     if (remote == nullptr) {
1127         TELEPHONY_LOGE("function Remote() return nullptr!");
1128         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1129     }
1130     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_IMS_CONFIG), in,
1131         out, option);
1132     if (error == ERR_NONE) {
1133         return out.ReadInt32();
1134     }
1135     return error;
1136 }
1137 
SetImsFeatureValue(int32_t slotId,FeatureType type,int32_t value)1138 int32_t CellularCallProxy::SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value)
1139 {
1140     MessageOption option;
1141     MessageParcel in;
1142     MessageParcel out;
1143     int32_t result = TELEPHONY_SUCCESS;
1144     result = SetCommonParamForMessageParcel(slotId, in);
1145     if (result != TELEPHONY_SUCCESS) {
1146         return result;
1147     }
1148     if (!in.WriteInt32(type)) {
1149         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1150     }
1151     if (!in.WriteInt32(value)) {
1152         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1153     }
1154     auto remote = Remote();
1155     if (remote == nullptr) {
1156         TELEPHONY_LOGE("function Remote() return nullptr!");
1157         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1158     }
1159     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_IMS_FEATURE), in,
1160         out, option);
1161     if (error == ERR_NONE) {
1162         return out.ReadInt32();
1163     }
1164     return error;
1165 }
1166 
GetImsFeatureValue(int32_t slotId,FeatureType type)1167 int32_t CellularCallProxy::GetImsFeatureValue(int32_t slotId, FeatureType type)
1168 {
1169     MessageOption option;
1170     MessageParcel in;
1171     MessageParcel out;
1172     int32_t result = TELEPHONY_SUCCESS;
1173     result = SetCommonParamForMessageParcel(slotId, in);
1174     if (result != TELEPHONY_SUCCESS) {
1175         return result;
1176     }
1177     if (!in.WriteInt32(type)) {
1178         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1179     }
1180     auto remote = Remote();
1181     if (remote == nullptr) {
1182         TELEPHONY_LOGE("function Remote() return nullptr!");
1183         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1184     }
1185     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_IMS_FEATURE), in,
1186         out, option);
1187     if (error == ERR_NONE) {
1188         return out.ReadInt32();
1189     }
1190     return error;
1191 }
1192 
ControlCamera(int32_t slotId,int32_t index,const std::string & cameraId)1193 int32_t CellularCallProxy::ControlCamera(int32_t slotId, int32_t index, const std::string &cameraId)
1194 {
1195     MessageOption option;
1196     MessageParcel in;
1197     MessageParcel out;
1198     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1199         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1200     }
1201     if (!in.WriteInt32(MAX_SIZE)) {
1202         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1203     }
1204     if (!in.WriteInt32(slotId)) {
1205         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1206     }
1207     if (!in.WriteInt32(index)) {
1208         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1209     }
1210     if (!in.WriteString(cameraId)) {
1211         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1212     }
1213     auto remote = Remote();
1214     if (remote == nullptr) {
1215         TELEPHONY_LOGE("function Remote() return nullptr!");
1216         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1217     }
1218     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::CTRL_CAMERA), in, out, option);
1219     if (error == ERR_NONE) {
1220         return out.ReadInt32();
1221     }
1222     return error;
1223 }
1224 
SetPreviewWindow(int32_t slotId,int32_t index,const std::string & surfaceId,sptr<Surface> surface)1225 int32_t CellularCallProxy::SetPreviewWindow(
1226     int32_t slotId, int32_t index, const std::string &surfaceId, sptr<Surface> surface)
1227 {
1228     MessageOption option;
1229     MessageParcel in;
1230     MessageParcel out;
1231     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1232         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1233     }
1234     if (!in.WriteInt32(MAX_SIZE)) {
1235         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1236     }
1237     if (!in.WriteInt32(slotId)) {
1238         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1239     }
1240     if (!in.WriteInt32(index)) {
1241         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1242     }
1243     if (!in.WriteString(surfaceId)) {
1244         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1245     }
1246     if (surface != nullptr) {
1247         sptr<IBufferProducer> producer = surface->GetProducer();
1248         if (producer != nullptr) {
1249             in.WriteRemoteObject(producer->AsObject());
1250         }
1251     }
1252     auto remote = Remote();
1253     if (remote == nullptr) {
1254         TELEPHONY_LOGE("function Remote() return nullptr!");
1255         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1256     }
1257     int32_t error =
1258         remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_PREVIEW_WINDOW), in, out, option);
1259     if (error == ERR_NONE) {
1260         return out.ReadInt32();
1261     }
1262     return error;
1263 }
1264 
SetDisplayWindow(int32_t slotId,int32_t index,const std::string & surfaceId,sptr<Surface> surface)1265 int32_t CellularCallProxy::SetDisplayWindow(
1266     int32_t slotId, int32_t index, const std::string &surfaceId, sptr<Surface> surface)
1267 {
1268     MessageOption option;
1269     MessageParcel in;
1270     MessageParcel out;
1271     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1272         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1273     }
1274     if (!in.WriteInt32(MAX_SIZE)) {
1275         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1276     }
1277     if (!in.WriteInt32(slotId)) {
1278         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1279     }
1280     if (!in.WriteInt32(index)) {
1281         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1282     }
1283     if (!in.WriteString(surfaceId)) {
1284         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1285     }
1286     if (surface != nullptr) {
1287         sptr<IBufferProducer> producer = surface->GetProducer();
1288         if (producer != nullptr) {
1289             in.WriteRemoteObject(producer->AsObject());
1290         }
1291     }
1292     auto remote = Remote();
1293     if (remote == nullptr) {
1294         TELEPHONY_LOGE("function Remote() return nullptr!");
1295         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1296     }
1297     int32_t error =
1298         remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_DISPLAY_WINDOW), in, out, option);
1299     if (error == ERR_NONE) {
1300         return out.ReadInt32();
1301     }
1302     return error;
1303 }
1304 
SetCameraZoom(float zoomRatio)1305 int32_t CellularCallProxy::SetCameraZoom(float zoomRatio)
1306 {
1307     MessageOption option;
1308     MessageParcel in;
1309     MessageParcel out;
1310     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1311         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1312     }
1313     if (!in.WriteInt32(MAX_SIZE)) {
1314         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1315     }
1316     if (!in.WriteFloat(zoomRatio)) {
1317         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1318     }
1319     auto remote = Remote();
1320     if (remote == nullptr) {
1321         TELEPHONY_LOGE("function Remote() return nullptr!");
1322         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1323     }
1324     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_CAMERA_ZOOM), in,
1325         out, option);
1326     if (error == ERR_NONE) {
1327         return out.ReadInt32();
1328     }
1329     return error;
1330 }
1331 
SetPausePicture(int32_t slotId,int32_t index,const std::string & path)1332 int32_t CellularCallProxy::SetPausePicture(int32_t slotId, int32_t index, const std::string &path)
1333 {
1334     MessageOption option;
1335     MessageParcel in;
1336     MessageParcel out;
1337     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1338         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1339     }
1340     if (!in.WriteInt32(MAX_SIZE)) {
1341         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1342     }
1343     if (!in.WriteInt32(slotId)) {
1344         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1345     }
1346     if (!in.WriteInt32(index)) {
1347         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1348     }
1349     if (!in.WriteString(path)) {
1350         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1351     }
1352     auto remote = Remote();
1353     if (remote == nullptr) {
1354         TELEPHONY_LOGE("function Remote() return nullptr!");
1355         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1356     }
1357     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_PAUSE_IMAGE), in,
1358         out, option);
1359     if (error == ERR_NONE) {
1360         return out.ReadInt32();
1361     }
1362     return error;
1363 }
1364 
SetDeviceDirection(int32_t slotId,int32_t index,int32_t rotation)1365 int32_t CellularCallProxy::SetDeviceDirection(int32_t slotId, int32_t index, int32_t rotation)
1366 {
1367     MessageOption option;
1368     MessageParcel in;
1369     MessageParcel out;
1370     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1371         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1372     }
1373     if (!in.WriteInt32(MAX_SIZE)) {
1374         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1375     }
1376     if (!in.WriteInt32(slotId)) {
1377         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1378     }
1379     if (!in.WriteInt32(index)) {
1380         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1381     }
1382     if (!in.WriteInt32(rotation)) {
1383         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1384     }
1385     auto remote = Remote();
1386     if (remote == nullptr) {
1387         TELEPHONY_LOGE("function Remote() return nullptr!");
1388         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1389     }
1390     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_DEVICE_DIRECTION), in,
1391         out, option);
1392     if (error == ERR_NONE) {
1393         return out.ReadInt32();
1394     }
1395     return error;
1396 }
1397 
SetMute(int32_t slotId,int32_t mute)1398 int32_t CellularCallProxy::SetMute(int32_t slotId, int32_t mute)
1399 {
1400     MessageOption option;
1401     MessageParcel in;
1402     MessageParcel out;
1403     int32_t result = TELEPHONY_SUCCESS;
1404     result = SetCommonParamForMessageParcel(slotId, in);
1405     if (result != TELEPHONY_SUCCESS) {
1406         return result;
1407     }
1408     if (!in.WriteInt32(mute)) {
1409         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1410     }
1411     auto remote = Remote();
1412     if (remote == nullptr) {
1413         TELEPHONY_LOGE("function Remote() return nullptr!");
1414         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1415     }
1416     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_MUTE), in, out, option);
1417     if (error == ERR_NONE) {
1418         return out.ReadInt32();
1419     }
1420     return error;
1421 }
1422 
GetMute(int32_t slotId)1423 int32_t CellularCallProxy::GetMute(int32_t slotId)
1424 {
1425     MessageOption option;
1426     MessageParcel in;
1427     MessageParcel out;
1428     int32_t result = TELEPHONY_SUCCESS;
1429     result = SetCommonParamForMessageParcel(slotId, in);
1430     if (result != TELEPHONY_SUCCESS) {
1431         return result;
1432     }
1433     auto remote = Remote();
1434     if (remote == nullptr) {
1435         TELEPHONY_LOGE("function Remote() return nullptr!");
1436         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1437     }
1438     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::GET_MUTE), in, out, option);
1439     if (error == ERR_NONE) {
1440         return out.ReadInt32();
1441     }
1442     return error;
1443 }
1444 
SetEmergencyCallList(int32_t slotId,std::vector<EmergencyCall> & eccVec)1445 int32_t CellularCallProxy::SetEmergencyCallList(int32_t slotId, std::vector<EmergencyCall>  &eccVec)
1446 {
1447     MessageOption option;
1448     MessageParcel in;
1449     MessageParcel out;
1450     int32_t result = TELEPHONY_SUCCESS;
1451     result = SetCommonParamForMessageParcel(slotId, in);
1452     if (result != TELEPHONY_SUCCESS) {
1453         return result;
1454     }
1455 
1456     if (eccVec.size() <= 0) {
1457         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1458     }
1459 
1460     if (!in.WriteInt32(static_cast<int32_t>(eccVec.size()))) {
1461         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1462     }
1463 
1464     for (auto ecc : eccVec) {
1465         if (!(in.WriteString(ecc.eccNum) && in.WriteString(ecc.mcc) &&
1466                 in.WriteInt32(static_cast<int32_t>(ecc.eccType)) &&
1467                 in.WriteInt32(static_cast<int32_t>(ecc.simpresent)) &&
1468                 in.WriteInt32(static_cast<int32_t>(ecc.abnormalService)))) {
1469             return TELEPHONY_ERR_WRITE_DATA_FAIL;
1470         }
1471     }
1472 
1473     auto remote = Remote();
1474     if (remote == nullptr) {
1475         TELEPHONY_LOGE("function Remote() return nullptr!");
1476         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1477     }
1478     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::SET_EMERGENCY_CALL_LIST),
1479         in, out, option);
1480     if (error == ERR_NONE) {
1481         return out.ReadInt32();
1482     }
1483     return error;
1484 }
1485 
SetCommonParamForMessageParcel(int32_t slotId,MessageParcel & in)1486 int32_t CellularCallProxy::SetCommonParamForMessageParcel(int32_t slotId, MessageParcel &in)
1487 {
1488     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1489         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1490     }
1491     if (!in.WriteInt32(MAX_SIZE)) {
1492         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1493     }
1494     if (!in.WriteInt32(slotId)) {
1495         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1496     }
1497     return TELEPHONY_SUCCESS;
1498 }
1499 
CloseUnFinishedUssd(int32_t slotId)1500 int32_t CellularCallProxy::CloseUnFinishedUssd(int32_t slotId)
1501 {
1502     MessageOption option;
1503     MessageParcel in;
1504     MessageParcel out;
1505     int32_t result = TELEPHONY_SUCCESS;
1506     result = SetCommonParamForMessageParcel(slotId, in);
1507     if (result != TELEPHONY_SUCCESS) {
1508         return result;
1509     }
1510     auto remote = Remote();
1511     if (remote == nullptr) {
1512         TELEPHONY_LOGE("function Remote() return nullptr!");
1513         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1514     }
1515     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::CLOSE_UNFINISHED_USSD),
1516         in, out, option);
1517     if (error == ERR_NONE) {
1518         return out.ReadInt32();
1519     }
1520     return error;
1521 }
1522 
ClearAllCalls(const std::vector<CellularCallInfo> & infos)1523 int32_t CellularCallProxy::ClearAllCalls(const std::vector<CellularCallInfo> &infos)
1524 {
1525     MessageOption option;
1526     MessageParcel in;
1527     MessageParcel out;
1528     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1529         TELEPHONY_LOGE("WriteInterfaceToken fail!");
1530         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1531     }
1532 
1533     int32_t infoSize = static_cast<int32_t>(infos.size());
1534     if (!in.WriteInt32(infoSize)) {
1535         TELEPHONY_LOGE("WriteInt32 fail!");
1536         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1537     }
1538     for (auto &info : infos) {
1539         if (!in.WriteRawData(static_cast<const void *>(&info), sizeof(CellularCallInfo))) {
1540             TELEPHONY_LOGE("WriteRawData fail!");
1541             return TELEPHONY_ERR_WRITE_DATA_FAIL;
1542         }
1543     }
1544     auto remote = Remote();
1545     if (remote == nullptr) {
1546         TELEPHONY_LOGE("function Remote() return nullptr!");
1547         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1548     }
1549     int32_t error = remote->SendRequest(static_cast<uint32_t>(CellularCallInterfaceCode::CLEAR_ALL_CALLS),
1550         in, out, option);
1551     if (error == ERR_NONE) {
1552         return out.ReadInt32();
1553     }
1554     return error;
1555 }
1556 
CancelCallUpgrade(int32_t slotId,int32_t index)1557 int32_t CellularCallProxy::CancelCallUpgrade(int32_t slotId, int32_t index)
1558 {
1559     MessageOption option;
1560     MessageParcel in;
1561     MessageParcel out;
1562     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1563         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1564     }
1565     if (!in.WriteInt32(MAX_SIZE)) {
1566         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1567     }
1568     if (!in.WriteInt32(slotId)) {
1569         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1570     }
1571     if (!in.WriteInt32(index)) {
1572         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1573     }
1574     auto remote = Remote();
1575     if (remote == nullptr) {
1576         TELEPHONY_LOGE("function Remote() return nullptr!");
1577         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1578     }
1579     int32_t error = remote->SendRequest(
1580         static_cast<uint32_t>(CellularCallInterfaceCode::CANCEL_CALL_UPGRADE), in, out, option);
1581     if (error == ERR_NONE) {
1582         return out.ReadInt32();
1583     }
1584     return error;
1585 }
1586 
RequestCameraCapabilities(int32_t slotId,int32_t index)1587 int32_t CellularCallProxy::RequestCameraCapabilities(int32_t slotId, int32_t index)
1588 {
1589     MessageOption option;
1590     MessageParcel in;
1591     MessageParcel out;
1592     if (!in.WriteInterfaceToken(CellularCallProxy::GetDescriptor())) {
1593         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
1594     }
1595     if (!in.WriteInt32(MAX_SIZE)) {
1596         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1597     }
1598     if (!in.WriteInt32(slotId)) {
1599         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1600     }
1601     if (!in.WriteInt32(index)) {
1602         return TELEPHONY_ERR_WRITE_DATA_FAIL;
1603     }
1604     auto remote = Remote();
1605     if (remote == nullptr) {
1606         TELEPHONY_LOGE("function Remote() return nullptr!");
1607         return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL;
1608     }
1609     int32_t error = remote->SendRequest(
1610         static_cast<uint32_t>(CellularCallInterfaceCode::REQUEST_CAMERA_CAPABILITY), in, out, option);
1611     if (error == ERR_NONE) {
1612         return out.ReadInt32();
1613     }
1614     return error;
1615 }
1616 } // namespace Telephony
1617 } // namespace OHOS
1618