1package {
2    default_team: "trendy_team_media_framework_audio",
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "frameworks_av_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["frameworks_av_license"],
9}
10
11tidy_errors = [
12    // https://clang.llvm.org/extra/clang-tidy/checks/list.html
13    // For many categories, the checks are too many to specify individually.
14    // Feel free to disable as needed - as warnings are generally ignored,
15    // we treat warnings as errors.
16    "android-*",
17    "bugprone-*",
18    "cert-*",
19    "clang-analyzer-security*",
20    "google-*",
21    "misc-*",
22    //"modernize-*",  // explicitly list the modernize as they can be subjective.
23    "modernize-avoid-bind",
24    //"modernize-avoid-c-arrays", // std::array<> can be verbose
25    "modernize-concat-nested-namespaces",
26    //"modernize-deprecated-headers", // C headers still ok even if there is C++ equivalent.
27    "modernize-deprecated-ios-base-aliases",
28    "modernize-loop-convert",
29    "modernize-make-shared",
30    "modernize-make-unique",
31    "modernize-pass-by-value",
32    "modernize-raw-string-literal",
33    "modernize-redundant-void-arg",
34    "modernize-replace-auto-ptr",
35    "modernize-replace-random-shuffle",
36    "modernize-return-braced-init-list",
37    "modernize-shrink-to-fit",
38    "modernize-unary-static-assert",
39    // "modernize-use-auto", // found in AAudioAudio.cpp
40    "modernize-use-bool-literals",
41    "modernize-use-default-member-init",
42    "modernize-use-emplace",
43    "modernize-use-equals-default",
44    "modernize-use-equals-delete",
45    "modernize-use-nodiscard",
46    "modernize-use-noexcept",
47    "modernize-use-nullptr",
48    "modernize-use-override",
49    // "modernize-use-trailing-return-type", // not necessarily more readable
50    "modernize-use-transparent-functors",
51    "modernize-use-uncaught-exceptions",
52    // "modernize-use-using", // found typedef in several files
53    "performance-*",
54
55    // Remove some pedantic stylistic requirements.
56    "-android-cloexec-dup", // found in SharedMemoryParcelable.cpp
57    "-bugprone-macro-parentheses", // found in SharedMemoryParcelable.h
58    "-bugprone-narrowing-conversions", // found in several interface from size_t to int32_t
59
60    "-google-build-using-namespace", // Reenable and fix later.
61    "-google-global-names-in-headers", // found in several files
62    "-google-readability-casting", // C++ casts not always necessary and may be verbose
63    "-google-readability-todo", // do not require TODO(info)
64
65    "-misc-non-private-member-variables-in-classes", // found in aidl generated files
66
67    "-performance-no-int-to-ptr", // found in SharedMemoryParcelable.h
68]
69
70cc_library {
71    name: "libaaudio",
72
73    local_include_dirs: [
74        "binding",
75        "client",
76        "core",
77        "fifo",
78        "flowgraph",
79        "legacy",
80        "utility",
81    ],
82    header_libs: [
83        "libaaudio_headers",
84    ],
85    export_header_lib_headers: ["libaaudio_headers"],
86    version_script: "libaaudio.map.txt",
87
88    srcs: [
89        "core/AAudioAudio.cpp",
90    ],
91
92    cflags: [
93        "-Wall",
94        "-Werror",
95        "-Wno-unused-parameter",
96        "-Wthread-safety",
97
98        // AAUDIO_API is used to explicitly export a function or a variable as a visible symbol.
99        "-DAAUDIO_API=__attribute__((visibility(\"default\")))",
100    ],
101
102    shared_libs: [
103        "framework-permission-aidl-cpp",
104        "libaaudio_internal",
105        "libaudioclient",
106        "libaudioutils",
107        "libbinder",
108        "libcutils",
109        "liblog",
110        "libmedia_helper",
111        "libmediametrics",
112        "libmediautils",
113        "libutils",
114    ],
115
116    sanitize: {
117        integer_overflow: true,
118        misc_undefined: ["bounds"],
119    },
120
121    stubs: {
122        symbol_file: "libaaudio.map.txt",
123        versions: ["28"],
124    },
125
126    tidy: true,
127    tidy_checks: tidy_errors,
128    tidy_checks_as_errors: tidy_errors,
129    tidy_flags: [
130        "-format-style=file",
131    ],
132}
133
134cc_library {
135    name: "libaaudio_internal",
136
137    defaults: [
138        "latest_android_media_audio_common_types_cpp_shared",
139    ],
140
141    local_include_dirs: [
142        "binding",
143        "client",
144        "core",
145        "fifo",
146        "legacy",
147        "utility",
148    ],
149
150    export_include_dirs: ["."],
151    header_libs: [
152        "libaaudio_headers",
153        "libmedia_headers",
154        "libmediametrics_headers",
155    ],
156    export_header_lib_headers: ["libaaudio_headers"],
157
158    export_shared_lib_headers: [
159        "framework-permission-aidl-cpp",
160    ],
161
162    shared_libs: [
163        "aaudio-aidl-cpp",
164        "audioclient-types-aidl-cpp",
165        "com.android.media.aaudio-aconfig-cc",
166        "framework-permission-aidl-cpp",
167        "libaudioclient",
168        "libaudioclient_aidl_conversion",
169        "libaudioutils",
170        "libbinder",
171        "libcutils",
172        "liblog",
173        "libmedia_helper",
174        "libmediametrics",
175        "libmediautils",
176        "libutils",
177    ],
178
179    cflags: [
180        "-Wall",
181        "-Werror",
182        "-Wno-unused-parameter",
183    ],
184
185    srcs: [
186        "binding/AAudioBinderAdapter.cpp",
187        "binding/AAudioBinderClient.cpp",
188        "binding/AAudioStreamConfiguration.cpp",
189        "binding/AAudioStreamRequest.cpp",
190        "binding/AudioEndpointParcelable.cpp",
191        "binding/RingBufferParcelable.cpp",
192        "binding/SharedMemoryParcelable.cpp",
193        "binding/SharedRegionParcelable.cpp",
194        "client/AAudioFlowGraph.cpp",
195        "client/AudioEndpoint.cpp",
196        "client/AudioStreamInternal.cpp",
197        "client/AudioStreamInternalCapture.cpp",
198        "client/AudioStreamInternalPlay.cpp",
199        "client/IsochronousClockModel.cpp",
200        "core/AAudioStreamParameters.cpp",
201        "core/AudioGlobal.cpp",
202        "core/AudioStream.cpp",
203        "core/AudioStreamBuilder.cpp",
204        "fifo/FifoBuffer.cpp",
205        "fifo/FifoControllerBase.cpp",
206        "flowgraph/ChannelCountConverter.cpp",
207        "flowgraph/ClipToRange.cpp",
208        "flowgraph/FlowGraphNode.cpp",
209        "flowgraph/Limiter.cpp",
210        "flowgraph/ManyToMultiConverter.cpp",
211        "flowgraph/MonoBlend.cpp",
212        "flowgraph/MonoToMultiConverter.cpp",
213        "flowgraph/MultiToManyConverter.cpp",
214        "flowgraph/MultiToMonoConverter.cpp",
215        "flowgraph/RampLinear.cpp",
216        "flowgraph/SampleRateConverter.cpp",
217        "flowgraph/SinkFloat.cpp",
218        "flowgraph/SinkI8_24.cpp",
219        "flowgraph/SinkI16.cpp",
220        "flowgraph/SinkI24.cpp",
221        "flowgraph/SinkI32.cpp",
222        "flowgraph/SourceFloat.cpp",
223        "flowgraph/SourceI8_24.cpp",
224        "flowgraph/SourceI16.cpp",
225        "flowgraph/SourceI24.cpp",
226        "flowgraph/SourceI32.cpp",
227        "flowgraph/resampler/IntegerRatio.cpp",
228        "flowgraph/resampler/LinearResampler.cpp",
229        "flowgraph/resampler/MultiChannelResampler.cpp",
230        "flowgraph/resampler/PolyphaseResampler.cpp",
231        "flowgraph/resampler/PolyphaseResamplerMono.cpp",
232        "flowgraph/resampler/PolyphaseResamplerStereo.cpp",
233        "flowgraph/resampler/SincResampler.cpp",
234        "flowgraph/resampler/SincResamplerStereo.cpp",
235        "legacy/AudioStreamLegacy.cpp",
236        "legacy/AudioStreamRecord.cpp",
237        "legacy/AudioStreamTrack.cpp",
238        "utility/AAudioUtilities.cpp",
239        "utility/FixedBlockAdapter.cpp",
240        "utility/FixedBlockReader.cpp",
241        "utility/FixedBlockWriter.cpp",
242    ],
243    sanitize: {
244        integer_overflow: true,
245        misc_undefined: ["bounds"],
246    },
247
248    tidy: true,
249    tidy_checks: tidy_errors,
250    tidy_checks_as_errors: tidy_errors,
251    tidy_flags: [
252        "-format-style=file",
253    ],
254}
255
256aidl_interface {
257    name: "aaudio-aidl",
258    unstable: true,
259    local_include_dir: "binding/aidl",
260    defaults: [
261        "latest_android_media_audio_common_types_import_interface",
262    ],
263    srcs: [
264        "binding/aidl/aaudio/Endpoint.aidl",
265        "binding/aidl/aaudio/IAAudioClient.aidl",
266        "binding/aidl/aaudio/IAAudioService.aidl",
267        "binding/aidl/aaudio/RingBuffer.aidl",
268        "binding/aidl/aaudio/SharedRegion.aidl",
269        "binding/aidl/aaudio/StreamParameters.aidl",
270        "binding/aidl/aaudio/StreamRequest.aidl",
271    ],
272    imports: [
273        "audioclient-types-aidl",
274        "framework-permission-aidl",
275        "shared-file-region-aidl",
276    ],
277    backend: {
278        java: {
279            sdk_version: "module_current",
280        },
281    },
282}
283