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