1# Copyright (c) 2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/config/features.gni") 15import("//build/test.gni") 16import("../../../accessibility.gni") 17import("../../../appgallery.gni") 18import("../../../av_session.gni") 19import("../../../bluetooth_part.gni") 20import("../../../config.gni") 21 22ohos_fuzztest("AudioPolicyServiceEnhanceFuzzTest") { 23 module_out_path = "audio_framework/audio_framework_route" 24 fuzz_config_file = "../audiopolicyserviceenhance_fuzzer" 25 26 include_dirs = [ 27 "../../../services/audio_policy/server/include", 28 "../../../services/audio_policy/server/include/service", 29 "../../../services/audio_policy/server/include/service/manager", 30 "../../../services/audio_policy/server/include/service/service", 31 ] 32 cflags = [ 33 "-g", 34 "-O0", 35 "-Wno-unused-variable", 36 "-fno-omit-frame-pointer", 37 ] 38 39 cflags_cc = cflags 40 cflags_cc += [ "-fno-access-control" ] 41 42 configs = [ "../../../services/audio_policy:audio_policy_public_config" ] 43 44 sources = [ "audio_policy_service_enhance_fuzzer.cpp" ] 45 46 deps = [ 47 "../../../services/audio_policy:audio_policy_service_static", 48 "../../../services/audio_service:audio_client", 49 ] 50 51 external_deps = [ 52 "ability_base:session_info", 53 "ability_base:want", 54 "ability_base:zuri", 55 "ability_runtime:ability_connect_callback_stub", 56 "ability_runtime:ability_context_native", 57 "ability_runtime:app_context", 58 "ability_runtime:dataobs_manager", 59 "ability_runtime:extension_manager", 60 "ability_runtime:wantagent_innerkits", 61 "access_token:libaccesstoken_sdk", 62 "access_token:libnativetoken_shared", 63 "access_token:libprivacy_sdk", 64 "access_token:libtokenid_sdk", 65 "access_token:libtokensetproc_shared", 66 "background_task_mgr:bgtaskmgr_innerkits", 67 "bounds_checking_function:libsec_shared", 68 "bundle_framework:appexecfwk_base", 69 "bundle_framework:appexecfwk_core", 70 "c_utils:utils", 71 "data_share:datashare_common", 72 "data_share:datashare_consumer", 73 "drivers_interface_audio:libaudio_proxy_5.0", 74 "eventhandler:libeventhandler", 75 "hdf_core:libhdf_host", 76 "hdf_core:libhdf_ipc_adapter", 77 "hdf_core:libhdf_utils", 78 "hdf_core:libhdi", 79 "hdf_core:libpub_utils", 80 "hilog:libhilog", 81 "hisysevent:libhisysevent", 82 "init:libbegetutil", 83 "ipc:ipc_single", 84 "kv_store:distributeddata_inner", 85 "media_foundation:media_monitor_client", 86 "media_foundation:media_monitor_common", 87 "os_account:os_account_innerkits", 88 "power_manager:power_setting", 89 "power_manager:powermgr_client", 90 "relational_store:native_appdatafwk", 91 "safwk:system_ability_fwk", 92 "samgr:samgr_proxy", 93 ] 94 95 public_external_deps = [ "ffrt:libffrt" ] 96 97 public_external_deps += [ 98 "libxml2:libxml2", 99 "openssl:libcrypto_shared", 100 ] 101 102 if (accessibility_enable == true) { 103 external_deps += [ 104 "accessibility:accessibility_common", 105 "accessibility:accessibilityconfig", 106 ] 107 } 108 109 if (avsession_part_enable == true) { 110 external_deps += [ 111 "ability_base:want", 112 "ability_runtime:wantagent_innerkits", 113 "av_session:avsession_client", 114 "input:libmmi-client", 115 ] 116 } 117 118 defines = [] 119 120 if (audio_framework_feature_usb_audio) { 121 defines += [ "USB_ENABLE" ] 122 external_deps += [ "usb_manager:usbsrv_client" ] 123 } 124 125 if (build_variant == "user") { 126 defines += [ "AUDIO_BUILD_VARIANT_USER" ] 127 } else if (build_variant == "root") { 128 defines += [ "AUDIO_BUILD_VARIANT_ROOT" ] 129 } 130 131 if (audio_framework_feature_support_os_account) { 132 defines += [ "SUPPORT_USER_ACCOUNT" ] 133 } 134 135 if (audio_framework_feature_dtmf_tone) { 136 defines += [ "FEATURE_DTMF_TONE" ] 137 } 138 139 if (audio_framework_config_policy_enable) { 140 defines += [ "USE_CONFIG_POLICY" ] 141 external_deps += [ "config_policy:configpolicy_util" ] 142 } 143 144 if (accessibility_enable == true) { 145 external_deps += [ 146 "accessibility:accessibility_common", 147 "accessibility:accessibilityconfig", 148 ] 149 } 150 151 if (appgallery_part_enable == true) { 152 defines += [ "FEATURE_APPGALLERY" ] 153 } 154 155 if (bluetooth_part_enable == true) { 156 deps += 157 [ "../../../frameworks/native/bluetoothclient:audio_bluetooth_client" ] 158 external_deps += [ "bluetooth:btframework" ] 159 } 160 161 if (audio_framework_feature_input) { 162 defines += [ "FEATURE_MULTIMODALINPUT_INPUT" ] 163 external_deps += [ "input:libmmi-client" ] 164 } 165 166 if (audio_framework_feature_device_manager) { 167 defines += [ "FEATURE_DEVICE_MANAGER" ] 168 external_deps += [ "device_manager:devicemanagersdk" ] 169 } 170 171 if (use_libfuzzer || use_clang_coverage) { 172 defines += [ "TEST_COVERAGE" ] 173 } 174 175 if (accessibility_enable == true) { 176 cflags += [ "-DACCESSIBILITY_ENABLE" ] 177 } 178 179 if (bluetooth_part_enable == true) { 180 cflags += [ "-DBLUETOOTH_ENABLE" ] 181 } 182 183 if (avsession_part_enable == true) { 184 cflags += [ "-DAVSESSION_ENABLE" ] 185 } 186} 187 188group("fuzztest") { 189 testonly = true 190 deps = [ ":AudioPolicyServiceEnhanceFuzzTest" ] 191} 192