1 /*
2  * Copyright (c) 2022-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 "notification_constant.h"
17 #include "notification_content.h"
18 #include "notification_normal_content.h"
19 #include "refbase.h"
20 #include <memory>
21 #include <new>
22 #include <string>
23 #include <vector>
24 #define private public
25 #define protected public
26 #include "advanced_notification_service.h"
27 #include "ans_manager_proxy.h"
28 #include "ans_manager_stub.h"
29 #include "ans_subscriber_stub.h"
30 #undef private
31 #undef protected
32 #include "ansmanagerstub_fuzzer.h"
33 #include "notification_request.h"
34 #include "ans_permission_def.h"
35 
36 constexpr uint8_t SLOT_TYPE_NUM = 5;
37 
38 namespace OHOS {
GetCurrentTime()39     inline int64_t GetCurrentTime()
40     {
41         auto now = std::chrono::system_clock::now();
42         auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
43         return duration.count();
44     }
DoSomethingInterestingWithMyAPI(FuzzData fuzzData)45     bool DoSomethingInterestingWithMyAPI(FuzzData fuzzData)
46     {
47         std::string stringData = fuzzData.GenerateRandomString();
48         int32_t intData = fuzzData.GenerateRandomInt32();
49         bool boolData = fuzzData.GenerateRandomBool();
50         Notification::AdvancedNotificationService ansManagerStub;
51         MessageParcel datas;
52         MessageParcel reply;
53         MessageOption flags;
54         // test HandleIsNeedSilentInDoNotDisturbMode function
55         ansManagerStub.HandleIsNeedSilentInDoNotDisturbMode(datas, reply);
56         // test HandleRegisterSwingCallback function
57         #ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED
58         ansManagerStub.HandleRegisterSwingCallback(datas, reply);
59         #endif
60         ansManagerStub.OnRemoteRequest(0, datas, reply, flags);
61         ansManagerStub.OnRemoteRequest((int) Notification::NotificationInterfaceCode::PUBLISH_NOTIFICATION,
62             datas, reply, flags);
63         sptr<Notification::NotificationRequest> notification = new Notification::NotificationRequest();
64         notification->SetOwnerUid(fuzzData.GenerateRandomInt32());
65         notification->SetCreatorUid(fuzzData.GenerateRandomInt32());
66         notification->SetSlotType(Notification::NotificationConstant::SlotType::LIVE_VIEW);
67         auto content = std::make_shared<Notification::NotificationLiveViewContent>();
68         notification->SetContent(std::make_shared<Notification::NotificationContent>(content));
69 
70         sptr<Notification::NotificationBundleOption> bundleOption = new Notification::NotificationBundleOption();
71         bundleOption->SetBundleName(fuzzData.GenerateRandomString());
72         bundleOption->SetUid(fuzzData.GenerateRandomInt32());
73 
74         sptr<Notification::NotificationButtonOption> buttonOption = new Notification::NotificationButtonOption();
75 
76         sptr<Notification::AnsSubscriberStub> subscriber = new Notification::AnsSubscriberStub();
77         sptr<Notification::NotificationSubscribeInfo> info = new Notification::NotificationSubscribeInfo();
78 
79         sptr<Notification::NotificationSlot> slot = new Notification::NotificationSlot();
80         std::vector<sptr<Notification::NotificationSlot>> slots {slot};
81 
82         uint8_t type = fuzzData.GetData<uint8_t>() % SLOT_TYPE_NUM;
83 
84         sptr<Notification::NotificationDoNotDisturbDate> distribuDate = new Notification::NotificationDoNotDisturbDate();
85         distribuDate->SetBeginDate(GetCurrentTime());
86         distribuDate->SetEndDate(GetCurrentTime());
87 
88         datas.WriteString(stringData);
89         datas.WriteParcelable(notification);
90         ansManagerStub.HandlePublish(datas, reply);
91         datas.WriteInt32(intData);
92         datas.WriteString(stringData);
93         datas.WriteInt32(intData);
94         ansManagerStub.HandleCancelAsBundle(datas, reply);
95         datas.WriteParcelable(bundleOption);
96         datas.WriteInt32(intData);
97         ansManagerStub.HandleCancelAsBundleOption(datas, reply);
98         datas.WriteInt32(intData);
99         ansManagerStub.HandleCancelAll(datas, reply);
100         datas.WriteInt32(intData);
101         datas.WriteString(stringData);
102         datas.WriteInt32(intData);
103         ansManagerStub.HandleCancel(datas, reply);
104         datas.WriteParcelable(bundleOption);
105         datas.WriteInt32(intData);
106         datas.WriteInt32(intData);
107         ansManagerStub.HandleCancelAsBundleAndUser(datas, reply);
108         datas.WriteInt32(type);
109         ansManagerStub.HandleAddSlotByType(datas, reply);
110         ansManagerStub.HandleAddSlots(datas, reply);
111         datas.WriteInt32(type);
112         ansManagerStub.HandleRemoveSlotByType(datas, reply);
113         ansManagerStub.HandleRemoveAllSlots(datas, reply);
114         ansManagerStub.HandleGetSlots(datas, reply);
115         datas.WriteInt32(type);
116         ansManagerStub.HandleGetSlotByType(datas, reply);
117         datas.WriteParcelable(bundleOption);
118         ansManagerStub.HandleGetSlotNumAsBundle(datas, reply);
119         datas.WriteParcelable(bundleOption);
120         datas.WriteInt32(intData);
121         ansManagerStub.HandleSetSlotFlagsAsBundle(datas, reply);
122         datas.WriteParcelable(bundleOption);
123         ansManagerStub.HandleGetSlotFlagsAsBundle(datas, reply);
124         datas.WriteInt32(intData);
125         ansManagerStub.HandleGetActiveNotifications(datas, reply);
126         ansManagerStub.HandleGetActiveNotificationNums(datas, reply);
127         ansManagerStub.HandleGetAllActiveNotifications(datas, reply);
128         std::vector<std::string> stringVector { stringData };
129         datas.WriteStringVector(stringVector);
130         ansManagerStub.HandleGetSpecialActiveNotifications(datas, reply);
131         datas.WriteParcelable(bundleOption);
132         datas.WriteInt32(intData);
133         datas.WriteString(stringData);
134         datas.WriteStringVector(stringVector);
135         ansManagerStub.HandleGetActiveNotificationByFilter(datas, reply);
136         datas.WriteString(stringData);
137         ansManagerStub.HandleSetNotificationAgent(datas, reply);
138         ansManagerStub.HandleGetNotificationAgent(datas, reply);
139         datas.WriteString(stringData);
140         ansManagerStub.HandleCanPublishAsBundle(datas, reply);
141         datas.WriteParcelable(notification);
142         datas.WriteString(stringData);
143         ansManagerStub.HandlePublishAsBundle(datas, reply);
144         datas.WriteInt32(intData);
145         ansManagerStub.HandleSetNotificationBadgeNum(datas, reply);
146         ansManagerStub.HandleGetBundleImportance(datas, reply);
147         datas.WriteParcelable(distribuDate);
148         ansManagerStub.HandleSetDoNotDisturbDate(datas, reply);
149         ansManagerStub.HandleGetDoNotDisturbDate(datas, reply);
150         ansManagerStub.HandleDoesSupportDoNotDisturbMode(datas, reply);
151         datas.WriteParcelable(notification);
152         datas.WriteInt32(intData);
153         ansManagerStub.HandlePublishContinuousTaskNotification(datas, reply);
154         datas.WriteString(stringData);
155         datas.WriteInt32(intData);
156         ansManagerStub.HandleCancelContinuousTaskNotification(datas, reply);
157         ansManagerStub.HandleIsNotificationPolicyAccessGranted(datas, reply);
158         datas.WriteParcelable(bundleOption);
159         datas.WriteInt32(intData);
160         datas.WriteParcelable(buttonOption);
161         ansManagerStub.HandleTriggerLocalLiveView(datas, reply);
162         datas.WriteParcelable(bundleOption);
163         datas.WriteInt32(intData);
164         datas.WriteString(stringData);
165         datas.WriteInt32(intData);
166         ansManagerStub.HandleRemoveNotification(datas, reply);
167         ansManagerStub.HandleRemoveAllNotifications(datas, reply);
168         datas.WriteInt32(intData);
169         datas.WriteStringVector(stringVector);
170         datas.WriteInt32(intData);
171         ansManagerStub.HandleRemoveNotifications(datas, reply);
172         datas.WriteString(stringData);
173         datas.WriteInt32(intData);
174         ansManagerStub.HandleDelete(datas, reply);
175         datas.WriteParcelable(bundleOption);
176         ansManagerStub.HandleDeleteByBundle(datas, reply);
177         ansManagerStub.HandleDeleteAll(datas, reply);
178         datas.WriteParcelable(bundleOption);
179         datas.WriteInt32(intData);
180         ansManagerStub.HandleGetSlotByBundle(datas, reply);
181         ansManagerStub.HandleGetSlotsByBundle(datas, reply);
182         datas.WriteParcelable(bundleOption);
183         ansManagerStub.HandleUpdateSlots(datas, reply);
184         datas.WriteString(stringData);
185         datas.WriteRemoteObject(subscriber);
186         datas.WriteBool(boolData);
187         if (boolData) {
188             datas.WriteRemoteObject(subscriber);
189         }
190         ansManagerStub.HandleRequestEnableNotification(datas, reply);
191         datas.WriteString(stringData);
192         datas.WriteBool(boolData);
193         ansManagerStub.HandleSetNotificationsEnabledForBundle(datas, reply);
194         datas.WriteString(stringData);
195         datas.WriteBool(boolData);
196         ansManagerStub.HandleSetNotificationsEnabledForAllBundles(datas, reply);
197         datas.WriteString(stringData);
198         datas.WriteParcelable(bundleOption);
199         datas.WriteBool(boolData);
200         ansManagerStub.HandleSetNotificationsEnabledForSpecialBundle(datas, reply);
201         datas.WriteParcelable(bundleOption);
202         datas.WriteBool(boolData);
203         ansManagerStub.HandleSetShowBadgeEnabledForBundle(datas, reply);
204         datas.WriteParcelable(bundleOption);
205         ansManagerStub.HandleGetShowBadgeEnabledForBundle(datas, reply);
206         ansManagerStub.HandleGetShowBadgeEnabled(datas, reply);
207         datas.WriteRemoteObject(subscriber);
208         datas.WriteBool(boolData);
209         if (boolData) {
210             datas.WriteParcelable(info);
211         }
212         ansManagerStub.HandleSubscribe(datas, reply);
213         datas.WriteRemoteObject(subscriber);
214         ansManagerStub.HandleSubscribeSelf(datas, reply);
215         datas.WriteRemoteObject(subscriber);
216         datas.WriteBool(boolData);
217         if (boolData) {
218             datas.WriteParcelable(info);
219         }
220         datas.WriteBool(boolData);
221         ansManagerStub.HandleSubscribeLocalLiveView(datas, reply);
222         datas.WriteRemoteObject(subscriber);
223         datas.WriteBool(boolData);
224         if (boolData) {
225             datas.WriteParcelable(info);
226         }
227         ansManagerStub.HandleUnsubscribe(datas, reply);
228         ansManagerStub.HandleIsAllowedNotify(datas, reply);
229         ansManagerStub.HandleIsAllowedNotifySelf(datas, reply);
230         datas.WriteRemoteObject(subscriber);
231         ansManagerStub.HandleCanPopEnableNotificationDialog(datas, reply);
232         datas.WriteParcelable(bundleOption);
233         ansManagerStub.HandleIsSpecialBundleAllowedNotify(datas, reply);
234         datas.WriteString(stringData);
235         datas.WriteInt32(intData);
236         ansManagerStub.HandleCancelGroup(datas, reply);
237         datas.WriteParcelable(bundleOption);
238         datas.WriteString(stringData);
239         ansManagerStub.HandleRemoveGroupByBundle(datas, reply);
240         ansManagerStub.HandleIsDistributedEnabled(datas, reply);
241         datas.WriteBool(boolData);
242         ansManagerStub.HandleEnableDistributed(datas, reply);
243         datas.WriteParcelable(bundleOption);
244         datas.WriteBool(boolData);
245         ansManagerStub.HandleEnableDistributedByBundle(datas, reply);
246         datas.WriteBool(boolData);
247         ansManagerStub.HandleEnableDistributedSelf(datas, reply);
248         datas.WriteParcelable(bundleOption);
249         ansManagerStub.HandleIsDistributedEnableByBundle(datas, reply);
250         ansManagerStub.HandleGetDeviceRemindType(datas, reply);
251         datas.WriteString(stringData);
252         datas.WriteString(stringData);
253         datas.WriteInt32(intData);
254         datas.WriteInt32(intData);
255         ansManagerStub.HandleShellDump(datas, reply);
256         ansManagerStub.HandlePublishReminder(datas, reply);
257         datas.WriteInt32(intData);
258         ansManagerStub.HandleCancelReminder(datas, reply);
259         ansManagerStub.HandleCancelAllReminders(datas, reply);
260         ansManagerStub.HandleGetValidReminders(datas, reply);
261         datas.WriteInt32(intData);
262         datas.WriteUint64(intData);
263         ansManagerStub.HandleAddExcludeDate(datas, reply);
264         datas.WriteInt32(intData);
265         ansManagerStub.HandleDelExcludeDates(datas, reply);
266         datas.WriteInt32(intData);
267         ansManagerStub.HandleGetExcludeDates(datas, reply);
268         datas.WriteString(stringData);
269         ansManagerStub.HandleIsSupportTemplate(datas, reply);
270         datas.WriteInt32(intData);
271         ansManagerStub.HandleIsSpecialUserAllowedNotifyByUser(datas, reply);
272         datas.WriteInt32(intData);
273         datas.WriteBool(boolData);
274         ansManagerStub.HandleSetNotificationsEnabledByUser(datas, reply);
275         datas.WriteInt32(intData);
276         ansManagerStub.HandleDeleteAllByUser(datas, reply);
277         datas.WriteInt32(intData);
278         datas.WriteParcelable(distribuDate);
279         ansManagerStub.HandleSetDoNotDisturbDateByUser(datas, reply);
280         datas.WriteInt32(intData);
281         ansManagerStub.HandleGetDoNotDisturbDateByUser(datas, reply);
282         datas.WriteParcelable(bundleOption);
283         datas.WriteInt32(type);
284         datas.WriteBool(boolData);
285         datas.WriteBool(boolData);
286         ansManagerStub.HandleSetEnabledForBundleSlot(datas, reply);
287         datas.WriteParcelable(bundleOption);
288         datas.WriteInt32(type);
289         ansManagerStub.HandleGetEnabledForBundleSlot(datas, reply);
290         datas.WriteInt32(type);
291         ansManagerStub.HandleGetEnabledForBundleSlotSelf(datas, reply);
292         datas.WriteInt32(intData);
293         datas.WriteBool(boolData);
294         ansManagerStub.HandleDistributedSetEnabledWithoutApp(datas, reply);
295         datas.WriteInt32(intData);
296         ansManagerStub.HandleDistributedGetEnabledWithoutApp(datas, reply);
297         datas.WriteInt32(intData);
298         datas.WriteInt32(intData);
299         ansManagerStub.HandleSetBadgeNumber(datas, reply);
300         datas.WriteParcelable(bundleOption);
301         datas.WriteInt32(intData);
302         ansManagerStub.HandleSetBadgeNumberByBundle(datas, reply);
303         ansManagerStub.HandleGetAllNotificationEnableStatus(datas, reply);
304         ansManagerStub.HandleRegisterPushCallback(datas, reply);
305         ansManagerStub.HandleUnregisterPushCallback(datas, reply);
306         ansManagerStub.HandleAddDoNotDisturbProfiles(datas, reply);
307         datas.WriteParcelable(bundleOption);
308         datas.WriteString(stringData);
309         datas.WriteBool(boolData);
310         ansManagerStub.HandleSetDistributedEnabledByBundle(datas, reply);
311         ansManagerStub.HandleRemoveDoNotDisturbProfiles(datas, reply);
312         datas.WriteParcelable(bundleOption);
313         datas.WriteString(stringData);
314         ansManagerStub.HandleIsDistributedEnabledByBundle(datas, reply);
315         datas.WriteString(stringData);
316         datas.WriteBool(boolData);
317         ansManagerStub.HandleSetSmartReminderEnabled(datas, reply);
318         datas.WriteString(stringData);
319         ansManagerStub.HandleIsSmartReminderEnabled(datas, reply);
320         datas.WriteString(stringData);
321         datas.WriteString(stringData);
322         ansManagerStub.HandleSetAdditionConfig(datas, reply);
323         datas.WriteParcelable(bundleOption);
324         datas.WriteInt32(intData);
325         ansManagerStub.HandleCancelAsBundleWithAgent(datas, reply);
326         datas.WriteString(stringData);
327         datas.WriteInt32(intData);
328         ansManagerStub.HandleSetTargetDeviceStatus(datas, reply);
329         sptr<Notification::NotificationRequest> notification2 = new Notification::NotificationRequest();
330         notification2->SetOwnerUid(fuzzData.GenerateRandomInt32());
331         notification2->SetCreatorUid(fuzzData.GenerateRandomInt32());
332         notification2->SetSlotType(Notification::NotificationConstant::SlotType::SOCIAL_COMMUNICATION);
333         auto content2 = std::make_shared<Notification::NotificationNormalContent>();
334         notification2->SetContent(std::make_shared<Notification::NotificationContent>(content2));
335         ansManagerStub.Publish(stringData, notification2);
336         int notificationId = fuzzData.GetData<int>();
337         ansManagerStub.Cancel(notificationId, stringData, 0);
338         ansManagerStub.CancelAll(0);
339         int32_t userId = fuzzData.GetData<int32_t>();
340         ansManagerStub.CancelAsBundle(notificationId, stringData, userId);
341         Notification::NotificationConstant::SlotType slotType = Notification::NotificationConstant::SlotType(type);
342         ansManagerStub.AddSlotByType(slotType);
343         ansManagerStub.AddSlots(slots);
344         ansManagerStub.RemoveSlotByType(slotType);
345         ansManagerStub.RemoveAllSlots();
346         ansManagerStub.GetSlotByType(slotType, slot);
347         ansManagerStub.GetSlots(slots);
348         uint64_t num = fuzzData.GetData<uint64_t>();
349         ansManagerStub.GetSlotNumAsBundle(bundleOption, num);
350         std::vector<sptr<Notification::NotificationRequest>> notifications;
351         ansManagerStub.GetActiveNotifications(notifications, 0);
352         ansManagerStub.GetActiveNotificationNums(num);
353         std::vector<sptr<Notification::Notification>> notificationss;
354         ansManagerStub.GetAllActiveNotifications(notificationss);
355         std::vector<std::string> key;
356         ansManagerStub.GetSpecialActiveNotifications(key, notificationss);
357         ansManagerStub.SetNotificationAgent(stringData);
358         ansManagerStub.GetNotificationAgent(stringData);
359         bool canPublish = fuzzData.GenerateRandomBool();
360         ansManagerStub.CanPublishAsBundle(stringData, canPublish);
361         ansManagerStub.PublishAsBundle(notification, stringData);
362         ansManagerStub.SetNotificationBadgeNum(num);
363         int importance = fuzzData.GetData<int>();
364         ansManagerStub.GetBundleImportance(importance);
365         bool granted = fuzzData.GenerateRandomBool();
366         ansManagerStub.HasNotificationPolicyAccessPermission(granted);
367         int32_t removeReason = fuzzData.GetData<int32_t>();
368         ansManagerStub.RemoveNotification(bundleOption, notificationId, stringData, removeReason);
369         ansManagerStub.RemoveAllNotifications(bundleOption);
370         ansManagerStub.Delete(stringData, removeReason);
371         ansManagerStub.DeleteByBundle(bundleOption);
372         ansManagerStub.DeleteAll();
373         ansManagerStub.GetSlotsByBundle(bundleOption, slots);
374         ansManagerStub.UpdateSlots(bundleOption, slots);
375         sptr<Notification::AnsDialogCallback> dialogCallback = nullptr;
376         sptr<IRemoteObject> callerToken = nullptr;
377         ansManagerStub.RequestEnableNotification(stringData, dialogCallback, callerToken);
378         bool enabled = fuzzData.GenerateRandomBool();
379         ansManagerStub.SetNotificationsEnabledForBundle(stringData, enabled);
380         ansManagerStub.SetNotificationsEnabledForSpecialBundle(stringData, bundleOption, enabled);
381         ansManagerStub.SetShowBadgeEnabledForBundle(bundleOption, enabled);
382         ansManagerStub.GetShowBadgeEnabledForBundle(bundleOption, enabled);
383         ansManagerStub.GetShowBadgeEnabled(enabled);
384         bool allowed = fuzzData.GenerateRandomBool();
385         ansManagerStub.IsAllowedNotify(allowed);
386         ansManagerStub.IsSpecialBundleAllowedNotify(bundleOption, allowed);
387         ansManagerStub.CancelGroup(stringData, 0);
388         ansManagerStub.RemoveGroupByBundle(bundleOption, stringData);
389         sptr<Notification::NotificationDoNotDisturbDate> date = new Notification::NotificationDoNotDisturbDate();
390         ansManagerStub.SetDoNotDisturbDate(date);
391         ansManagerStub.GetDoNotDisturbDate(date);
392         bool doesSupport = fuzzData.GenerateRandomBool();
393         ansManagerStub.DoesSupportDoNotDisturbMode(doesSupport);
394         ansManagerStub.IsDistributedEnabled(enabled);
395         ansManagerStub.EnableDistributedByBundle(bundleOption, enabled);
396         ansManagerStub.EnableDistributedSelf(enabled);
397         ansManagerStub.IsDistributedEnableByBundle(bundleOption, enabled);
398         Notification::NotificationConstant::RemindType remindType;
399         ansManagerStub.GetDeviceRemindType(remindType);
400         sptr<Notification::NotificationRequest> request = new Notification::NotificationRequest();
401         ansManagerStub.PublishContinuousTaskNotification(request);
402         ansManagerStub.CancelContinuousTaskNotification(stringData, notificationId);
403         sptr<Notification::ReminderRequest> reminder = new Notification::ReminderRequest();
404         ansManagerStub.PublishReminder(reminder);
405         int32_t reminderId = fuzzData.GetData<int32_t>();
406         ansManagerStub.CancelReminder(reminderId);
407         std::vector<sptr<Notification::ReminderRequest>> reminders;
408         ansManagerStub.GetValidReminders(reminders);
409         ansManagerStub.CancelAllReminders();
410         uint64_t excludeDate = fuzzData.GetData<uint64_t>();
411         ansManagerStub.AddExcludeDate(reminderId, excludeDate);
412         ansManagerStub.DelExcludeDates(reminderId);
413         std::vector<uint64_t> excludeDates;
414         ansManagerStub.GetExcludeDates(reminderId, excludeDates);
415         bool support = fuzzData.GenerateRandomBool();
416         ansManagerStub.IsSupportTemplate(stringData, support);
417         ansManagerStub.IsSpecialUserAllowedNotify(userId, allowed);
418         int32_t deviceIds = fuzzData.GetData<int32_t>();
419         ansManagerStub.SetNotificationsEnabledByUser(deviceIds, enabled);
420         ansManagerStub.DeleteAllByUser(userId);
421         ansManagerStub.SetDoNotDisturbDate(date);
422         ansManagerStub.GetDoNotDisturbDate(date);
423         ansManagerStub.SetEnabledForBundleSlot(bundleOption, slotType, enabled, false);
424         ansManagerStub.GetEnabledForBundleSlot(bundleOption, slotType, enabled);
425         std::vector<std::string> dumpInfo;
426         ansManagerStub.ShellDump(stringData, stringData, userId, userId, dumpInfo);
427         ansManagerStub.SetSyncNotificationEnabledWithoutApp(userId, enabled);
428         ansManagerStub.GetSyncNotificationEnabledWithoutApp(userId, enabled);
429         return true;
430     }
431 }
432 
433 /* Fuzzer entry point */
LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)434 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
435 {
436     /* Run your code on data */
437     if (data != nullptr && size >= GetU32Size()) {
438         OHOS::FuzzData fuzzData(data, size);
439         std::vector<std::string> requestPermission = {
440             OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER,
441             OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER,
442             OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION
443         };
444         NativeTokenGet(requestPermission);
445         OHOS::DoSomethingInterestingWithMyAPI(fuzzData);
446     }
447     return 0;
448 }
449