1 2 3package { 4 default_applicable_licenses: [ 5 "frameworks_av_services_audioflinger_license", 6 ], 7} 8 9// Added automatically by a large-scale-change 10// See: http://go/android-license-faq 11license { 12 name: "frameworks_av_services_audioflinger_license", 13 visibility: [":__subpackages__"], 14 license_kinds: [ 15 "SPDX-license-identifier-Apache-2.0", 16 ], 17 license_text: [ 18 "NOTICE", 19 ], 20} 21 22// base tidy_errors for this and all subprojects. 23audioflinger_base_tidy_errors = [ 24 // https://clang.llvm.org/extra/clang-tidy/checks/list.html 25 // For many categories, the checks are too many to specify individually. 26 // Feel free to disable as needed - as warnings are generally ignored, 27 // we treat warnings as errors. 28 "android-*", 29 "bugprone-*", 30 "cert-*", 31 "clang-analyzer-security*", 32 "google-*", 33 "misc-*", 34 //"modernize-*", // explicitly list the modernize as they can be subjective. 35 "modernize-avoid-bind", 36 //"modernize-avoid-c-arrays", // std::array<> can be verbose 37 "modernize-concat-nested-namespaces", 38 //"modernize-deprecated-headers", // C headers still ok even if there is C++ equivalent. 39 "modernize-deprecated-ios-base-aliases", 40 "modernize-loop-convert", 41 "modernize-make-shared", 42 "modernize-make-unique", 43 // "modernize-pass-by-value", 44 "modernize-raw-string-literal", 45 "modernize-redundant-void-arg", 46 "modernize-replace-auto-ptr", 47 "modernize-replace-random-shuffle", 48 "modernize-return-braced-init-list", 49 "modernize-shrink-to-fit", 50 "modernize-unary-static-assert", 51 // "modernize-use-auto", // found in MediaMetricsService.h, debatable - auto can obscure type 52 "modernize-use-bool-literals", 53 "modernize-use-default-member-init", 54 "modernize-use-emplace", 55 "modernize-use-equals-default", 56 "modernize-use-equals-delete", 57 // "modernize-use-nodiscard", 58 "modernize-use-noexcept", 59 "modernize-use-nullptr", 60 "modernize-use-override", 61 //"modernize-use-trailing-return-type", // not necessarily more readable 62 "modernize-use-transparent-functors", 63 "modernize-use-uncaught-exceptions", 64 "modernize-use-using", 65 "performance-*", 66 67 // Remove some pedantic stylistic requirements. 68 "-google-readability-casting", // C++ casts not always necessary and may be verbose 69 "-google-readability-todo", // do not require TODO(info) 70 71 "-bugprone-narrowing-conversions", // b/182410845 72 "-bugprone-suspicious-string-compare", 73 "-bugprone-unhandled-self-assignment", 74 "-cert-oop54-cpp", // found in TransactionLog.h 75] 76 77// TODO(b/275642749) Reenable these warnings 78audioflinger_tidy_errors = audioflinger_base_tidy_errors + [ 79 "-bugprone-assignment-in-if-condition", 80 "-bugprone-forward-declaration-namespace", 81 "-bugprone-parent-virtual-call", 82 "-cert-dcl59-cpp", 83 "-cert-err34-c", 84 "-google-build-namespaces", 85 "-google-build-using-namespace", 86 "-google-default-arguments", 87 "-google-runtime-int", 88 "-misc-const-correctness", 89 "-misc-non-private-member-variables-in-classes", 90 "-modernize-concat-nested-namespaces", 91 "-modernize-loop-convert", 92 "-modernize-use-default-member-init", 93 "-modernize-use-equals-default", 94 "-modernize-use-nullptr", 95 "-modernize-use-override", 96 "-modernize-use-using", 97 "-performance-no-int-to-ptr", 98] 99 100audioflinger_base_cflags = [ 101 "-Wall", 102 "-Wdeprecated", 103 "-Werror", 104 "-Werror=conditional-uninitialized", 105 "-Werror=implicit-fallthrough", 106 "-Werror=sometimes-uninitialized", 107 "-Wextra", 108 109 // suppress some warning chatter. 110 "-Wno-deprecated-copy-with-dtor", 111 "-Wno-deprecated-copy-with-user-provided-dtor", 112 113 "-Wredundant-decls", 114 "-Wshadow", 115 "-Wstrict-aliasing", 116 "-Wthread-safety", 117 //"-Wthread-safety-negative", // experimental - looks broken in R. 118 "-Wunreachable-code", 119 "-Wunreachable-code-break", 120 "-Wunreachable-code-return", 121 "-Wunused", 122 "-Wused-but-marked-unused", 123 "-fstrict-aliasing", 124] 125 126// Eventually use common tidy defaults 127cc_defaults { 128 name: "audioflinger_flags_defaults", 129 // https://clang.llvm.org/docs/UsersManual.html#command-line-options 130 // https://clang.llvm.org/docs/DiagnosticsReference.html 131 cflags: audioflinger_base_cflags, 132 // https://clang.llvm.org/extra/clang-tidy/ 133 tidy: true, 134 tidy_checks: audioflinger_tidy_errors, 135 tidy_checks_as_errors: audioflinger_tidy_errors, 136 tidy_flags: [ 137 "-format-style=file", 138 ], 139} 140 141cc_defaults { 142 name: "libaudioflinger_dependencies", 143 144 shared_libs: [ 145 "audioclient-types-aidl-cpp", 146 "audioflinger-aidl-cpp", 147 "av-types-aidl-cpp", 148 "com.android.media.audio-aconfig-cc", 149 "effect-aidl-cpp", 150 "libactivitymanager_aidl", 151 "libaudioclient", 152 "libaudioclient_aidl_conversion", 153 "libaudioflinger_datapath", 154 "libaudioflinger_fastpath", 155 "libaudioflinger_timing", 156 "libaudioflinger_utils", 157 "libaudiofoundation", 158 "libaudiohal", 159 "libaudiomanager", 160 "libaudioprocessing", 161 "libaudioutils", 162 "libbinder", 163 "libbinder_ndk", 164 "libcutils", 165 "liblog", 166 "libmedia_helper", 167 "libmediametrics", 168 "libmediautils", 169 "libmemunreachable", 170 "libnbaio", 171 "libnblog", 172 "libpermission", 173 "libpowermanager", 174 "libshmemcompat", 175 "libsounddose", 176 "libutils", 177 "libvibrator", 178 "packagemanager_aidl-cpp", 179 ], 180 181 static_libs: [ 182 "libaudiospdif", 183 "libmedialogservice", 184 ], 185} 186 187cc_library { 188 name: "libaudioflinger", 189 190 defaults: [ 191 "audioflinger_flags_defaults", 192 "latest_android_hardware_audio_core_sounddose_ndk_export_shared_lib_header", 193 "latest_android_hardware_audio_core_sounddose_ndk_shared", 194 "latest_android_media_audio_common_types_cpp_shared", 195 "libaudioflinger_dependencies", 196 ], 197 198 srcs: [ 199 "AudioFlinger.cpp", 200 "Client.cpp", 201 "DeviceEffectManager.cpp", 202 "Effects.cpp", 203 "MelReporter.cpp", 204 "PatchCommandThread.cpp", 205 "PatchPanel.cpp", 206 "Threads.cpp", 207 "Tracks.cpp", 208 ], 209 210 include_dirs: [ 211 "frameworks/av/services/audiopolicy", 212 "frameworks/av/services/medialog", 213 ], 214 215 static_libs: [ 216 "libcpustats", 217 "libpermission", 218 ], 219 220 header_libs: [ 221 "audiopermissioncontroller_headers", 222 "audiopolicyservicelocal_headers", 223 "libaaudio_headers", 224 "libaudioclient_headers", 225 "libaudiohal_headers", 226 "libaudioutils_headers", 227 "libmedia_headers", 228 ], 229 230 export_header_lib_headers: ["audiopolicyservicelocal_headers"], 231 232 export_shared_lib_headers: [ 233 "libpermission", 234 ], 235 236 cflags: [ 237 "-Wall", 238 "-Werror", 239 "-fvisibility=hidden", 240 ], 241 sanitize: { 242 integer_overflow: true, 243 }, 244 245} 246 247cc_library_headers { 248 name: "libaudioflinger_headers", 249 export_include_dirs: ["."], 250} 251