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("../../../bluetooth_part.gni")
19import("../../../config.gni")
20
21ohos_fuzztest("AudioPolicyMoreFuzzTest") {
22  module_out_path = "audio_framework/audio_framework_route"
23  fuzz_config_file = "../audiopolicymore_fuzzer"
24
25  include_dirs = [
26    "../../../services/audio_policy/client/include",
27    "../../../services/audio_policy/server/include",
28    "../../../../../communication/bluetooth/interfaces/inner_api/include",
29    "../../../interfaces/inner_api/native/audiomanager/include",
30    "../../../frameworks/native/commcon/include",
31    "../../../interfaces/inner_api/native/audiocommon/include",
32    "../../../services/audio_policy/server/src/service/interrupt",
33    "../../../utils/system/safwk/native/include",
34    "../../../../communication/bluetooth/interfaces/inner_api/include",
35  ]
36
37  cflags = [
38    "-g",
39    "-O0",
40    "-fno-omit-frame-pointer",
41  ]
42  configs = [ "../../../services/audio_policy:audio_policy_public_config" ]
43  cflags_cc = cflags
44  cflags_cc += [ "-fno-access-control" ]
45
46  sources = [ "audio_policy_more_fuzzer.cpp" ]
47
48  deps = [
49    "../../../services/audio_policy:audio_policy_client",
50    "../../../services/audio_policy:audio_policy_service",
51  ]
52  external_deps = [
53    "ability_base:session_info",
54    "ability_base:want",
55    "ability_base:zuri",
56    "ability_runtime:ability_connect_callback_stub",
57    "ability_runtime:ability_context_native",
58    "ability_runtime:ability_manager",
59    "ability_runtime:app_context",
60    "ability_runtime:dataobs_manager",
61    "ability_runtime:extension_manager",
62    "access_token:libaccesstoken_sdk",
63    "access_token:libnativetoken_shared",
64    "access_token:libprivacy_sdk",
65    "access_token:libtokenid_sdk",
66    "access_token:libtokensetproc_shared",
67    "bounds_checking_function:libsec_shared",
68    "bundle_framework:appexecfwk_base",
69    "bundle_framework:appexecfwk_base",
70    "bundle_framework:appexecfwk_core",
71    "bundle_framework:appexecfwk_core",
72    "c_utils:utils",
73    "c_utils:utils",
74    "data_share:datashare_common",
75    "data_share:datashare_common",
76    "data_share:datashare_consumer",
77    "data_share:datashare_consumer",
78    "drivers_interface_audio:libaudio_proxy_4.0",
79    "eventhandler:libeventhandler",
80    "hdf_core:libhdf_host",
81    "hdf_core:libhdf_ipc_adapter",
82    "hdf_core:libhdf_ipc_adapter",
83    "hdf_core:libhdf_utils",
84    "hdf_core:libhdi",
85    "hdf_core:libhdi",
86    "hdf_core:libpub_utils",
87    "hdf_core:libpub_utils",
88    "hilog:libhilog",
89    "hilog:libhilog",
90    "hisysevent:libhisysevent",
91    "init:libbegetutil",
92    "ipc:ipc_single",
93    "ipc:ipc_single",
94    "kv_store:distributeddata_inner",
95    "kv_store:distributeddata_inner",
96    "media_foundation:media_monitor_client",
97    "media_foundation:media_monitor_common",
98    "os_account:os_account_innerkits",
99    "os_account:os_account_innerkits",
100    "power_manager:power_setting",
101    "power_manager:powermgr_client",
102    "power_manager:powermgr_client",
103    "pulseaudio:pulse",
104    "pulseaudio:pulse",
105    "safwk:system_ability_fwk",
106    "safwk:system_ability_fwk",
107    "samgr:samgr_proxy",
108  ]
109  if (accessibility_enable == true) {
110    external_deps += [
111      "accessibility:accessibility_common",
112      "accessibility:accessibilityconfig",
113    ]
114  }
115
116  defines = []
117  if (audio_framework_feature_double_pnp_detect) {
118    defines += [ "AUDIO_DOUBLE_PNP_DETECT" ]
119  }
120
121  if (build_variant == "user") {
122    defines += [ "AUDIO_BUILD_VARIANT_USER" ]
123  } else if (build_variant == "root") {
124    defines += [ "AUDIO_BUILD_VARIANT_ROOT" ]
125  }
126
127  if (audio_framework_feature_support_os_account) {
128    defines += [ "SUPPORT_USER_ACCOUNT" ]
129  }
130
131  if (audio_framework_feature_dtmf_tone) {
132    defines += [ "FEATURE_DTMF_TONE" ]
133  }
134
135  if (audio_framework_config_policy_enable) {
136    defines += [ "USE_CONFIG_POLICY" ]
137    external_deps += [ "config_policy:configpolicy_util" ]
138  }
139
140  if (appgallery_part_enable == true) {
141    defines += [ "FEATURE_APPGALLERY" ]
142  }
143
144  if (bluetooth_part_enable == true) {
145    deps +=
146        [ "../../../frameworks/native/bluetoothclient:audio_bluetooth_client" ]
147    external_deps += [ "bluetooth:btframework" ]
148  }
149
150  if (audio_framework_feature_input) {
151    defines += [ "FEATURE_MULTIMODALINPUT_INPUT" ]
152    external_deps += [ "input:libmmi-client" ]
153  }
154
155  if (audio_framework_feature_device_manager) {
156    defines += [ "FEATURE_DEVICE_MANAGER" ]
157    external_deps += [ "device_manager:devicemanagersdk" ]
158  }
159}
160
161group("fuzztest") {
162  testonly = true
163  deps = [ ":AudioPolicyMoreFuzzTest" ]
164}
165