1 /*
2  * Copyright (c) 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 "telephonyinteraction_fuzzer.h"
17 
18 #include <cstddef>
19 #include <cstdint>
20 #define private public
21 #include "addcalltoken_fuzzer.h"
22 #include "call_status_callback_proxy.h"
23 
24 using namespace OHOS::Telephony;
25 namespace OHOS {
26 constexpr int32_t SLOT_NUM = 2;
27 constexpr int32_t ACCOUNT_ID_NUM = 10;
28 constexpr int32_t MULTI_PARTY_NUM = 10;
29 constexpr int32_t VOICE_DOMAIN_NUM = 10;
30 constexpr int32_t IMS_CALL_MODE_NUM = 5;
31 constexpr int32_t CALL_INDEX_MAX_NUM = 8;
32 constexpr int32_t VIDEO_REQUEST_RESULT_TYPE_NUM = 102;
33 constexpr int32_t CALL_SESSION_EVENT_ID_NUM = 4;
34 std::unique_ptr<CallStatusCallback> CallStatusCallbackPtr_ = nullptr;
35 
ServiceInited()36 bool ServiceInited()
37 {
38     bool result = true;
39     if (!IsServiceInited()) {
40         return false;
41     }
42     CallStatusCallbackPtr_ = std::make_unique<CallStatusCallback>();
43     if (CallStatusCallbackPtr_ == nullptr) {
44         result = false;
45     }
46     return result;
47 }
48 
OnRemoteRequest(const uint8_t * data,size_t size)49 int32_t OnRemoteRequest(const uint8_t *data, size_t size)
50 {
51     if (!ServiceInited()) {
52         return TELEPHONY_ERROR;
53     }
54     MessageParcel dataMessageParcel;
55     if (!dataMessageParcel.WriteInterfaceToken(CallStatusCallbackStub::GetDescriptor())) {
56         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
57     }
58     dataMessageParcel.RewindRead(0);
59     uint32_t code = static_cast<uint32_t>(size);
60     MessageParcel reply;
61     MessageOption option;
62     return CallStatusCallbackPtr_->OnRemoteRequest(code, dataMessageParcel, reply, option);
63 }
64 
UpdateCallReportInfo(const uint8_t * data,size_t size)65 int32_t UpdateCallReportInfo(const uint8_t *data, size_t size)
66 {
67     if (!ServiceInited()) {
68         return TELEPHONY_ERROR;
69     }
70     MessageParcel dataParcel;
71     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
72         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
73     }
74     CallReportInfo callReportInfo;
75     callReportInfo.index = static_cast<int32_t>(size);
76     callReportInfo.accountId = static_cast<int32_t>(size % ACCOUNT_ID_NUM);
77     callReportInfo.voiceDomain = static_cast<int32_t>(size % VOICE_DOMAIN_NUM);
78     callReportInfo.mpty = static_cast<int32_t>(size % MULTI_PARTY_NUM);
79     callReportInfo.callType = CallType::TYPE_ERR_CALL;
80     callReportInfo.callMode = VideoStateType::TYPE_VOICE;
81     callReportInfo.state = TelCallState::CALL_STATUS_UNKNOWN;
82     std::string msg(reinterpret_cast<const char *>(data), size);
83     int32_t accountLength = msg.length() > kMaxNumberLen ? kMaxNumberLen : msg.length();
84     memcpy_s(callReportInfo.accountNum, kMaxNumberLen, msg.c_str(), accountLength);
85     dataParcel.WriteInt32(callReportInfo.index);
86     dataParcel.WriteCString(callReportInfo.accountNum);
87     dataParcel.WriteInt32(callReportInfo.accountId);
88     dataParcel.WriteInt32(static_cast<int32_t>(callReportInfo.callType));
89     dataParcel.WriteInt32(static_cast<int32_t>(callReportInfo.callMode));
90     dataParcel.WriteInt32(static_cast<int32_t>(callReportInfo.state));
91     dataParcel.WriteInt32(callReportInfo.voiceDomain);
92     dataParcel.WriteInt32(callReportInfo.mpty);
93     dataParcel.WriteInt32(callReportInfo.crsType);
94     dataParcel.WriteInt32(callReportInfo.originalCallType);
95     dataParcel.WriteString(callReportInfo.voipCallInfo.voipCallId);
96     dataParcel.WriteString(callReportInfo.voipCallInfo.userName);
97     dataParcel.WriteString(callReportInfo.voipCallInfo.abilityName);
98     dataParcel.WriteString(callReportInfo.voipCallInfo.extensionId);
99     dataParcel.WriteString(callReportInfo.voipCallInfo.voipBundleName);
100     dataParcel.WriteUInt8Vector(callReportInfo.voipCallInfo.userProfile);
101     dataParcel.RewindRead(0);
102     MessageParcel reply;
103     return CallStatusCallbackPtr_->OnUpdateCallReportInfo(dataParcel, reply);
104 }
105 
UpdateCallsReportInfo(const uint8_t * data,size_t size)106 int32_t UpdateCallsReportInfo(const uint8_t *data, size_t size)
107 {
108     if (!ServiceInited()) {
109         return TELEPHONY_ERROR;
110     }
111     MessageParcel dataParcel;
112     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
113         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
114     }
115     CallReportInfo callReportInfo;
116     int32_t slotId = static_cast<int32_t>(size % SLOT_NUM);
117     int32_t vecSize = 1;
118     callReportInfo.index = static_cast<int32_t>(size);
119     callReportInfo.accountId = static_cast<int32_t>(size % ACCOUNT_ID_NUM);
120     callReportInfo.voiceDomain = static_cast<int32_t>(size % VOICE_DOMAIN_NUM);
121     callReportInfo.mpty = static_cast<int32_t>(size % MULTI_PARTY_NUM);
122     callReportInfo.callType = CallType::TYPE_ERR_CALL;
123     callReportInfo.callMode = VideoStateType::TYPE_VOICE;
124     callReportInfo.state = TelCallState::CALL_STATUS_UNKNOWN;
125     std::string msg(reinterpret_cast<const char *>(data), size);
126     int32_t accountLength = msg.length() > kMaxNumberLen ? kMaxNumberLen : msg.length();
127     memcpy_s(callReportInfo.accountNum, kMaxNumberLen, msg.c_str(), accountLength);
128     dataParcel.WriteInt32(vecSize);
129     dataParcel.WriteInt32(callReportInfo.index);
130     dataParcel.WriteCString(callReportInfo.accountNum);
131     dataParcel.WriteInt32(callReportInfo.accountId);
132     dataParcel.WriteInt32(static_cast<int32_t>(callReportInfo.callType));
133     dataParcel.WriteInt32(static_cast<int32_t>(callReportInfo.callMode));
134     dataParcel.WriteInt32(static_cast<int32_t>(callReportInfo.state));
135     dataParcel.WriteInt32(callReportInfo.voiceDomain);
136     dataParcel.WriteInt32(callReportInfo.mpty);
137     dataParcel.WriteInt32(callReportInfo.crsType);
138     dataParcel.WriteInt32(callReportInfo.originalCallType);
139     dataParcel.WriteString(callReportInfo.voipCallInfo.voipCallId);
140     dataParcel.WriteString(callReportInfo.voipCallInfo.userName);
141     dataParcel.WriteString(callReportInfo.voipCallInfo.abilityName);
142     dataParcel.WriteString(callReportInfo.voipCallInfo.extensionId);
143     dataParcel.WriteString(callReportInfo.voipCallInfo.voipBundleName);
144     dataParcel.WriteUInt8Vector(callReportInfo.voipCallInfo.userProfile);
145     dataParcel.WriteInt32(slotId);
146     dataParcel.RewindRead(0);
147     MessageParcel reply;
148     return CallStatusCallbackPtr_->OnUpdateCallsReportInfo(dataParcel, reply);
149 }
150 
UpdateEventReport(const uint8_t * data,size_t size)151 int32_t UpdateEventReport(const uint8_t *data, size_t size)
152 {
153     if (!ServiceInited()) {
154         return TELEPHONY_ERROR;
155     }
156     MessageParcel dataParcel;
157     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
158         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
159     }
160     CellularCallEventInfo info;
161     int32_t length = sizeof(CellularCallEventInfo);
162     info.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
163     info.eventId = RequestResultEventId::INVALID_REQUEST_RESULT_EVENT_ID;
164     dataParcel.WriteInt32(length);
165     dataParcel.WriteRawData((const void *)&info, length);
166     dataParcel.RewindRead(0);
167     MessageParcel reply;
168     return CallStatusCallbackPtr_->OnUpdateEventReport(dataParcel, reply);
169 }
170 
UpdateGetWaitingResult(const uint8_t * data,size_t size)171 int32_t UpdateGetWaitingResult(const uint8_t *data, size_t size)
172 {
173     if (!ServiceInited()) {
174         return TELEPHONY_ERROR;
175     }
176     MessageParcel dataParcel;
177     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
178         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
179     }
180     CallWaitResponse callWaitResponse;
181     int32_t length = sizeof(CallWaitResponse);
182     dataParcel.WriteInt32(length);
183     callWaitResponse.result = static_cast<int32_t>(size);
184     callWaitResponse.status = static_cast<int32_t>(size);
185     callWaitResponse.classCw = static_cast<int32_t>(size);
186     dataParcel.WriteRawData((const void *)&callWaitResponse, length);
187     dataParcel.RewindRead(0);
188     MessageParcel reply;
189     return CallStatusCallbackPtr_->OnUpdateGetWaitingResult(dataParcel, reply);
190 }
191 
UpdateGetRestrictionResult(const uint8_t * data,size_t size)192 int32_t UpdateGetRestrictionResult(const uint8_t *data, size_t size)
193 {
194     if (!ServiceInited()) {
195         return TELEPHONY_ERROR;
196     }
197     MessageParcel dataParcel;
198     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
199         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
200     }
201     CallRestrictionResponse callRestrictionResult;
202     int32_t length = sizeof(CallRestrictionResponse);
203     dataParcel.WriteInt32(length);
204     callRestrictionResult.result = static_cast<int32_t>(size);
205     callRestrictionResult.status = static_cast<int32_t>(size);
206     callRestrictionResult.classCw = static_cast<int32_t>(size);
207     dataParcel.WriteRawData((const void *)&callRestrictionResult, length);
208     dataParcel.RewindRead(0);
209     MessageParcel reply;
210     return CallStatusCallbackPtr_->OnUpdateGetRestrictionResult(dataParcel, reply);
211 }
212 
UpdateGetTransferResult(const uint8_t * data,size_t size)213 int32_t UpdateGetTransferResult(const uint8_t *data, size_t size)
214 {
215     if (!ServiceInited()) {
216         return TELEPHONY_ERROR;
217     }
218     MessageParcel dataParcel;
219     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
220         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
221     }
222     CallTransferResponse callTransferResponse;
223     int32_t length = sizeof(CallTransferResponse);
224     dataParcel.WriteInt32(length);
225     callTransferResponse.result = static_cast<int32_t>(size);
226     callTransferResponse.status = static_cast<int32_t>(size);
227     callTransferResponse.classx = static_cast<int32_t>(size);
228     callTransferResponse.type = static_cast<int32_t>(size);
229     std::string msg(reinterpret_cast<const char *>(data), size);
230     int32_t accountLength = msg.length() > kMaxNumberLen ? kMaxNumberLen : msg.length();
231     memcpy_s(callTransferResponse.number, kMaxNumberLen, msg.c_str(), accountLength);
232     callTransferResponse.reason = static_cast<int32_t>(size);
233     callTransferResponse.time = static_cast<int32_t>(size);
234     callTransferResponse.startHour = static_cast<int32_t>(size);
235     callTransferResponse.startMinute = static_cast<int32_t>(size);
236     callTransferResponse.endHour = static_cast<int32_t>(size);
237     callTransferResponse.endMinute = static_cast<int32_t>(size);
238     dataParcel.WriteRawData((const void *)&callTransferResponse, length);
239     dataParcel.RewindRead(0);
240     MessageParcel reply;
241     return CallStatusCallbackPtr_->OnUpdateGetTransferResult(dataParcel, reply);
242 }
243 
UpdateGetCallClipResult(const uint8_t * data,size_t size)244 int32_t UpdateGetCallClipResult(const uint8_t *data, size_t size)
245 {
246     if (!ServiceInited()) {
247         return TELEPHONY_ERROR;
248     }
249     MessageParcel dataParcel;
250     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
251         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
252     }
253     ClipResponse clipResponse;
254     int32_t length = sizeof(ClipResponse);
255     dataParcel.WriteInt32(length);
256     clipResponse.result = static_cast<int32_t>(size);
257     clipResponse.action = static_cast<int32_t>(size);
258     clipResponse.clipStat = static_cast<int32_t>(size);
259     dataParcel.WriteRawData((const void *)&clipResponse, length);
260     dataParcel.RewindRead(0);
261     MessageParcel reply;
262     return CallStatusCallbackPtr_->OnUpdateGetCallClipResult(dataParcel, reply);
263 }
264 
GetImsConfigResult(const uint8_t * data,size_t size)265 int32_t GetImsConfigResult(const uint8_t *data, size_t size)
266 {
267     if (!ServiceInited()) {
268         return TELEPHONY_ERROR;
269     }
270     MessageParcel dataParcel;
271     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
272         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
273     }
274     GetImsConfigResponse response;
275     int32_t length = sizeof(GetImsConfigResponse);
276     dataParcel.WriteInt32(length);
277     response.result = static_cast<int32_t>(size);
278     response.value = static_cast<int32_t>(size);
279     dataParcel.WriteRawData((const void *)&response, length);
280     dataParcel.RewindRead(0);
281     MessageParcel reply;
282     return CallStatusCallbackPtr_->OnGetImsConfigResult(dataParcel, reply);
283 }
284 
GetImsFeatureValueResult(const uint8_t * data,size_t size)285 int32_t GetImsFeatureValueResult(const uint8_t *data, size_t size)
286 {
287     if (!ServiceInited()) {
288         return TELEPHONY_ERROR;
289     }
290     MessageParcel dataParcel;
291     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
292         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
293     }
294     GetImsFeatureValueResponse response;
295     int32_t length = sizeof(GetImsFeatureValueResponse);
296     dataParcel.WriteInt32(length);
297     response.result = static_cast<int32_t>(size);
298     response.value = static_cast<int32_t>(size);
299     dataParcel.WriteRawData((const void *)&response, length);
300     dataParcel.RewindRead(0);
301     MessageParcel reply;
302     return CallStatusCallbackPtr_->OnGetImsFeatureValueResult(dataParcel, reply);
303 }
304 
SendMmiCodeResult(const uint8_t * data,size_t size)305 int32_t SendMmiCodeResult(const uint8_t *data, size_t size)
306 {
307     if (!ServiceInited()) {
308         return TELEPHONY_ERROR;
309     }
310     MessageParcel dataParcel;
311     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
312         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
313     }
314     MmiCodeInfo info;
315     int32_t length = sizeof(MmiCodeInfo);
316     dataParcel.WriteInt32(length);
317     info.result = static_cast<int32_t>(size);
318     std::string msg(reinterpret_cast<const char *>(data), size);
319     int32_t msgLength = msg.length() > kMaxNumberLen ? kMaxNumberLen : msg.length();
320     memcpy_s(info.message, kMaxNumberLen, msg.c_str(), msgLength);
321     dataParcel.WriteRawData((const void *)&info, length);
322     dataParcel.RewindRead(0);
323     MessageParcel reply;
324     return CallStatusCallbackPtr_->OnSendMmiCodeResult(dataParcel, reply);
325 }
326 
ReceiveUpdateCallMediaModeRequest(const uint8_t * data,size_t size)327 int32_t ReceiveUpdateCallMediaModeRequest(const uint8_t *data, size_t size)
328 {
329     if (!ServiceInited()) {
330         return TELEPHONY_ERROR;
331     }
332     MessageParcel dataParcel;
333     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
334         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
335     }
336 
337     int32_t length = sizeof(CallModeReportInfo);
338     dataParcel.WriteInt32(length);
339     CallModeReportInfo callModeReportInfo;
340     callModeReportInfo.callIndex = static_cast<int32_t>(size % CALL_INDEX_MAX_NUM);
341     callModeReportInfo.callMode = static_cast<ImsCallMode>(size % IMS_CALL_MODE_NUM);
342     callModeReportInfo.result = static_cast<VideoRequestResultType>(size % VIDEO_REQUEST_RESULT_TYPE_NUM);
343     dataParcel.WriteRawData((const void *)&callModeReportInfo, length);
344     dataParcel.RewindRead(0);
345     MessageParcel reply;
346     return CallStatusCallbackPtr_->OnReceiveImsCallModeRequest(dataParcel, reply);
347 }
348 
ReceiveUpdateCallMediaModeResponse(const uint8_t * data,size_t size)349 int32_t ReceiveUpdateCallMediaModeResponse(const uint8_t *data, size_t size)
350 {
351     if (!ServiceInited()) {
352         return TELEPHONY_ERROR;
353     }
354     MessageParcel dataParcel;
355     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
356         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
357     }
358 
359     int32_t length = sizeof(CallModeReportInfo);
360     dataParcel.WriteInt32(length);
361     CallModeReportInfo callModeReportInfo;
362     callModeReportInfo.callIndex = static_cast<int32_t>(size % CALL_INDEX_MAX_NUM);
363     callModeReportInfo.callMode = static_cast<ImsCallMode>(size % IMS_CALL_MODE_NUM);
364     callModeReportInfo.result = static_cast<VideoRequestResultType>(size % VIDEO_REQUEST_RESULT_TYPE_NUM);
365     dataParcel.WriteRawData((const void *)&callModeReportInfo, length);
366     dataParcel.RewindRead(0);
367     MessageParcel reply;
368     return CallStatusCallbackPtr_->OnReceiveImsCallModeResponse(dataParcel, reply);
369 }
370 
HandleCallSessionEventChanged(const uint8_t * data,size_t size)371 int32_t HandleCallSessionEventChanged(const uint8_t *data, size_t size)
372 {
373     if (!ServiceInited()) {
374         return TELEPHONY_ERROR;
375     }
376     MessageParcel dataParcel;
377     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
378         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
379     }
380 
381     int32_t length = sizeof(CallSessionReportInfo);
382     dataParcel.WriteInt32(length);
383     CallSessionReportInfo callSessionReportInfo;
384     callSessionReportInfo.index = static_cast<int32_t>(size % CALL_INDEX_MAX_NUM);
385     callSessionReportInfo.eventId = static_cast<CallSessionEventId>(size % CALL_SESSION_EVENT_ID_NUM);
386     dataParcel.WriteRawData((const void *)&callSessionReportInfo, length);
387     dataParcel.RewindRead(0);
388     MessageParcel reply;
389     return CallStatusCallbackPtr_->OnCallSessionEventChange(dataParcel, reply);
390 }
391 
HandlePeerDimensionsChanged(const uint8_t * data,size_t size)392 int32_t HandlePeerDimensionsChanged(const uint8_t *data, size_t size)
393 {
394     if (!ServiceInited()) {
395         return TELEPHONY_ERROR;
396     }
397     MessageParcel dataParcel;
398     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
399         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
400     }
401 
402     int32_t length = sizeof(PeerDimensionsReportInfo);
403     dataParcel.WriteInt32(length);
404     PeerDimensionsReportInfo dimensionsReportInfo;
405     dimensionsReportInfo.index = static_cast<int32_t>(size % CALL_INDEX_MAX_NUM);
406     dimensionsReportInfo.width = static_cast<int32_t>(size);
407     dimensionsReportInfo.height = static_cast<int32_t>(size);
408     dataParcel.WriteRawData((const void *)&dimensionsReportInfo, length);
409     dataParcel.RewindRead(0);
410     MessageParcel reply;
411     return CallStatusCallbackPtr_->OnPeerDimensionsChange(dataParcel, reply);
412 }
413 
HandleCallDataUsageChanged(const uint8_t * data,size_t size)414 int32_t HandleCallDataUsageChanged(const uint8_t *data, size_t size)
415 {
416     if (!ServiceInited()) {
417         return TELEPHONY_ERROR;
418     }
419     MessageParcel dataParcel;
420     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
421         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
422     }
423 
424     int64_t reportInfo = static_cast<int64_t>(size);
425     dataParcel.WriteInt64(reportInfo);
426     dataParcel.RewindRead(0);
427     MessageParcel reply;
428     return CallStatusCallbackPtr_->OnCallDataUsageChange(dataParcel, reply);
429 }
430 
HandleCameraCapabilitiesChanged(const uint8_t * data,size_t size)431 int32_t HandleCameraCapabilitiesChanged(const uint8_t *data, size_t size)
432 {
433     if (!ServiceInited()) {
434         return TELEPHONY_ERROR;
435     }
436     MessageParcel dataParcel;
437     if (!dataParcel.WriteInterfaceToken(CallStatusCallbackProxy::GetDescriptor())) {
438         return TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL;
439     }
440 
441     int32_t length = sizeof(CameraCapabilitiesReportInfo);
442     dataParcel.WriteInt32(length);
443     CameraCapabilitiesReportInfo cameraCapabilitiesReportInfo;
444     cameraCapabilitiesReportInfo.index = static_cast<int32_t>(size % CALL_INDEX_MAX_NUM);
445     cameraCapabilitiesReportInfo.width = static_cast<int32_t>(size);
446     cameraCapabilitiesReportInfo.height = static_cast<int32_t>(size);
447     dataParcel.WriteRawData((const void *)&cameraCapabilitiesReportInfo, length);
448     dataParcel.RewindRead(0);
449     MessageParcel reply;
450     return CallStatusCallbackPtr_->OnCameraCapabilitiesChange(dataParcel, reply);
451 }
452 
DoSomethingInterestingWithMyAPI(const uint8_t * data,size_t size)453 void DoSomethingInterestingWithMyAPI(const uint8_t *data, size_t size)
454 {
455     if (data == nullptr || size == 0) {
456         return;
457     }
458     OnRemoteRequest(data, size);
459     UpdateCallReportInfo(data, size);
460     UpdateCallsReportInfo(data, size);
461     UpdateEventReport(data, size);
462     UpdateGetWaitingResult(data, size);
463     UpdateGetRestrictionResult(data, size);
464     UpdateGetTransferResult(data, size);
465     UpdateGetCallClipResult(data, size);
466     GetImsConfigResult(data, size);
467     GetImsFeatureValueResult(data, size);
468     SendMmiCodeResult(data, size);
469     ReceiveUpdateCallMediaModeRequest(data, size);
470     ReceiveUpdateCallMediaModeResponse(data, size);
471     HandleCallSessionEventChanged(data, size);
472     HandlePeerDimensionsChanged(data, size);
473     HandleCallDataUsageChanged(data, size);
474     HandleCameraCapabilitiesChanged(data, size);
475 }
476 } // namespace OHOS
477 
478 /* Fuzzer entry point */
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)479 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
480 {
481     OHOS::AddCallTokenFuzzer token;
482     /* Run your code on data */
483     OHOS::DoSomethingInterestingWithMyAPI(data, size);
484     return 0;
485 }
486