1// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "frameworks_av_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["frameworks_av_license"],
22}
23
24tidy_errors = [
25    // https://clang.llvm.org/extra/clang-tidy/checks/list.html
26    // For many categories, the checks are too many to specify individually.
27    // Feel free to disable as needed - as warnings are generally ignored,
28    // we treat warnings as errors.
29    "android-*",
30    "bugprone-*",
31    "cert-*",
32    "clang-analyzer-security*",
33    "google-*",
34    "misc-*",
35    //"modernize-*",  // explicitly list the modernize as they can be subjective.
36    "modernize-avoid-bind",
37    //"modernize-avoid-c-arrays", // std::array<> can be verbose
38    "modernize-concat-nested-namespaces",
39    //"modernize-deprecated-headers", // C headers still ok even if there is C++ equivalent.
40    "modernize-deprecated-ios-base-aliases",
41    "modernize-loop-convert",
42    "modernize-make-shared",
43    "modernize-make-unique",
44    "modernize-pass-by-value",
45    "modernize-raw-string-literal",
46    "modernize-redundant-void-arg",
47    "modernize-replace-auto-ptr",
48    "modernize-replace-random-shuffle",
49    "modernize-return-braced-init-list",
50    "modernize-shrink-to-fit",
51    "modernize-unary-static-assert",
52    "modernize-use-auto",
53    "modernize-use-bool-literals",
54    "modernize-use-default-member-init",
55    "modernize-use-emplace",
56    "modernize-use-equals-default",
57    "modernize-use-equals-delete",
58    "modernize-use-nodiscard",
59    "modernize-use-noexcept",
60    "modernize-use-nullptr",
61    "modernize-use-override",
62    // "modernize-use-trailing-return-type", // not necessarily more readable
63    "modernize-use-transparent-functors",
64    "modernize-use-uncaught-exceptions",
65    "modernize-use-using",
66    "performance-*",
67
68    // Remove some pedantic stylistic requirements.
69    "-android-cloexec-dup", // found in AAudioServiceEndpointMMAP.cpp
70    "-bugprone-narrowing-conversions", // found in several interface from size_t to int32_t
71
72    "-google-build-using-namespace", // Reenable and fix later.
73    "-google-global-names-in-headers", // found in several files
74    "-google-readability-casting", // C++ casts not always necessary and may be verbose
75    "-google-readability-todo", // do not require TODO(info)
76
77    "-misc-non-private-member-variables-in-classes", // found in aidl generated files
78
79]
80
81cc_defaults {
82    name: "libaaudioservice_dependencies",
83
84    shared_libs: [
85        "aaudio-aidl-cpp",
86        "com.android.media.aaudio-aconfig-cc",
87        "framework-permission-aidl-cpp",
88        "libaaudio_internal",
89        "libaudioclient",
90        "libaudioclient_aidl_conversion",
91        "libaudioutils",
92        "libbase",
93        "libbinder",
94        "libcutils",
95        "liblog",
96        "libmedia_helper",
97        "libmediametrics",
98        "libmediautils",
99        "libutils",
100        "packagemanager_aidl-cpp",
101    ],
102
103    static_libs: [
104        "libaudioflinger",
105    ],
106}
107
108cc_library_static {
109
110    name: "libaaudioservice",
111
112    defaults: [
113        "latest_android_media_audio_common_types_cpp_shared",
114        "libaaudioservice_dependencies",
115    ],
116
117    srcs: [
118        "AAudioClientTracker.cpp",
119        "AAudioCommandQueue.cpp",
120        "AAudioEndpointManager.cpp",
121        "AAudioMixer.cpp",
122        "AAudioService.cpp",
123        "AAudioServiceEndpoint.cpp",
124        "AAudioServiceEndpointCapture.cpp",
125        "AAudioServiceEndpointMMAP.cpp",
126        "AAudioServiceEndpointPlay.cpp",
127        "AAudioServiceEndpointShared.cpp",
128        "AAudioServiceStreamBase.cpp",
129        "AAudioServiceStreamMMAP.cpp",
130        "AAudioServiceStreamShared.cpp",
131        "AAudioStreamTracker.cpp",
132        "AAudioThread.cpp",
133        "SharedMemoryProxy.cpp",
134        "SharedMemoryWrapper.cpp",
135        "SharedRingBuffer.cpp",
136        "TimestampScheduler.cpp",
137    ],
138
139    cflags: [
140        "-Wall",
141        "-Werror",
142        "-Wno-unused-parameter",
143        "-Wthread-safety",
144    ],
145
146    export_shared_lib_headers: [
147        "framework-permission-aidl-cpp",
148        "libaaudio_internal",
149    ],
150
151    header_libs: [
152        "libaudiohal_headers",
153    ],
154
155    include_dirs: [
156        "frameworks/av/media/libnbaio/include",
157        "frameworks/av/media/libnbaio/include_mono",
158    ],
159
160    tidy: true,
161    tidy_checks: tidy_errors,
162    tidy_checks_as_errors: tidy_errors,
163    tidy_flags: [
164        "-format-style=file",
165    ],
166}
167