1// Media Statistics service
2//
3
4tidy_errors = [
5    // https://clang.llvm.org/extra/clang-tidy/checks/list.html
6    // For many categories, the checks are too many to specify individually.
7    // Feel free to disable as needed - as warnings are generally ignored,
8    // we treat warnings as errors.
9    "android-*",
10    "bugprone-*",
11    "cert-*",
12    "clang-analyzer-security*",
13    "google-*",
14    "misc-*",
15    //"modernize-*",  // explicitly list the modernize as they can be subjective.
16    "modernize-avoid-bind",
17    //"modernize-avoid-c-arrays", // std::array<> can be verbose
18    "modernize-concat-nested-namespaces",
19    //"modernize-deprecated-headers", // C headers still ok even if there is C++ equivalent.
20    "modernize-deprecated-ios-base-aliases",
21    "modernize-loop-convert",
22    "modernize-make-shared",
23    "modernize-make-unique",
24    "modernize-pass-by-value",
25    "modernize-raw-string-literal",
26    "modernize-redundant-void-arg",
27    "modernize-replace-auto-ptr",
28    "modernize-replace-random-shuffle",
29    "modernize-return-braced-init-list",
30    "modernize-shrink-to-fit",
31    "modernize-unary-static-assert",
32    "modernize-use-auto",  // debatable - auto can obscure type
33    "modernize-use-bool-literals",
34    "modernize-use-default-member-init",
35    "modernize-use-emplace",
36    "modernize-use-equals-default",
37    "modernize-use-equals-delete",
38    "modernize-use-nodiscard",
39    "modernize-use-noexcept",
40    "modernize-use-nullptr",
41    "modernize-use-override",
42    //"modernize-use-trailing-return-type", // not necessarily more readable
43    "modernize-use-transparent-functors",
44    "modernize-use-uncaught-exceptions",
45    "modernize-use-using",
46    "performance-*",
47
48    // Remove some pedantic stylistic requirements.
49    "-google-readability-casting", // C++ casts not always necessary and may be verbose
50    "-google-readability-todo",    // do not require TODO(info)
51]
52
53cc_defaults {
54    name: "mediametrics_flags_defaults",
55    // https://clang.llvm.org/docs/UsersManual.html#command-line-options
56    // https://clang.llvm.org/docs/DiagnosticsReference.html
57    cflags: [
58        "-Wall",
59        "-Wdeprecated",
60        "-Werror",
61        "-Werror=implicit-fallthrough",
62        "-Werror=sometimes-uninitialized",
63        "-Werror=conditional-uninitialized",
64        "-Wextra",
65        "-Wredundant-decls",
66        "-Wshadow",
67        "-Wstrict-aliasing",
68        "-fstrict-aliasing",
69        "-Wthread-safety",
70        //"-Wthread-safety-negative", // experimental - looks broken in R.
71        "-Wunreachable-code",
72        "-Wunreachable-code-break",
73        "-Wunreachable-code-return",
74        "-Wunused",
75        "-Wused-but-marked-unused",
76    ],
77    // https://clang.llvm.org/extra/clang-tidy/
78    tidy: true,
79    tidy_checks: tidy_errors,
80    tidy_checks_as_errors: tidy_errors,
81    tidy_flags: [
82      "-format-style='file'",
83      "--header-filter='frameworks/av/services/mediametrics/'",
84    ],
85}
86
87cc_binary {
88    name: "mediametrics",
89    defaults: [
90        "mediametrics_flags_defaults",
91    ],
92
93    srcs: [
94        "main_mediametrics.cpp",
95    ],
96
97    shared_libs: [
98        "libbinder",
99        "liblog",
100        "libmediametricsservice",
101        "libmediautils",
102        "libutils",
103    ],
104    header_libs: [
105        "libaudioutils_headers",
106        "libmediametrics_headers",
107    ],
108
109    init_rc: [
110        "mediametrics.rc",
111    ],
112}
113
114cc_library_shared {
115    name: "libmediametricsservice",
116    defaults: [
117        "mediametrics_flags_defaults",
118    ],
119
120    srcs: [
121        "AudioAnalytics.cpp",
122        "AudioPowerUsage.cpp",
123        "AudioTypes.cpp",
124        "cleaner.cpp",
125        "iface_statsd.cpp",
126        "MediaMetricsService.cpp",
127        "statsd_audiopolicy.cpp",
128        "statsd_audiorecord.cpp",
129        "statsd_audiothread.cpp",
130        "statsd_audiotrack.cpp",
131        "statsd_codec.cpp",
132        "statsd_drm.cpp",
133        "statsd_extractor.cpp",
134        "statsd_nuplayer.cpp",
135        "statsd_recorder.cpp",
136        "StringUtils.cpp"
137    ],
138
139    proto: {
140        type: "lite",
141    },
142
143    shared_libs: [
144        "libbase", // android logging
145        "libbinder",
146        "libcutils",
147        "liblog",
148        "libmedia_helper",
149        "libmediametrics",
150        "libmediautils",
151        "libmemunreachable",
152        "libprotobuf-cpp-lite",
153        "libstatslog",
154        "libutils",
155    ],
156
157    static_libs: [
158        "libplatformprotos",
159    ],
160
161    include_dirs: [
162        "system/media/audio_utils/include",
163    ],
164}
165