xref: /aosp_15_r20/frameworks/av/media/libaaudio/src/Android.bp (revision ec779b8e0859a360c3d303172224686826e6e0e1)
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        "libaudiofoundation",
107        "libaudioutils",
108        "libbinder",
109        "libcutils",
110        "liblog",
111        "libmedia_helper",
112        "libmediametrics",
113        "libmediautils",
114        "libutils",
115    ],
116
117    sanitize: {
118        integer_overflow: true,
119        misc_undefined: ["bounds"],
120    },
121
122    stubs: {
123        symbol_file: "libaaudio.map.txt",
124        versions: ["28"],
125    },
126
127    tidy: true,
128    tidy_checks: tidy_errors,
129    tidy_checks_as_errors: tidy_errors,
130    tidy_flags: [
131        "-format-style=file",
132    ],
133}
134
135cc_library {
136    name: "libaaudio_internal",
137
138    defaults: [
139        "latest_android_media_audio_common_types_cpp_shared",
140    ],
141
142    local_include_dirs: [
143        "binding",
144        "client",
145        "core",
146        "fifo",
147        "legacy",
148        "utility",
149    ],
150
151    export_include_dirs: ["."],
152    header_libs: [
153        "libaaudio_headers",
154        "libmedia_headers",
155        "libmediametrics_headers",
156    ],
157    export_header_lib_headers: ["libaaudio_headers"],
158
159    export_shared_lib_headers: [
160        "framework-permission-aidl-cpp",
161    ],
162
163    shared_libs: [
164        "aaudio-aidl-cpp",
165        "audioclient-types-aidl-cpp",
166        "com.android.media.aaudio-aconfig-cc",
167        "framework-permission-aidl-cpp",
168        "libaudioclient",
169        "libaudioclient_aidl_conversion",
170        "libaudiofoundation",
171        "libaudioutils",
172        "libbase",
173        "libbinder",
174        "libcutils",
175        "liblog",
176        "libmedia_helper",
177        "libmediametrics",
178        "libmediautils",
179        "libutils",
180    ],
181
182    cflags: [
183        "-Wall",
184        "-Werror",
185        "-Wno-unused-parameter",
186    ],
187
188    srcs: [
189        "binding/AAudioBinderAdapter.cpp",
190        "binding/AAudioBinderClient.cpp",
191        "binding/AAudioStreamConfiguration.cpp",
192        "binding/AAudioStreamRequest.cpp",
193        "binding/AudioEndpointParcelable.cpp",
194        "binding/RingBufferParcelable.cpp",
195        "binding/SharedMemoryParcelable.cpp",
196        "binding/SharedRegionParcelable.cpp",
197        "client/AAudioFlowGraph.cpp",
198        "client/AudioEndpoint.cpp",
199        "client/AudioStreamInternal.cpp",
200        "client/AudioStreamInternalCapture.cpp",
201        "client/AudioStreamInternalPlay.cpp",
202        "client/IsochronousClockModel.cpp",
203        "core/AAudioStreamParameters.cpp",
204        "core/AudioGlobal.cpp",
205        "core/AudioStream.cpp",
206        "core/AudioStreamBuilder.cpp",
207        "fifo/FifoBuffer.cpp",
208        "fifo/FifoControllerBase.cpp",
209        "flowgraph/ChannelCountConverter.cpp",
210        "flowgraph/ClipToRange.cpp",
211        "flowgraph/FlowGraphNode.cpp",
212        "flowgraph/Limiter.cpp",
213        "flowgraph/ManyToMultiConverter.cpp",
214        "flowgraph/MonoBlend.cpp",
215        "flowgraph/MonoToMultiConverter.cpp",
216        "flowgraph/MultiToManyConverter.cpp",
217        "flowgraph/MultiToMonoConverter.cpp",
218        "flowgraph/RampLinear.cpp",
219        "flowgraph/SampleRateConverter.cpp",
220        "flowgraph/SinkFloat.cpp",
221        "flowgraph/SinkI8_24.cpp",
222        "flowgraph/SinkI16.cpp",
223        "flowgraph/SinkI24.cpp",
224        "flowgraph/SinkI32.cpp",
225        "flowgraph/SourceFloat.cpp",
226        "flowgraph/SourceI8_24.cpp",
227        "flowgraph/SourceI16.cpp",
228        "flowgraph/SourceI24.cpp",
229        "flowgraph/SourceI32.cpp",
230        "flowgraph/resampler/IntegerRatio.cpp",
231        "flowgraph/resampler/LinearResampler.cpp",
232        "flowgraph/resampler/MultiChannelResampler.cpp",
233        "flowgraph/resampler/PolyphaseResampler.cpp",
234        "flowgraph/resampler/PolyphaseResamplerMono.cpp",
235        "flowgraph/resampler/PolyphaseResamplerStereo.cpp",
236        "flowgraph/resampler/SincResampler.cpp",
237        "flowgraph/resampler/SincResamplerStereo.cpp",
238        "legacy/AudioStreamLegacy.cpp",
239        "legacy/AudioStreamRecord.cpp",
240        "legacy/AudioStreamTrack.cpp",
241        "utility/AAudioUtilities.cpp",
242        "utility/FixedBlockAdapter.cpp",
243        "utility/FixedBlockReader.cpp",
244        "utility/FixedBlockWriter.cpp",
245    ],
246    sanitize: {
247        integer_overflow: true,
248        misc_undefined: ["bounds"],
249    },
250
251    tidy: true,
252    tidy_checks: tidy_errors,
253    tidy_checks_as_errors: tidy_errors,
254    tidy_flags: [
255        "-format-style=file",
256    ],
257}
258
259aidl_interface {
260    name: "aaudio-aidl",
261    unstable: true,
262    local_include_dir: "binding/aidl",
263    defaults: [
264        "latest_android_media_audio_common_types_import_interface",
265    ],
266    srcs: [
267        "binding/aidl/aaudio/Endpoint.aidl",
268        "binding/aidl/aaudio/IAAudioClient.aidl",
269        "binding/aidl/aaudio/IAAudioService.aidl",
270        "binding/aidl/aaudio/RingBuffer.aidl",
271        "binding/aidl/aaudio/SharedRegion.aidl",
272        "binding/aidl/aaudio/StreamParameters.aidl",
273        "binding/aidl/aaudio/StreamRequest.aidl",
274    ],
275    imports: [
276        "audioclient-types-aidl",
277        "framework-permission-aidl",
278        "shared-file-region-aidl",
279    ],
280    backend: {
281        java: {
282            sdk_version: "module_current",
283        },
284    },
285}
286