From b2d1006cbad2320e94f93178fa376247eeaab092 Mon Sep 17 00:00:00 2001 From: wangdi Date: Thu, 26 Jun 2025 22:03:30 +0800 Subject: [PATCH] add advancednotificaiton service fuzz template Signed-off-by: wangdi --- .../advancednotificationservice/BUILD.gn | 93 ++++++++++- .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...service_adddonotdisturbprofiles_fuzzer.cpp | 38 +++++ .../service_adddonotdisturbprofiles_fuzzer.h | 24 +++ .../serviceaddslotbytype_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../serviceaddslotbytype_fuzzer/corpus/init | 13 ++ .../serviceaddslotbytype_fuzzer/project.xml | 25 +++ .../service_addslotbytype_fuzzer.cpp | 38 +++++ .../service_addslotbytype_fuzzer.h | 24 +++ .../serviceaddslots_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../serviceaddslots_fuzzer/corpus/init | 13 ++ .../serviceaddslots_fuzzer/project.xml | 25 +++ .../service_addslots_fuzzer.cpp | 38 +++++ .../service_addslots_fuzzer.h | 24 +++ .../serviceallowusereminder_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_allowusereminder_fuzzer.cpp | 38 +++++ .../service_allowusereminder_fuzzer.h | 24 +++ .../servicecancel_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicecancel_fuzzer/corpus/init | 13 ++ .../servicecancel_fuzzer/project.xml | 25 +++ .../service_cancel_fuzzer.cpp | 38 +++++ .../service_cancel_fuzzer.h | 24 +++ .../servicecancelall_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicecancelall_fuzzer/corpus/init | 13 ++ .../servicecancelall_fuzzer/project.xml | 25 +++ .../service_cancelall_fuzzer.cpp | 38 +++++ .../service_cancelall_fuzzer.h | 24 +++ .../servicecancelasbundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicecancelasbundle_fuzzer/corpus/init | 13 ++ .../servicecancelasbundle_fuzzer/project.xml | 25 +++ .../service_cancelasbundle_fuzzer.cpp | 38 +++++ .../service_cancelasbundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...service_cancelasbundlewithagent_fuzzer.cpp | 38 +++++ .../service_cancelasbundlewithagent_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ancelcontinuoustasknotification_fuzzer.cpp | 38 +++++ ..._cancelcontinuoustasknotification_fuzzer.h | 24 +++ .../servicecancelgroup_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicecancelgroup_fuzzer/corpus/init | 13 ++ .../servicecancelgroup_fuzzer/project.xml | 25 +++ .../service_cancelgroup_fuzzer.cpp | 38 +++++ .../service_cancelgroup_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ..._canpopenablenotificationdialog_fuzzer.cpp | 38 +++++ ...ce_canpopenablenotificationdialog_fuzzer.h | 24 +++ .../servicecanpublishasbundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_canpublishasbundle_fuzzer.cpp | 38 +++++ .../service_canpublishasbundle_fuzzer.h | 24 +++ .../servicedelete_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicedelete_fuzzer/corpus/init | 13 ++ .../servicedelete_fuzzer/project.xml | 25 +++ .../service_delete_fuzzer.cpp | 38 +++++ .../service_delete_fuzzer.h | 24 +++ .../servicedeleteallbyuser_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicedeleteallbyuser_fuzzer/corpus/init | 13 ++ .../servicedeleteallbyuser_fuzzer/project.xml | 25 +++ .../service_deleteallbyuser_fuzzer.cpp | 38 +++++ .../service_deleteallbyuser_fuzzer.h | 24 +++ .../servicedeletebybundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicedeletebybundle_fuzzer/corpus/init | 13 ++ .../servicedeletebybundle_fuzzer/project.xml | 25 +++ .../service_deletebybundle_fuzzer.cpp | 38 +++++ .../service_deletebybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...vice_disablenotificationfeature_fuzzer.cpp | 38 +++++ ...ervice_disablenotificationfeature_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_distributeoperation_fuzzer.cpp | 38 +++++ .../service_distributeoperation_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...rvice_enabledistributedbybundle_fuzzer.cpp | 38 +++++ ...service_enabledistributedbybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...e_getactivenotificationbyfilter_fuzzer.cpp | 38 +++++ ...ice_getactivenotificationbyfilter_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getactivenotifications_fuzzer.cpp | 38 +++++ .../service_getactivenotifications_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ..._getalldistribuedenabledbundles_fuzzer.cpp | 38 +++++ ...ce_getalldistribuedenabledbundles_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ce_getallliveviewenabledbundles_fuzzer.cpp | 38 +++++ ...vice_getallliveviewenabledbundles_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...e_getallnotificationsbyslottype_fuzzer.cpp | 38 +++++ ...ice_getallnotificationsbyslottype_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getbundleimportance_fuzzer.cpp | 38 +++++ .../service_getbundleimportance_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getdeviceremindtype_fuzzer.cpp | 38 +++++ .../service_getdeviceremindtype_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getdonotdisturbdate_fuzzer.cpp | 38 +++++ .../service_getdonotdisturbdate_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getdonotdisturbprofile_fuzzer.cpp | 38 +++++ .../service_getdonotdisturbprofile_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...service_getenabledforbundleslot_fuzzer.cpp | 38 +++++ .../service_getenabledforbundleslot_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ice_getenabledforbundleslotself_fuzzer.cpp | 38 +++++ ...rvice_getenabledforbundleslotself_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...etnotificationrequestbyhashcode_fuzzer.cpp | 38 +++++ ..._getnotificationrequestbyhashcode_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ce_getshowbadgeenabledforbundle_fuzzer.cpp | 38 +++++ ...vice_getshowbadgeenabledforbundle_fuzzer.h | 24 +++ .../servicegetslotbybundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicegetslotbybundle_fuzzer/corpus/init | 13 ++ .../servicegetslotbybundle_fuzzer/project.xml | 25 +++ .../service_getslotbybundle_fuzzer.cpp | 38 +++++ .../service_getslotbybundle_fuzzer.h | 24 +++ .../servicegetslotbytype_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicegetslotbytype_fuzzer/corpus/init | 13 ++ .../servicegetslotbytype_fuzzer/project.xml | 25 +++ .../service_getslotbytype_fuzzer.cpp | 38 +++++ .../service_getslotbytype_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getslotflagsasbundle_fuzzer.cpp | 38 +++++ .../service_getslotflagsasbundle_fuzzer.h | 24 +++ .../servicegetslotnumasbundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getslotnumasbundle_fuzzer.cpp | 38 +++++ .../service_getslotnumasbundle_fuzzer.h | 24 +++ .../servicegetslots_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicegetslots_fuzzer/corpus/init | 13 ++ .../servicegetslots_fuzzer/project.xml | 25 +++ .../service_getslots_fuzzer.cpp | 38 +++++ .../service_getslots_fuzzer.h | 24 +++ .../servicegetslotsbybundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_getslotsbybundle_fuzzer.cpp | 38 +++++ .../service_getslotsbybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...e_getspecialactivenotifications_fuzzer.cpp | 38 +++++ ...ice_getspecialactivenotifications_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ncnotificationenabledwithoutapp_fuzzer.cpp | 38 +++++ ...syncnotificationenabledwithoutapp_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_gettargetdevicestatus_fuzzer.cpp | 38 +++++ .../service_gettargetdevicestatus_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ice_isdistributedenablebybundle_fuzzer.cpp | 38 +++++ ...rvice_isdistributedenablebybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ce_isdistributedenabledbybundle_fuzzer.cpp | 38 +++++ ...vice_isdistributedenabledbybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...vice_isdistributedenabledbyslot_fuzzer.cpp | 38 +++++ ...ervice_isdistributedenabledbyslot_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ..._isneedsilentindonotdisturbmode_fuzzer.cpp | 38 +++++ ...ce_isneedsilentindonotdisturbmode_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_issmartreminderenabled_fuzzer.cpp | 38 +++++ .../service_issmartreminderenabled_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ce_isspecialbundleallowednotify_fuzzer.cpp | 38 +++++ ...vice_isspecialbundleallowednotify_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...vice_isspecialuserallowednotify_fuzzer.cpp | 38 +++++ ...ervice_isspecialuserallowednotify_fuzzer.h | 24 +++ .../serviceissupporttemplate_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_issupporttemplate_fuzzer.cpp | 38 +++++ .../service_issupporttemplate_fuzzer.h | 24 +++ .../servicepublishasbundle_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicepublishasbundle_fuzzer/corpus/init | 13 ++ .../servicepublishasbundle_fuzzer/project.xml | 25 +++ .../service_publishasbundle_fuzzer.cpp | 38 +++++ .../service_publishasbundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ..._publishasbundlewithmaxcapacity_fuzzer.cpp | 38 +++++ ...ce_publishasbundlewithmaxcapacity_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...blishcontinuoustasknotification_fuzzer.cpp | 38 +++++ ...publishcontinuoustasknotification_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...forindirectproxywithmaxcapacity_fuzzer.cpp | 38 +++++ ...shforindirectproxywithmaxcapacity_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ishnotificationforindirectproxy_fuzzer.cpp | 38 +++++ ...blishnotificationforindirectproxy_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_publishwithmaxcapacity_fuzzer.cpp | 38 +++++ .../service_publishwithmaxcapacity_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_registerpushcallback_fuzzer.cpp | 38 +++++ .../service_registerpushcallback_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_removeallnotifications_fuzzer.cpp | 38 +++++ .../service_removeallnotifications_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ..._removedistributednotifications_fuzzer.cpp | 38 +++++ ...ce_removedistributednotifications_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...vice_removedonotdisturbprofiles_fuzzer.cpp | 38 +++++ ...ervice_removedonotdisturbprofiles_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_removegroupbybundle_fuzzer.cpp | 38 +++++ .../service_removegroupbybundle_fuzzer.h | 24 +++ .../serviceremovenotification_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_removenotification_fuzzer.cpp | 38 +++++ .../service_removenotification_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_removenotifications_fuzzer.cpp | 38 +++++ .../service_removenotifications_fuzzer.h | 24 +++ .../serviceremoveslotbytype_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_removeslotbytype_fuzzer.cpp | 38 +++++ .../service_removeslotbytype_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ervice_replydistributeoperation_fuzzer.cpp | 38 +++++ .../service_replydistributeoperation_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...rvice_requestenablenotification_fuzzer.cpp | 38 +++++ ...service_requestenablenotification_fuzzer.h | 24 +++ .../servicesetadditionconfig_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_setadditionconfig_fuzzer.cpp | 38 +++++ .../service_setadditionconfig_fuzzer.h | 24 +++ .../servicesetbadgenumber_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicesetbadgenumber_fuzzer/corpus/init | 13 ++ .../servicesetbadgenumber_fuzzer/project.xml | 25 +++ .../service_setbadgenumber_fuzzer.cpp | 38 +++++ .../service_setbadgenumber_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_setbadgenumberbybundle_fuzzer.cpp | 38 +++++ .../service_setbadgenumberbybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ice_setbadgenumberfordhbybundle_fuzzer.cpp | 38 +++++ ...rvice_setbadgenumberfordhbybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...e_setdistributedenabledbybundle_fuzzer.cpp | 38 +++++ ...ice_setdistributedenabledbybundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ice_setdistributedenabledbyslot_fuzzer.cpp | 38 +++++ ...rvice_setdistributedenabledbyslot_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_setdonotdisturbdate_fuzzer.cpp | 38 +++++ .../service_setdonotdisturbdate_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...service_setenabledforbundleslot_fuzzer.cpp | 38 +++++ .../service_setenabledforbundleslot_fuzzer.h | 24 +++ .../servicesethashcoderule_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicesethashcoderule_fuzzer/corpus/init | 13 ++ .../servicesethashcoderule_fuzzer/project.xml | 25 +++ .../service_sethashcoderule_fuzzer.cpp | 38 +++++ .../service_sethashcoderule_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...service_setnotificationbadgenum_fuzzer.cpp | 38 +++++ .../service_setnotificationbadgenum_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...e_setnotificationsenabledbyuser_fuzzer.cpp | 38 +++++ ...ice_setnotificationsenabledbyuser_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...tificationsenabledforallbundles_fuzzer.cpp | 38 +++++ ...notificationsenabledforallbundles_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...etnotificationsenabledforbundle_fuzzer.cpp | 38 +++++ ..._setnotificationsenabledforbundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...icationsenabledforspecialbundle_fuzzer.cpp | 38 +++++ ...ificationsenabledforspecialbundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ce_setshowbadgeenabledforbundle_fuzzer.cpp | 38 +++++ ...vice_setshowbadgeenabledforbundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_setslotflagsasbundle_fuzzer.cpp | 38 +++++ .../service_setslotflagsasbundle_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...service_setsmartreminderenabled_fuzzer.cpp | 38 +++++ .../service_setsmartreminderenabled_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ncnotificationenabledwithoutapp_fuzzer.cpp | 38 +++++ ...syncnotificationenabledwithoutapp_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_settargetdevicestatus_fuzzer.cpp | 38 +++++ .../service_settargetdevicestatus_fuzzer.h | 24 +++ .../serviceshelldump_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../serviceshelldump_fuzzer/corpus/init | 13 ++ .../serviceshelldump_fuzzer/project.xml | 25 +++ .../service_shelldump_fuzzer.cpp | 38 +++++ .../service_shelldump_fuzzer.h | 24 +++ .../servicesubscribe_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicesubscribe_fuzzer/corpus/init | 13 ++ .../servicesubscribe_fuzzer/project.xml | 25 +++ .../service_subscribe_fuzzer.cpp | 38 +++++ .../service_subscribe_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_subscribelocalliveview_fuzzer.cpp | 38 +++++ .../service_subscribelocalliveview_fuzzer.h | 24 +++ .../servicesubscribeself_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../servicesubscribeself_fuzzer/corpus/init | 13 ++ .../servicesubscribeself_fuzzer/project.xml | 25 +++ .../service_subscribeself_fuzzer.cpp | 38 +++++ .../service_subscribeself_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ .../service_triggerlocalliveview_fuzzer.cpp | 38 +++++ .../service_triggerlocalliveview_fuzzer.h | 24 +++ .../serviceunsubscribe_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../serviceunsubscribe_fuzzer/corpus/init | 13 ++ .../serviceunsubscribe_fuzzer/project.xml | 25 +++ .../service_unsubscribe_fuzzer.cpp | 38 +++++ .../service_unsubscribe_fuzzer.h | 24 +++ .../BUILD.gn | 152 ++++++++++++++++++ .../corpus/init | 13 ++ .../project.xml | 25 +++ ...ce_updatenotificationtimerbyuid_fuzzer.cpp | 38 +++++ ...vice_updatenotificationtimerbyuid_fuzzer.h | 24 +++ .../serviceupdateslots_fuzzer/BUILD.gn | 152 ++++++++++++++++++ .../serviceupdateslots_fuzzer/corpus/init | 13 ++ .../serviceupdateslots_fuzzer/project.xml | 25 +++ .../service_updateslots_fuzzer.cpp | 38 +++++ .../service_updateslots_fuzzer.h | 24 +++ 456 files changed, 23024 insertions(+), 1 deletion(-) create mode 100644 test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecancel_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecancel_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecancel_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicedelete_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicedelete_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicedelete_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.h create mode 100644 test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/BUILD.gn create mode 100644 test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/corpus/init create mode 100644 test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/project.xml create mode 100644 test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.cpp create mode 100644 test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.h diff --git a/test/fuzztest/advancednotificationservice/BUILD.gn b/test/fuzztest/advancednotificationservice/BUILD.gn index d2ce258a4..544826e87 100644 --- a/test/fuzztest/advancednotificationservice/BUILD.gn +++ b/test/fuzztest/advancednotificationservice/BUILD.gn @@ -18,5 +18,96 @@ group("fuzztest") { deps = [ "servicepublish_fuzzer:ServicePublishFuzzTest", + "servicesetdistributedenabledbybundle_fuzzer:ServiceSetDistributedEnabledByBundleFuzzTest", + "servicesetbadgenumberfordhbybundle_fuzzer:ServiceSetBadgeNumberForDhByBundleFuzzTest", + "servicesetslotflagsasbundle_fuzzer:ServiceSetSlotFlagsAsBundleFuzzTest", + "servicepublishnotificationforindirectproxy_fuzzer:ServicePublishNotificationForIndirectProxyFuzzTest", + "servicegetsyncnotificationenabledwithoutapp_fuzzer:ServiceGetSyncNotificationEnabledWithoutAppFuzzTest", + "servicesubscribe_fuzzer:ServiceSubscribeFuzzTest", + "servicegetnotificationrequestbyhashcode_fuzzer:ServiceGetNotificationRequestByHashCodeFuzzTest", + "serviceregisterpushcallback_fuzzer:ServiceRegisterPushCallbackFuzzTest", + "serviceremovenotification_fuzzer:ServiceRemoveNotificationFuzzTest", + "servicegetslotsbybundle_fuzzer:ServiceGetSlotsByBundleFuzzTest", + "servicepublishasbundle_fuzzer:ServicePublishAsBundleFuzzTest", + "servicecancelall_fuzzer:ServiceCancelAllFuzzTest", + "serviceisdistributedenabledbybundle_fuzzer:ServiceIsDistributedEnabledByBundleFuzzTest", + "servicegetshowbadgeenabledforbundle_fuzzer:ServiceGetShowBadgeEnabledForBundleFuzzTest", + "servicedistributeoperation_fuzzer:ServiceDistributeOperationFuzzTest", + "servicedeleteallbyuser_fuzzer:ServiceDeleteAllByUserFuzzTest", + "serviceenabledistributedbybundle_fuzzer:ServiceEnableDistributedByBundleFuzzTest", + "servicesubscribelocalliveview_fuzzer:ServiceSubscribeLocalLiveViewFuzzTest", + "servicesubscribeself_fuzzer:ServiceSubscribeSelfFuzzTest", + "serviceremovegroupbybundle_fuzzer:ServiceRemoveGroupByBundleFuzzTest", + "serviceadddonotdisturbprofiles_fuzzer:ServiceAddDoNotDisturbProfilesFuzzTest", + "serviceisdistributedenablebybundle_fuzzer:ServiceIsDistributedEnableByBundleFuzzTest", + "serviceissmartreminderenabled_fuzzer:ServiceIsSmartReminderEnabledFuzzTest", + "serviceremovenotifications_fuzzer:ServiceRemoveNotificationsFuzzTest", + "servicepublishforindirectproxywithmaxcapacity_fuzzer:ServicePublishForIndirectProxyWithMaxCapacityFuzzTest", + "serviceissupporttemplate_fuzzer:ServiceIsSupportTemplateFuzzTest", + "servicecanpublishasbundle_fuzzer:ServiceCanPublishAsBundleFuzzTest", + "serviceunsubscribe_fuzzer:ServiceUnsubscribeFuzzTest", + "servicecancelgroup_fuzzer:ServiceCancelGroupFuzzTest", + "servicesetsyncnotificationenabledwithoutapp_fuzzer:ServiceSetSyncNotificationEnabledWithoutAppFuzzTest", + "servicepublishcontinuoustasknotification_fuzzer:ServicePublishContinuousTaskNotificationFuzzTest", + "serviceupdateslots_fuzzer:ServiceUpdateSlotsFuzzTest", + "servicegetslots_fuzzer:ServiceGetSlotsFuzzTest", + "servicegetenabledforbundleslotself_fuzzer:ServiceGetEnabledForBundleSlotSelfFuzzTest", + "servicesetnotificationbadgenum_fuzzer:ServiceSetNotificationBadgeNumFuzzTest", + "serviceremoveallnotifications_fuzzer:ServiceRemoveAllNotificationsFuzzTest", + "servicegetenabledforbundleslot_fuzzer:ServiceGetEnabledForBundleSlotFuzzTest", + "servicesetbadgenumberbybundle_fuzzer:ServiceSetBadgeNumberByBundleFuzzTest", + "servicesethashcoderule_fuzzer:ServiceSetHashCodeRuleFuzzTest", + "serviceisneedsilentindonotdisturbmode_fuzzer:ServiceIsNeedSilentInDoNotDisturbModeFuzzTest", + "servicegetalldistribuedenabledbundles_fuzzer:ServiceGetAllDistribuedEnabledBundlesFuzzTest", + "servicesetnotificationsenabledforspecialbundle_fuzzer:ServiceSetNotificationsEnabledForSpecialBundleFuzzTest", + "servicegetslotbybundle_fuzzer:ServiceGetSlotByBundleFuzzTest", + "servicegetdonotdisturbprofile_fuzzer:ServiceGetDoNotDisturbProfileFuzzTest", + "servicecancelasbundlewithagent_fuzzer:ServiceCancelAsBundleWithAgentFuzzTest", + "servicesetsmartreminderenabled_fuzzer:ServiceSetSmartReminderEnabledFuzzTest", + "serviceisspecialuserallowednotify_fuzzer:ServiceIsSpecialUserAllowedNotifyFuzzTest", + "servicesetbadgenumber_fuzzer:ServiceSetBadgeNumberFuzzTest", + "servicesetnotificationsenabledforbundle_fuzzer:ServiceSetNotificationsEnabledForBundleFuzzTest", + "servicesetadditionconfig_fuzzer:ServiceSetAdditionConfigFuzzTest", + "servicesetdonotdisturbdate_fuzzer:ServiceSetDoNotDisturbDateFuzzTest", + "servicegetslotnumasbundle_fuzzer:ServiceGetSlotNumAsBundleFuzzTest", + "serviceaddslots_fuzzer:ServiceAddSlotsFuzzTest", + "servicegetspecialactivenotifications_fuzzer:ServiceGetSpecialActiveNotificationsFuzzTest", + "servicegetallliveviewenabledbundles_fuzzer:ServiceGetAllLiveViewEnabledBundlesFuzzTest", + "servicesetshowbadgeenabledforbundle_fuzzer:ServiceSetShowBadgeEnabledForBundleFuzzTest", + "servicedisablenotificationfeature_fuzzer:ServiceDisableNotificationFeatureFuzzTest", + "servicecancel_fuzzer:ServiceCancelFuzzTest", + "servicereplydistributeoperation_fuzzer:ServiceReplyDistributeOperationFuzzTest", + "servicegetdonotdisturbdate_fuzzer:ServiceGetDoNotDisturbDateFuzzTest", + "servicesettargetdevicestatus_fuzzer:ServiceSetTargetDeviceStatusFuzzTest", + "servicesetenabledforbundleslot_fuzzer:ServiceSetEnabledForBundleSlotFuzzTest", + "serviceremovedonotdisturbprofiles_fuzzer:ServiceRemoveDoNotDisturbProfilesFuzzTest", + "serviceshelldump_fuzzer:ServiceShellDumpFuzzTest", + "servicegetbundleimportance_fuzzer:ServiceGetBundleImportanceFuzzTest", + "servicegetactivenotifications_fuzzer:ServiceGetActiveNotificationsFuzzTest", + "servicesetnotificationsenabledforallbundles_fuzzer:ServiceSetNotificationsEnabledForAllBundlesFuzzTest", + "servicecanpopenablenotificationdialog_fuzzer:ServiceCanPopEnableNotificationDialogFuzzTest", + "servicecancelcontinuoustasknotification_fuzzer:ServiceCancelContinuousTaskNotificationFuzzTest", + "servicepublishwithmaxcapacity_fuzzer:ServicePublishWithMaxCapacityFuzzTest", + "servicegetdeviceremindtype_fuzzer:ServiceGetDeviceRemindTypeFuzzTest", + "servicedelete_fuzzer:ServiceDeleteFuzzTest", + "servicesetdistributedenabledbyslot_fuzzer:ServiceSetDistributedEnabledBySlotFuzzTest", + "servicesetnotificationsenabledbyuser_fuzzer:ServiceSetNotificationsEnabledByUserFuzzTest", + "servicedeletebybundle_fuzzer:ServiceDeleteByBundleFuzzTest", + "servicegetallnotificationsbyslottype_fuzzer:ServiceGetAllNotificationsBySlotTypeFuzzTest", + "servicepublishasbundlewithmaxcapacity_fuzzer:ServicePublishAsBundleWithMaxCapacityFuzzTest", + "servicegettargetdevicestatus_fuzzer:ServiceGetTargetDeviceStatusFuzzTest", + "servicegetactivenotificationbyfilter_fuzzer:ServiceGetActiveNotificationByFilterFuzzTest", + "servicegetslotbytype_fuzzer:ServiceGetSlotByTypeFuzzTest", + "servicerequestenablenotification_fuzzer:ServiceRequestEnableNotificationFuzzTest", + "servicegetslotflagsasbundle_fuzzer:ServiceGetSlotFlagsAsBundleFuzzTest", + "servicetriggerlocalliveview_fuzzer:ServiceTriggerLocalLiveViewFuzzTest", + "serviceallowusereminder_fuzzer:ServiceAllowUseReminderFuzzTest", + "serviceisspecialbundleallowednotify_fuzzer:ServiceIsSpecialBundleAllowedNotifyFuzzTest", + "serviceremoveslotbytype_fuzzer:ServiceRemoveSlotByTypeFuzzTest", + "servicecancelasbundle_fuzzer:ServiceCancelAsBundleFuzzTest", + "serviceaddslotbytype_fuzzer:ServiceAddSlotByTypeFuzzTest", + "serviceupdatenotificationtimerbyuid_fuzzer:ServiceUpdateNotificationTimerByUidFuzzTest", + "serviceisdistributedenabledbyslot_fuzzer:ServiceIsDistributedEnabledBySlotFuzzTest", + "serviceremovedistributednotifications_fuzzer:ServiceRemoveDistributedNotificationsFuzzTest", ] -} +} \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/BUILD.gn new file mode 100644 index 000000000..ed210df3a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceAddDoNotDisturbProfilesFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_adddonotdisturbprofiles_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceAddDoNotDisturbProfilesFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.cpp new file mode 100644 index 000000000..4e21d92e4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_adddonotdisturbprofiles_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.h new file mode 100644 index 000000000..7ab675b5b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceadddonotdisturbprofiles_fuzzer/service_adddonotdisturbprofiles_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDDONOTDISTURBPROFILES_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDDONOTDISTURBPROFILES_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceadddonotdisturbprofiles_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDDONOTDISTURBPROFILES_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/BUILD.gn new file mode 100644 index 000000000..02251078b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceAddSlotByTypeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_addslotbytype_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceAddSlotByTypeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.cpp new file mode 100644 index 000000000..e9f337907 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_addslotbytype_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.h new file mode 100644 index 000000000..821c09e94 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslotbytype_fuzzer/service_addslotbytype_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDSLOTBYTYPE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDSLOTBYTYPE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceaddslotbytype_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDSLOTBYTYPE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/BUILD.gn new file mode 100644 index 000000000..9a2181ced --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceAddSlotsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_addslots_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceAddSlotsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.cpp new file mode 100644 index 000000000..c6e81bdc7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_addslots_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.h new file mode 100644 index 000000000..61bf0bfad --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceaddslots_fuzzer/service_addslots_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDSLOTS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDSLOTS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceaddslots_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ADDSLOTS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/BUILD.gn new file mode 100644 index 000000000..536829fef --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceAllowUseReminderFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_allowusereminder_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceAllowUseReminderFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.cpp new file mode 100644 index 000000000..5a8bc01e7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_allowusereminder_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.h new file mode 100644 index 000000000..067be7b75 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceallowusereminder_fuzzer/service_allowusereminder_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ALLOWUSEREMINDER_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ALLOWUSEREMINDER_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceallowusereminder_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ALLOWUSEREMINDER_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/BUILD.gn new file mode 100644 index 000000000..23dc1320a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCancelFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecancel_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_cancel_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCancelFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.cpp new file mode 100644 index 000000000..3dace1401 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_cancel_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.h new file mode 100644 index 000000000..2b4361c1e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancel_fuzzer/service_cancel_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCEL_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCEL_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecancel_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCEL_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/BUILD.gn new file mode 100644 index 000000000..624bdfd48 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCancelAllFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_cancelall_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCancelAllFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.cpp new file mode 100644 index 000000000..e3198ba83 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_cancelall_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.h new file mode 100644 index 000000000..d2f471d7b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelall_fuzzer/service_cancelall_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELALL_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELALL_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecancelall_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELALL_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..73b8b0139 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCancelAsBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_cancelasbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCancelAsBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.cpp new file mode 100644 index 000000000..ddae103e7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_cancelasbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.h new file mode 100644 index 000000000..16db997cf --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundle_fuzzer/service_cancelasbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELASBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELASBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecancelasbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELASBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/BUILD.gn new file mode 100644 index 000000000..e59ec270c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCancelAsBundleWithAgentFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_cancelasbundlewithagent_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCancelAsBundleWithAgentFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.cpp new file mode 100644 index 000000000..6e1dab8d7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_cancelasbundlewithagent_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.h new file mode 100644 index 000000000..557b7a385 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelasbundlewithagent_fuzzer/service_cancelasbundlewithagent_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELASBUNDLEWITHAGENT_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELASBUNDLEWITHAGENT_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecancelasbundlewithagent_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELASBUNDLEWITHAGENT_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/BUILD.gn new file mode 100644 index 000000000..f429ac0c5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCancelContinuousTaskNotificationFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_cancelcontinuoustasknotification_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCancelContinuousTaskNotificationFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.cpp new file mode 100644 index 000000000..f831c2400 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_cancelcontinuoustasknotification_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.h new file mode 100644 index 000000000..a9d18f38d --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelcontinuoustasknotification_fuzzer/service_cancelcontinuoustasknotification_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELCONTINUOUSTASKNOTIFICATION_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELCONTINUOUSTASKNOTIFICATION_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecancelcontinuoustasknotification_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELCONTINUOUSTASKNOTIFICATION_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/BUILD.gn new file mode 100644 index 000000000..1f4830736 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCancelGroupFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_cancelgroup_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCancelGroupFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.cpp new file mode 100644 index 000000000..9e0e85332 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_cancelgroup_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.h new file mode 100644 index 000000000..03acaa5c9 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecancelgroup_fuzzer/service_cancelgroup_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELGROUP_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELGROUP_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecancelgroup_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANCELGROUP_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/BUILD.gn new file mode 100644 index 000000000..40a777956 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCanPopEnableNotificationDialogFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_canpopenablenotificationdialog_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCanPopEnableNotificationDialogFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.cpp new file mode 100644 index 000000000..ee5e5168e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_canpopenablenotificationdialog_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.h new file mode 100644 index 000000000..23bc1a6df --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpopenablenotificationdialog_fuzzer/service_canpopenablenotificationdialog_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANPOPENABLENOTIFICATIONDIALOG_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANPOPENABLENOTIFICATIONDIALOG_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecanpopenablenotificationdialog_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANPOPENABLENOTIFICATIONDIALOG_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..d7a7358ac --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceCanPublishAsBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_canpublishasbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceCanPublishAsBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.cpp new file mode 100644 index 000000000..a14eb0e92 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_canpublishasbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.h new file mode 100644 index 000000000..ba14dd71f --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicecanpublishasbundle_fuzzer/service_canpublishasbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANPUBLISHASBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANPUBLISHASBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicecanpublishasbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_CANPUBLISHASBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/BUILD.gn new file mode 100644 index 000000000..b256a5c9b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceDeleteFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicedelete_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_delete_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceDeleteFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.cpp new file mode 100644 index 000000000..f20581c84 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_delete_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.h b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.h new file mode 100644 index 000000000..b9db3e145 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedelete_fuzzer/service_delete_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicedelete_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/BUILD.gn new file mode 100644 index 000000000..01ebce4cb --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceDeleteAllByUserFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_deleteallbyuser_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceDeleteAllByUserFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.cpp new file mode 100644 index 000000000..79b8e652a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_deleteallbyuser_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.h b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.h new file mode 100644 index 000000000..a5dc6584c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeleteallbyuser_fuzzer/service_deleteallbyuser_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETEALLBYUSER_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETEALLBYUSER_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicedeleteallbyuser_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETEALLBYUSER_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..c2d8ffb73 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceDeleteByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_deletebybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceDeleteByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.cpp new file mode 100644 index 000000000..3c1e1beba --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_deletebybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.h new file mode 100644 index 000000000..3ca9a0419 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedeletebybundle_fuzzer/service_deletebybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETEBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETEBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicedeletebybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DELETEBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/BUILD.gn new file mode 100644 index 000000000..5f43ba6fd --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceDisableNotificationFeatureFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_disablenotificationfeature_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceDisableNotificationFeatureFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.cpp new file mode 100644 index 000000000..b3c136406 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_disablenotificationfeature_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.h b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.h new file mode 100644 index 000000000..b71bcd186 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedisablenotificationfeature_fuzzer/service_disablenotificationfeature_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DISABLENOTIFICATIONFEATURE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DISABLENOTIFICATIONFEATURE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicedisablenotificationfeature_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DISABLENOTIFICATIONFEATURE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/BUILD.gn new file mode 100644 index 000000000..26022e66e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceDistributeOperationFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_distributeoperation_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceDistributeOperationFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.cpp new file mode 100644 index 000000000..7e110d46b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_distributeoperation_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.h b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.h new file mode 100644 index 000000000..e908c0eee --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicedistributeoperation_fuzzer/service_distributeoperation_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DISTRIBUTEOPERATION_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DISTRIBUTEOPERATION_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicedistributeoperation_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_DISTRIBUTEOPERATION_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..6df71b4ba --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceEnableDistributedByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_enabledistributedbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceEnableDistributedByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.cpp new file mode 100644 index 000000000..9e8ee7340 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_enabledistributedbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.h new file mode 100644 index 000000000..92ae7416a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceenabledistributedbybundle_fuzzer/service_enabledistributedbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ENABLEDISTRIBUTEDBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ENABLEDISTRIBUTEDBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceenabledistributedbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ENABLEDISTRIBUTEDBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/BUILD.gn new file mode 100644 index 000000000..3040820a3 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetActiveNotificationByFilterFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getactivenotificationbyfilter_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetActiveNotificationByFilterFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.cpp new file mode 100644 index 000000000..9ddf5e7a2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getactivenotificationbyfilter_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.h new file mode 100644 index 000000000..290025e59 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotificationbyfilter_fuzzer/service_getactivenotificationbyfilter_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETACTIVENOTIFICATIONBYFILTER_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETACTIVENOTIFICATIONBYFILTER_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetactivenotificationbyfilter_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETACTIVENOTIFICATIONBYFILTER_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/BUILD.gn new file mode 100644 index 000000000..d27b1ff31 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetActiveNotificationsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getactivenotifications_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetActiveNotificationsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.cpp new file mode 100644 index 000000000..9ce782576 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getactivenotifications_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.h new file mode 100644 index 000000000..55670f2b0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetactivenotifications_fuzzer/service_getactivenotifications_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETACTIVENOTIFICATIONS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETACTIVENOTIFICATIONS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetactivenotifications_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETACTIVENOTIFICATIONS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/BUILD.gn new file mode 100644 index 000000000..363935605 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetAllDistribuedEnabledBundlesFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getalldistribuedenabledbundles_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetAllDistribuedEnabledBundlesFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.cpp new file mode 100644 index 000000000..effe2d044 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getalldistribuedenabledbundles_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.h new file mode 100644 index 000000000..4f3a9665c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetalldistribuedenabledbundles_fuzzer/service_getalldistribuedenabledbundles_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLDISTRIBUEDENABLEDBUNDLES_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLDISTRIBUEDENABLEDBUNDLES_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetalldistribuedenabledbundles_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLDISTRIBUEDENABLEDBUNDLES_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/BUILD.gn new file mode 100644 index 000000000..acd8b8038 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetAllLiveViewEnabledBundlesFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getallliveviewenabledbundles_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetAllLiveViewEnabledBundlesFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.cpp new file mode 100644 index 000000000..d3fd0620d --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getallliveviewenabledbundles_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.h new file mode 100644 index 000000000..6e6d0fefe --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallliveviewenabledbundles_fuzzer/service_getallliveviewenabledbundles_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLLIVEVIEWENABLEDBUNDLES_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLLIVEVIEWENABLEDBUNDLES_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetallliveviewenabledbundles_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLLIVEVIEWENABLEDBUNDLES_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/BUILD.gn new file mode 100644 index 000000000..cf9e61d39 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetAllNotificationsBySlotTypeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getallnotificationsbyslottype_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetAllNotificationsBySlotTypeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.cpp new file mode 100644 index 000000000..10f2c6df0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getallnotificationsbyslottype_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.h new file mode 100644 index 000000000..0a01b91fc --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetallnotificationsbyslottype_fuzzer/service_getallnotificationsbyslottype_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLNOTIFICATIONSBYSLOTTYPE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLNOTIFICATIONSBYSLOTTYPE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetallnotificationsbyslottype_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETALLNOTIFICATIONSBYSLOTTYPE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/BUILD.gn new file mode 100644 index 000000000..949a2c8f7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetBundleImportanceFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getbundleimportance_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetBundleImportanceFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.cpp new file mode 100644 index 000000000..3718993e6 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getbundleimportance_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.h new file mode 100644 index 000000000..a10702949 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetbundleimportance_fuzzer/service_getbundleimportance_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETBUNDLEIMPORTANCE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETBUNDLEIMPORTANCE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetbundleimportance_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETBUNDLEIMPORTANCE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/BUILD.gn new file mode 100644 index 000000000..f2b4dccf9 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetDeviceRemindTypeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getdeviceremindtype_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetDeviceRemindTypeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.cpp new file mode 100644 index 000000000..2ba549f41 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getdeviceremindtype_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.h new file mode 100644 index 000000000..7785bafa8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdeviceremindtype_fuzzer/service_getdeviceremindtype_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDEVICEREMINDTYPE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDEVICEREMINDTYPE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetdeviceremindtype_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDEVICEREMINDTYPE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/BUILD.gn new file mode 100644 index 000000000..2d85e7737 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetDoNotDisturbDateFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getdonotdisturbdate_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetDoNotDisturbDateFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.cpp new file mode 100644 index 000000000..275c98fc8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getdonotdisturbdate_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.h new file mode 100644 index 000000000..35c335ea0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbdate_fuzzer/service_getdonotdisturbdate_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDONOTDISTURBDATE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDONOTDISTURBDATE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetdonotdisturbdate_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDONOTDISTURBDATE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/BUILD.gn new file mode 100644 index 000000000..c2cc1201c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetDoNotDisturbProfileFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getdonotdisturbprofile_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetDoNotDisturbProfileFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.cpp new file mode 100644 index 000000000..589fe2098 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getdonotdisturbprofile_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.h new file mode 100644 index 000000000..01b436317 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetdonotdisturbprofile_fuzzer/service_getdonotdisturbprofile_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDONOTDISTURBPROFILE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDONOTDISTURBPROFILE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetdonotdisturbprofile_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETDONOTDISTURBPROFILE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/BUILD.gn new file mode 100644 index 000000000..1ccb0ea8d --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetEnabledForBundleSlotFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getenabledforbundleslot_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetEnabledForBundleSlotFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.cpp new file mode 100644 index 000000000..9c1a454e4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getenabledforbundleslot_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.h new file mode 100644 index 000000000..f5efd9e60 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslot_fuzzer/service_getenabledforbundleslot_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETENABLEDFORBUNDLESLOT_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETENABLEDFORBUNDLESLOT_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetenabledforbundleslot_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETENABLEDFORBUNDLESLOT_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/BUILD.gn new file mode 100644 index 000000000..13eb52445 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetEnabledForBundleSlotSelfFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getenabledforbundleslotself_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetEnabledForBundleSlotSelfFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.cpp new file mode 100644 index 000000000..e531760e0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getenabledforbundleslotself_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.h new file mode 100644 index 000000000..8227b08da --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetenabledforbundleslotself_fuzzer/service_getenabledforbundleslotself_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETENABLEDFORBUNDLESLOTSELF_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETENABLEDFORBUNDLESLOTSELF_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetenabledforbundleslotself_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETENABLEDFORBUNDLESLOTSELF_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/BUILD.gn new file mode 100644 index 000000000..b551cbf17 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetNotificationRequestByHashCodeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getnotificationrequestbyhashcode_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetNotificationRequestByHashCodeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp new file mode 100644 index 000000000..eb3146dfc --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getnotificationrequestbyhashcode_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.h new file mode 100644 index 000000000..3fe498ebe --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETNOTIFICATIONREQUESTBYHASHCODE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETNOTIFICATIONREQUESTBYHASHCODE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetnotificationrequestbyhashcode_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETNOTIFICATIONREQUESTBYHASHCODE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..60bc4dc1b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetShowBadgeEnabledForBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getshowbadgeenabledforbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetShowBadgeEnabledForBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.cpp new file mode 100644 index 000000000..27f21b34b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getshowbadgeenabledforbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.h new file mode 100644 index 000000000..fc82cd545 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetshowbadgeenabledforbundle_fuzzer/service_getshowbadgeenabledforbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSHOWBADGEENABLEDFORBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSHOWBADGEENABLEDFORBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetshowbadgeenabledforbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSHOWBADGEENABLEDFORBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..655b014c0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSlotByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getslotbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSlotByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp new file mode 100644 index 000000000..91f472ca6 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getslotbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.h new file mode 100644 index 000000000..9e047f50c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetslotbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/BUILD.gn new file mode 100644 index 000000000..6d4df5f85 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSlotByTypeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getslotbytype_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSlotByTypeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.cpp new file mode 100644 index 000000000..78e94faeb --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getslotbytype_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.h new file mode 100644 index 000000000..2d983a905 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotbytype_fuzzer/service_getslotbytype_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTBYTYPE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTBYTYPE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetslotbytype_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTBYTYPE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..d86bd49b4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSlotFlagsAsBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getslotflagsasbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSlotFlagsAsBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.cpp new file mode 100644 index 000000000..f7678c9b4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getslotflagsasbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.h new file mode 100644 index 000000000..9e8c906c0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotflagsasbundle_fuzzer/service_getslotflagsasbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTFLAGSASBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTFLAGSASBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetslotflagsasbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTFLAGSASBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..0e5b0ad71 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSlotNumAsBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getslotnumasbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSlotNumAsBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.cpp new file mode 100644 index 000000000..413992351 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getslotnumasbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.h new file mode 100644 index 000000000..9cfba785f --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotnumasbundle_fuzzer/service_getslotnumasbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTNUMASBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTNUMASBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetslotnumasbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTNUMASBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/BUILD.gn new file mode 100644 index 000000000..68eb224eb --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSlotsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getslots_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSlotsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.cpp new file mode 100644 index 000000000..27524e679 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getslots_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.h new file mode 100644 index 000000000..ef2854289 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslots_fuzzer/service_getslots_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetslots_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..bf14456f7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSlotsByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getslotsbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSlotsByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.cpp new file mode 100644 index 000000000..136a30d5f --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getslotsbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.h new file mode 100644 index 000000000..d919a9356 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetslotsbybundle_fuzzer/service_getslotsbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTSBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTSBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetslotsbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSLOTSBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/BUILD.gn new file mode 100644 index 000000000..a51a26063 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSpecialActiveNotificationsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getspecialactivenotifications_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSpecialActiveNotificationsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.cpp new file mode 100644 index 000000000..ff9661159 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getspecialactivenotifications_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.h new file mode 100644 index 000000000..b8b6dead5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetspecialactivenotifications_fuzzer/service_getspecialactivenotifications_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSPECIALACTIVENOTIFICATIONS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSPECIALACTIVENOTIFICATIONS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetspecialactivenotifications_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSPECIALACTIVENOTIFICATIONS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn new file mode 100644 index 000000000..e0f3dc99d --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetSyncNotificationEnabledWithoutAppFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_getsyncnotificationenabledwithoutapp_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetSyncNotificationEnabledWithoutAppFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp new file mode 100644 index 000000000..216c80c33 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_getsyncnotificationenabledwithoutapp_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.h new file mode 100644 index 000000000..86b0860f8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSYNCNOTIFICATIONENABLEDWITHOUTAPP_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSYNCNOTIFICATIONENABLEDWITHOUTAPP_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegetsyncnotificationenabledwithoutapp_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETSYNCNOTIFICATIONENABLEDWITHOUTAPP_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/BUILD.gn new file mode 100644 index 000000000..5e4ddb64b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceGetTargetDeviceStatusFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_gettargetdevicestatus_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceGetTargetDeviceStatusFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.cpp new file mode 100644 index 000000000..d0c2626b1 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_gettargetdevicestatus_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.h b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.h new file mode 100644 index 000000000..b6d4d4a62 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicegettargetdevicestatus_fuzzer/service_gettargetdevicestatus_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETTARGETDEVICESTATUS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETTARGETDEVICESTATUS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicegettargetdevicestatus_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_GETTARGETDEVICESTATUS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..a197e6704 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsDistributedEnableByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_isdistributedenablebybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsDistributedEnableByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.cpp new file mode 100644 index 000000000..bf25add01 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_isdistributedenablebybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.h new file mode 100644 index 000000000..439fefdd4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenablebybundle_fuzzer/service_isdistributedenablebybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceisdistributedenablebybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..a11064a52 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsDistributedEnabledByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_isdistributedenabledbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsDistributedEnabledByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.cpp new file mode 100644 index 000000000..88b9f0068 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_isdistributedenabledbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.h new file mode 100644 index 000000000..c7019f885 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbybundle_fuzzer/service_isdistributedenabledbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEDBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEDBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceisdistributedenabledbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEDBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/BUILD.gn new file mode 100644 index 000000000..11661c0ff --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsDistributedEnabledBySlotFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_isdistributedenabledbyslot_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsDistributedEnabledBySlotFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.cpp new file mode 100644 index 000000000..7bd99e816 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_isdistributedenabledbyslot_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.h new file mode 100644 index 000000000..c1a5c4f7e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisdistributedenabledbyslot_fuzzer/service_isdistributedenabledbyslot_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEDBYSLOT_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEDBYSLOT_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceisdistributedenabledbyslot_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISDISTRIBUTEDENABLEDBYSLOT_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/BUILD.gn new file mode 100644 index 000000000..c6e08f653 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsNeedSilentInDoNotDisturbModeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_isneedsilentindonotdisturbmode_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsNeedSilentInDoNotDisturbModeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.cpp new file mode 100644 index 000000000..7dc3a1027 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_isneedsilentindonotdisturbmode_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.h new file mode 100644 index 000000000..0854e96bc --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisneedsilentindonotdisturbmode_fuzzer/service_isneedsilentindonotdisturbmode_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISNEEDSILENTINDONOTDISTURBMODE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISNEEDSILENTINDONOTDISTURBMODE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceisneedsilentindonotdisturbmode_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISNEEDSILENTINDONOTDISTURBMODE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/BUILD.gn new file mode 100644 index 000000000..cf18ebb51 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsSmartReminderEnabledFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_issmartreminderenabled_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsSmartReminderEnabledFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.cpp new file mode 100644 index 000000000..8125f9c26 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_issmartreminderenabled_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.h new file mode 100644 index 000000000..dbd27885a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissmartreminderenabled_fuzzer/service_issmartreminderenabled_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSMARTREMINDERENABLED_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSMARTREMINDERENABLED_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceissmartreminderenabled_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSMARTREMINDERENABLED_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/BUILD.gn new file mode 100644 index 000000000..41990c033 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsSpecialBundleAllowedNotifyFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_isspecialbundleallowednotify_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsSpecialBundleAllowedNotifyFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.cpp new file mode 100644 index 000000000..190c6953a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_isspecialbundleallowednotify_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.h new file mode 100644 index 000000000..ec805bb4b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialbundleallowednotify_fuzzer/service_isspecialbundleallowednotify_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSPECIALBUNDLEALLOWEDNOTIFY_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSPECIALBUNDLEALLOWEDNOTIFY_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceisspecialbundleallowednotify_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSPECIALBUNDLEALLOWEDNOTIFY_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/BUILD.gn new file mode 100644 index 000000000..c9bbe0295 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsSpecialUserAllowedNotifyFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_isspecialuserallowednotify_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsSpecialUserAllowedNotifyFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.cpp new file mode 100644 index 000000000..ac4bd4345 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_isspecialuserallowednotify_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.h new file mode 100644 index 000000000..bd0aacc60 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceisspecialuserallowednotify_fuzzer/service_isspecialuserallowednotify_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSPECIALUSERALLOWEDNOTIFY_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSPECIALUSERALLOWEDNOTIFY_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceisspecialuserallowednotify_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSPECIALUSERALLOWEDNOTIFY_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/BUILD.gn new file mode 100644 index 000000000..508be9a52 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceIsSupportTemplateFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_issupporttemplate_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceIsSupportTemplateFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.cpp new file mode 100644 index 000000000..4624afca3 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_issupporttemplate_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.h new file mode 100644 index 000000000..a462c1e1c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceissupporttemplate_fuzzer/service_issupporttemplate_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSUPPORTTEMPLATE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSUPPORTTEMPLATE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceissupporttemplate_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_ISSUPPORTTEMPLATE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..ba03f55b6 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServicePublishAsBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_publishasbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServicePublishAsBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp new file mode 100644 index 000000000..5554a3043 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_publishasbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.h new file mode 100644 index 000000000..d8676b107 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHASBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHASBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicepublishasbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHASBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/BUILD.gn new file mode 100644 index 000000000..d4c42f64b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServicePublishAsBundleWithMaxCapacityFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_publishasbundlewithmaxcapacity_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServicePublishAsBundleWithMaxCapacityFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.cpp new file mode 100644 index 000000000..55b275228 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_publishasbundlewithmaxcapacity_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.h b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.h new file mode 100644 index 000000000..a608535bd --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundlewithmaxcapacity_fuzzer/service_publishasbundlewithmaxcapacity_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHASBUNDLEWITHMAXCAPACITY_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHASBUNDLEWITHMAXCAPACITY_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicepublishasbundlewithmaxcapacity_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHASBUNDLEWITHMAXCAPACITY_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/BUILD.gn new file mode 100644 index 000000000..d0cec3ade --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServicePublishContinuousTaskNotificationFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_publishcontinuoustasknotification_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServicePublishContinuousTaskNotificationFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.cpp new file mode 100644 index 000000000..e6c52125a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_publishcontinuoustasknotification_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.h b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.h new file mode 100644 index 000000000..8b1349f85 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishcontinuoustasknotification_fuzzer/service_publishcontinuoustasknotification_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHCONTINUOUSTASKNOTIFICATION_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHCONTINUOUSTASKNOTIFICATION_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicepublishcontinuoustasknotification_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHCONTINUOUSTASKNOTIFICATION_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/BUILD.gn new file mode 100644 index 000000000..5d5d800e1 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServicePublishForIndirectProxyWithMaxCapacityFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_publishforindirectproxywithmaxcapacity_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServicePublishForIndirectProxyWithMaxCapacityFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.cpp new file mode 100644 index 000000000..ab9560a53 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_publishforindirectproxywithmaxcapacity_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.h b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.h new file mode 100644 index 000000000..c6edfd69d --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishforindirectproxywithmaxcapacity_fuzzer/service_publishforindirectproxywithmaxcapacity_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHFORINDIRECTPROXYWITHMAXCAPACITY_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHFORINDIRECTPROXYWITHMAXCAPACITY_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicepublishforindirectproxywithmaxcapacity_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHFORINDIRECTPROXYWITHMAXCAPACITY_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/BUILD.gn new file mode 100644 index 000000000..5f0000d43 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServicePublishNotificationForIndirectProxyFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_publishnotificationforindirectproxy_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServicePublishNotificationForIndirectProxyFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.cpp new file mode 100644 index 000000000..5aafc6827 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_publishnotificationforindirectproxy_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.h b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.h new file mode 100644 index 000000000..c10c33458 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishnotificationforindirectproxy_fuzzer/service_publishnotificationforindirectproxy_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHNOTIFICATIONFORINDIRECTPROXY_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHNOTIFICATIONFORINDIRECTPROXY_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicepublishnotificationforindirectproxy_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHNOTIFICATIONFORINDIRECTPROXY_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/BUILD.gn new file mode 100644 index 000000000..d29541a65 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServicePublishWithMaxCapacityFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_publishwithmaxcapacity_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServicePublishWithMaxCapacityFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.cpp new file mode 100644 index 000000000..e4b02db21 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_publishwithmaxcapacity_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.h b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.h new file mode 100644 index 000000000..995266495 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicepublishwithmaxcapacity_fuzzer/service_publishwithmaxcapacity_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHWITHMAXCAPACITY_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHWITHMAXCAPACITY_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicepublishwithmaxcapacity_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_PUBLISHWITHMAXCAPACITY_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/BUILD.gn new file mode 100644 index 000000000..04bd2c441 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRegisterPushCallbackFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_registerpushcallback_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRegisterPushCallbackFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp new file mode 100644 index 000000000..56f10cdda --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_registerpushcallback_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.h new file mode 100644 index 000000000..0b8ee1012 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REGISTERPUSHCALLBACK_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REGISTERPUSHCALLBACK_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceregisterpushcallback_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REGISTERPUSHCALLBACK_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/BUILD.gn new file mode 100644 index 000000000..0ce92734d --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveAllNotificationsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removeallnotifications_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveAllNotificationsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.cpp new file mode 100644 index 000000000..e759156ff --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removeallnotifications_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.h new file mode 100644 index 000000000..566da5cd7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveallnotifications_fuzzer/service_removeallnotifications_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEALLNOTIFICATIONS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEALLNOTIFICATIONS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremoveallnotifications_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEALLNOTIFICATIONS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/BUILD.gn new file mode 100644 index 000000000..b9b100066 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveDistributedNotificationsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removedistributednotifications_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveDistributedNotificationsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.cpp new file mode 100644 index 000000000..9152e6dd5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removedistributednotifications_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.h new file mode 100644 index 000000000..aee6e9338 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedistributednotifications_fuzzer/service_removedistributednotifications_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEDISTRIBUTEDNOTIFICATIONS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEDISTRIBUTEDNOTIFICATIONS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremovedistributednotifications_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEDISTRIBUTEDNOTIFICATIONS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/BUILD.gn new file mode 100644 index 000000000..9403bf374 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveDoNotDisturbProfilesFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removedonotdisturbprofiles_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveDoNotDisturbProfilesFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.cpp new file mode 100644 index 000000000..e8692ec11 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removedonotdisturbprofiles_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.h new file mode 100644 index 000000000..7b34246df --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovedonotdisturbprofiles_fuzzer/service_removedonotdisturbprofiles_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEDONOTDISTURBPROFILES_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEDONOTDISTURBPROFILES_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremovedonotdisturbprofiles_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEDONOTDISTURBPROFILES_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..a28c4f663 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveGroupByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removegroupbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveGroupByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.cpp new file mode 100644 index 000000000..72aa484a5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removegroupbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.h new file mode 100644 index 000000000..53e10ac3b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovegroupbybundle_fuzzer/service_removegroupbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEGROUPBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEGROUPBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremovegroupbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVEGROUPBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/BUILD.gn new file mode 100644 index 000000000..19cba67fe --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveNotificationFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removenotification_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveNotificationFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp new file mode 100644 index 000000000..c66de57b1 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removenotification_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.h new file mode 100644 index 000000000..e68539447 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVENOTIFICATION_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVENOTIFICATION_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremovenotification_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVENOTIFICATION_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/BUILD.gn new file mode 100644 index 000000000..3a0e805c7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveNotificationsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removenotifications_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveNotificationsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.cpp new file mode 100644 index 000000000..855b2ecac --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removenotifications_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.h new file mode 100644 index 000000000..1374b9887 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremovenotifications_fuzzer/service_removenotifications_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVENOTIFICATIONS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVENOTIFICATIONS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremovenotifications_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVENOTIFICATIONS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/BUILD.gn new file mode 100644 index 000000000..d8fa057dc --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRemoveSlotByTypeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_removeslotbytype_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRemoveSlotByTypeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.cpp new file mode 100644 index 000000000..4564b2a6b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_removeslotbytype_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.h new file mode 100644 index 000000000..76c4cd385 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceremoveslotbytype_fuzzer/service_removeslotbytype_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVESLOTBYTYPE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVESLOTBYTYPE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceremoveslotbytype_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REMOVESLOTBYTYPE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/BUILD.gn new file mode 100644 index 000000000..84927d33c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceReplyDistributeOperationFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_replydistributeoperation_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceReplyDistributeOperationFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.cpp new file mode 100644 index 000000000..63d4ccdf0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_replydistributeoperation_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.h b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.h new file mode 100644 index 000000000..245cd51a0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicereplydistributeoperation_fuzzer/service_replydistributeoperation_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REPLYDISTRIBUTEOPERATION_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REPLYDISTRIBUTEOPERATION_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicereplydistributeoperation_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REPLYDISTRIBUTEOPERATION_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/BUILD.gn new file mode 100644 index 000000000..75931363b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceRequestEnableNotificationFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_requestenablenotification_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceRequestEnableNotificationFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.cpp new file mode 100644 index 000000000..49d9e41e6 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_requestenablenotification_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.h b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.h new file mode 100644 index 000000000..d62aac612 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicerequestenablenotification_fuzzer/service_requestenablenotification_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REQUESTENABLENOTIFICATION_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REQUESTENABLENOTIFICATION_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicerequestenablenotification_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_REQUESTENABLENOTIFICATION_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/BUILD.gn new file mode 100644 index 000000000..466c99fc8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetAdditionConfigFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setadditionconfig_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetAdditionConfigFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.cpp new file mode 100644 index 000000000..81d75e4cd --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setadditionconfig_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.h new file mode 100644 index 000000000..c055c7910 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetadditionconfig_fuzzer/service_setadditionconfig_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETADDITIONCONFIG_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETADDITIONCONFIG_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetadditionconfig_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETADDITIONCONFIG_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/BUILD.gn new file mode 100644 index 000000000..3bce683e0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetBadgeNumberFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setbadgenumber_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetBadgeNumberFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.cpp new file mode 100644 index 000000000..1f6c7e0c0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setbadgenumber_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.h new file mode 100644 index 000000000..589c82d03 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumber_fuzzer/service_setbadgenumber_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBER_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBER_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetbadgenumber_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBER_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..841298385 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetBadgeNumberByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setbadgenumberbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetBadgeNumberByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.cpp new file mode 100644 index 000000000..a8124318c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setbadgenumberbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.h new file mode 100644 index 000000000..1f577f50a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberbybundle_fuzzer/service_setbadgenumberbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBERBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBERBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetbadgenumberbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBERBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..d38ae0cae --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetBadgeNumberForDhByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setbadgenumberfordhbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetBadgeNumberForDhByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp new file mode 100644 index 000000000..df8ad3cc7 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setbadgenumberfordhbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.h new file mode 100644 index 000000000..49bb244eb --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBERFORDHBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBERFORDHBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetbadgenumberfordhbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETBADGENUMBERFORDHBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..9c709baf5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetDistributedEnabledByBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setdistributedenabledbybundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetDistributedEnabledByBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp new file mode 100644 index 000000000..466d90492 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setdistributedenabledbybundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.h new file mode 100644 index 000000000..ed6750734 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDISTRIBUTEDENABLEDBYBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDISTRIBUTEDENABLEDBYBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetdistributedenabledbybundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDISTRIBUTEDENABLEDBYBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/BUILD.gn new file mode 100644 index 000000000..30f40913e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetDistributedEnabledBySlotFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setdistributedenabledbyslot_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetDistributedEnabledBySlotFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.cpp new file mode 100644 index 000000000..8be81f13c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setdistributedenabledbyslot_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.h new file mode 100644 index 000000000..bd0928b25 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbyslot_fuzzer/service_setdistributedenabledbyslot_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDISTRIBUTEDENABLEDBYSLOT_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDISTRIBUTEDENABLEDBYSLOT_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetdistributedenabledbyslot_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDISTRIBUTEDENABLEDBYSLOT_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/BUILD.gn new file mode 100644 index 000000000..818fbbb4b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetDoNotDisturbDateFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setdonotdisturbdate_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetDoNotDisturbDateFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.cpp new file mode 100644 index 000000000..607e56a4b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setdonotdisturbdate_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.h new file mode 100644 index 000000000..1dbb94705 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetdonotdisturbdate_fuzzer/service_setdonotdisturbdate_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDONOTDISTURBDATE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDONOTDISTURBDATE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetdonotdisturbdate_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETDONOTDISTURBDATE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/BUILD.gn new file mode 100644 index 000000000..6ca90b719 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetEnabledForBundleSlotFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setenabledforbundleslot_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetEnabledForBundleSlotFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.cpp new file mode 100644 index 000000000..2d69fed75 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setenabledforbundleslot_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.h new file mode 100644 index 000000000..3b6c3ee44 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetenabledforbundleslot_fuzzer/service_setenabledforbundleslot_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETENABLEDFORBUNDLESLOT_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETENABLEDFORBUNDLESLOT_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetenabledforbundleslot_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETENABLEDFORBUNDLESLOT_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/BUILD.gn new file mode 100644 index 000000000..76e29e78f --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetHashCodeRuleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_sethashcoderule_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetHashCodeRuleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.cpp new file mode 100644 index 000000000..f072f76d9 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_sethashcoderule_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.h new file mode 100644 index 000000000..7f44085f2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesethashcoderule_fuzzer/service_sethashcoderule_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETHASHCODERULE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETHASHCODERULE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesethashcoderule_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETHASHCODERULE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/BUILD.gn new file mode 100644 index 000000000..ca8b2675e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetNotificationBadgeNumFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setnotificationbadgenum_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetNotificationBadgeNumFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.cpp new file mode 100644 index 000000000..9dab544e4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setnotificationbadgenum_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.h new file mode 100644 index 000000000..b617aa2c5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationbadgenum_fuzzer/service_setnotificationbadgenum_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONBADGENUM_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONBADGENUM_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetnotificationbadgenum_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONBADGENUM_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/BUILD.gn new file mode 100644 index 000000000..a00b1a251 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetNotificationsEnabledByUserFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setnotificationsenabledbyuser_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetNotificationsEnabledByUserFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.cpp new file mode 100644 index 000000000..0f8c4f830 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setnotificationsenabledbyuser_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.h new file mode 100644 index 000000000..eb6138262 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledbyuser_fuzzer/service_setnotificationsenabledbyuser_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDBYUSER_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDBYUSER_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetnotificationsenabledbyuser_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDBYUSER_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/BUILD.gn new file mode 100644 index 000000000..e1edcca89 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetNotificationsEnabledForAllBundlesFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setnotificationsenabledforallbundles_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetNotificationsEnabledForAllBundlesFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.cpp new file mode 100644 index 000000000..e4feac67e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setnotificationsenabledforallbundles_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.h new file mode 100644 index 000000000..6d708e656 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforallbundles_fuzzer/service_setnotificationsenabledforallbundles_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORALLBUNDLES_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORALLBUNDLES_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetnotificationsenabledforallbundles_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORALLBUNDLES_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..957b93fb3 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetNotificationsEnabledForBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setnotificationsenabledforbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetNotificationsEnabledForBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.cpp new file mode 100644 index 000000000..e7b0cd253 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setnotificationsenabledforbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.h new file mode 100644 index 000000000..7c836ece2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforbundle_fuzzer/service_setnotificationsenabledforbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetnotificationsenabledforbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..62fc87c33 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetNotificationsEnabledForSpecialBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setnotificationsenabledforspecialbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetNotificationsEnabledForSpecialBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.cpp new file mode 100644 index 000000000..cd56aa1b5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setnotificationsenabledforspecialbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.h new file mode 100644 index 000000000..244621683 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetnotificationsenabledforspecialbundle_fuzzer/service_setnotificationsenabledforspecialbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORSPECIALBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORSPECIALBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetnotificationsenabledforspecialbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETNOTIFICATIONSENABLEDFORSPECIALBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..7af08c1c1 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetShowBadgeEnabledForBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setshowbadgeenabledforbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetShowBadgeEnabledForBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.cpp new file mode 100644 index 000000000..3c1f6ccd6 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setshowbadgeenabledforbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.h new file mode 100644 index 000000000..b13bf4ea8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetshowbadgeenabledforbundle_fuzzer/service_setshowbadgeenabledforbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSHOWBADGEENABLEDFORBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSHOWBADGEENABLEDFORBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetshowbadgeenabledforbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSHOWBADGEENABLEDFORBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/BUILD.gn new file mode 100644 index 000000000..cbb32fcb3 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetSlotFlagsAsBundleFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setslotflagsasbundle_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetSlotFlagsAsBundleFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp new file mode 100644 index 000000000..dbf0f5a56 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setslotflagsasbundle_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.h new file mode 100644 index 000000000..3925e0f52 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSLOTFLAGSASBUNDLE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSLOTFLAGSASBUNDLE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetslotflagsasbundle_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSLOTFLAGSASBUNDLE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/BUILD.gn new file mode 100644 index 000000000..c5c8ecb90 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetSmartReminderEnabledFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setsmartreminderenabled_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetSmartReminderEnabledFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.cpp new file mode 100644 index 000000000..84d14dac4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setsmartreminderenabled_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.h new file mode 100644 index 000000000..6264607e9 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsmartreminderenabled_fuzzer/service_setsmartreminderenabled_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSMARTREMINDERENABLED_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSMARTREMINDERENABLED_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetsmartreminderenabled_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSMARTREMINDERENABLED_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn new file mode 100644 index 000000000..6fa00072c --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetSyncNotificationEnabledWithoutAppFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_setsyncnotificationenabledwithoutapp_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetSyncNotificationEnabledWithoutAppFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.cpp new file mode 100644 index 000000000..461f370a0 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_setsyncnotificationenabledwithoutapp_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.h new file mode 100644 index 000000000..9807b345b --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesetsyncnotificationenabledwithoutapp_fuzzer/service_setsyncnotificationenabledwithoutapp_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSYNCNOTIFICATIONENABLEDWITHOUTAPP_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSYNCNOTIFICATIONENABLEDWITHOUTAPP_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesetsyncnotificationenabledwithoutapp_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETSYNCNOTIFICATIONENABLEDWITHOUTAPP_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/BUILD.gn new file mode 100644 index 000000000..04bbfc444 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSetTargetDeviceStatusFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_settargetdevicestatus_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSetTargetDeviceStatusFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.cpp new file mode 100644 index 000000000..0fdfc728a --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_settargetdevicestatus_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.h new file mode 100644 index 000000000..4ceabc666 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesettargetdevicestatus_fuzzer/service_settargetdevicestatus_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETTARGETDEVICESTATUS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETTARGETDEVICESTATUS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesettargetdevicestatus_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SETTARGETDEVICESTATUS_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/BUILD.gn new file mode 100644 index 000000000..a33ad5f99 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceShellDumpFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_shelldump_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceShellDumpFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.cpp new file mode 100644 index 000000000..02c33df27 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_shelldump_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.h new file mode 100644 index 000000000..f9e7f9544 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceshelldump_fuzzer/service_shelldump_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SHELLDUMP_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SHELLDUMP_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceshelldump_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SHELLDUMP_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/BUILD.gn new file mode 100644 index 000000000..bf65cdae4 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSubscribeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_subscribe_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSubscribeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp new file mode 100644 index 000000000..991515ae6 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_subscribe_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.h new file mode 100644 index 000000000..d37757656 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesubscribe_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/BUILD.gn new file mode 100644 index 000000000..6bb68e6ea --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSubscribeLocalLiveViewFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_subscribelocalliveview_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSubscribeLocalLiveViewFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.cpp new file mode 100644 index 000000000..e6da395d5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_subscribelocalliveview_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.h new file mode 100644 index 000000000..73e3903bf --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribelocalliveview_fuzzer/service_subscribelocalliveview_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBELOCALLIVEVIEW_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBELOCALLIVEVIEW_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesubscribelocalliveview_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBELOCALLIVEVIEW_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/BUILD.gn new file mode 100644 index 000000000..fecde78fa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceSubscribeSelfFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_subscribeself_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceSubscribeSelfFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.cpp new file mode 100644 index 000000000..3b6f9baee --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_subscribeself_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.h b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.h new file mode 100644 index 000000000..f6b29a302 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicesubscribeself_fuzzer/service_subscribeself_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBESELF_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBESELF_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicesubscribeself_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_SUBSCRIBESELF_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/BUILD.gn new file mode 100644 index 000000000..49a137a08 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceTriggerLocalLiveViewFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_triggerlocalliveview_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceTriggerLocalLiveViewFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.cpp new file mode 100644 index 000000000..f2271c6a8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_triggerlocalliveview_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.h b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.h new file mode 100644 index 000000000..30095113e --- /dev/null +++ b/test/fuzztest/advancednotificationservice/servicetriggerlocalliveview_fuzzer/service_triggerlocalliveview_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_TRIGGERLOCALLIVEVIEW_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_TRIGGERLOCALLIVEVIEW_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationservicetriggerlocalliveview_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_TRIGGERLOCALLIVEVIEW_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/BUILD.gn new file mode 100644 index 000000000..762d860f8 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceUnsubscribeFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_unsubscribe_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceUnsubscribeFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.cpp new file mode 100644 index 000000000..f9ed56c04 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_unsubscribe_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.h new file mode 100644 index 000000000..d85e77f89 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceunsubscribe_fuzzer/service_unsubscribe_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UNSUBSCRIBE_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UNSUBSCRIBE_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceunsubscribe_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UNSUBSCRIBE_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/BUILD.gn new file mode 100644 index 000000000..1b855d7c5 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceUpdateNotificationTimerByUidFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_updatenotificationtimerbyuid_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceUpdateNotificationTimerByUidFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.cpp new file mode 100644 index 000000000..265809119 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_updatenotificationtimerbyuid_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.h new file mode 100644 index 000000000..15a202421 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdatenotificationtimerbyuid_fuzzer/service_updatenotificationtimerbyuid_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UPDATENOTIFICATIONTIMERBYUID_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UPDATENOTIFICATIONTIMERBYUID_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceupdatenotificationtimerbyuid_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UPDATENOTIFICATIONTIMERBYUID_FUZZER_H \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/BUILD.gn b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/BUILD.gn new file mode 100644 index 000000000..b56ee9d99 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/BUILD.gn @@ -0,0 +1,152 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//base/notification/distributed_notification_service/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("ServiceUpdateSlotsFuzzTest") { + module_out_path = service_fuzz_test_path + fuzz_config_file = + "${component_path}/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer" + include_dirs = [ "${services_path}/ans/include" ] + cflags = [ + "-fno-math-errno", + "-fno-unroll-loops", + "-fmerge-all-constants", + "-fno-ident", + "-Oz", + "-flto", + "-ffunction-sections", + "-fdata-sections", + ] + sources = [ "service_updateslots_fuzzer.cpp" ] + defines = [] + deps = [ + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_common_base", + "${component_path}/test/fuzztest/fuzz_common_base:fuzz_mock_object", + "${frameworks_module_ans_path}:ans_innerkits", + "${services_path}/ans:ans_service_sources" + ] + if (is_double_framework) { + cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] + } + + if (distributed_notification_supported) { + defines += [ "DISTRIBUTED_NOTIFICATION_SUPPORTED" ] + deps += [ "${services_path}/distributed:libans_distributed" ] + include_dirs += [ "${services_path}/distributed/include" ] + } + + if (notification_smart_reminder_supported) { + defines += [ "NOTIFICATION_SMART_REMINDER_SUPPORTED" ] + } + + external_deps = [ + "ability_base:configuration", + "ability_runtime:ability_manager", + "ability_runtime:app_manager", + "ability_runtime:appkit_native", + "ability_runtime:dataobs_manager", + "ability_runtime:extension_manager", + "ability_runtime:wantagent_innerkits", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "config_policy:configpolicy_util", + "data_share:datashare_common", + "data_share:datashare_consumer", + "data_share:datashare_permission", + "device_manager:devicemanagersdk", + "ffrt:libffrt", + "hilog:libhilog", + "i18n:intl_util", + "image_framework:image_native", + "init:libbegetutil", + "kv_store:distributeddata_inner", + "openssl:libcrypto_shared", + "os_account:os_account_innerkits", + "relational_store:native_rdb", + "resource_management:global_resmgr", + "time_service:time_client", + ] + external_deps += component_external_deps + + if (device_usage) { + external_deps += [ "device_usage_statistics:usagestatsinner" ] + defines += [ "DEVICE_USAGE_STATISTICS_ENABLE" ] + } + + if (hisysevent_usage) { + cflags += [ "-DHAS_HISYSEVENT_PART" ] + external_deps += [ "hisysevent:libhisysevent" ] + } + + if (standby_enable) { + external_deps += [ "device_standby:standby_innerkits" ] + defines += [ "DEVICE_STANDBY_ENABLE" ] + } + + if (player_framework) { + external_deps += [ "player_framework:media_client" ] + defines += [ "PLAYER_FRAMEWORK_ENABLE" ] + } + + if (ans_hitrace_usage) { + external_deps += [ "hitrace:hitrace_meter" ] + defines += [ "HITRACE_METER_ENABLE" ] + } + + if (ans_config_policy_enable) { + external_deps += [ "config_policy:configpolicy_util" ] + defines += [ "CONFIG_POLICY_ENABLE" ] + } + + if (screenlock_mgr_enable) { + external_deps += [ "screenlock_mgr:screenlock_client" ] + defines += [ "SCREENLOCK_MGR_ENABLE" ] + } + + if (distributed_notification_service_feature_additional_control || + distributed_notification_service_feature_privileged_message) { + defines += [ "ENABLE_ANS_EXT_WRAPPER" ] + } + + if (distributed_notification_service_feature_additional_control) { + defines += [ "ENABLE_ANS_ADDITIONAL_CONTROL" ] + } + + if (distributed_notification_service_feature_summary) { + defines += [ "ENABLE_ANS_AGGREGATION" ] + } + + if (telephony_cust) { + defines += [ "ENABLE_ANS_TELEPHONY_CUST_WRAPPER" ] + } + + if (distributed_notification_service_feature_disable_fa_model) { + defines += [ "ANS_DISABLE_FA_MODEL" ] + } +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":ServiceUpdateSlotsFuzzTest" ] +} +############################################################################### diff --git a/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/corpus/init b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/corpus/init new file mode 100644 index 000000000..d9719cafa --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/project.xml b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/project.xml new file mode 100644 index 000000000..226522bd2 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 10000 + + 300 + + 4096 + + diff --git a/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.cpp new file mode 100644 index 000000000..098266716 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "service_updateslots_fuzzer.h" + +#include +#include "advanced_notification_service.h" +#include "ans_permission_def.h" +#include "mock_notification_request.h" + +namespace OHOS { +namespace Notification { + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) + { + return true; + } +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + FuzzedDataProvider fdp(data, size); + OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); + return 0; +} diff --git a/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.h b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.h new file mode 100644 index 000000000..44dca2a47 --- /dev/null +++ b/test/fuzztest/advancednotificationservice/serviceupdateslots_fuzzer/service_updateslots_fuzzer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UPDATESLOTS_FUZZER_H +#define TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UPDATESLOTS_FUZZER_H + +#include "fuzz_common_base.h" +#include + +#define FUZZ_PROJECT_NAME "advancednotificationserviceupdateslots_fuzzer" + +#endif // TEST_FUZZTEST_ADVANCEDNOTIFICATIONSERVICE_FUZZER_SERVICE_UPDATESLOTS_FUZZER_H \ No newline at end of file -- Gitee