| // Media Statistics service |
| // |
| |
| package { |
| // See: http://go/android-license-faq |
| // A large-scale-change added 'default_applicable_licenses' to import |
| // all of the 'license_kinds' from "frameworks_av_license" |
| // to get the below license kinds: |
| // SPDX-license-identifier-Apache-2.0 |
| default_applicable_licenses: ["frameworks_av_license"], |
| } |
| |
| tidy_errors = [ |
| // https://clang.llvm.org/extra/clang-tidy/checks/list.html |
| // For many categories, the checks are too many to specify individually. |
| // Feel free to disable as needed - as warnings are generally ignored, |
| // we treat warnings as errors. |
| "android-*", |
| "bugprone-*", |
| "cert-*", |
| "clang-analyzer-security*", |
| "google-*", |
| "misc-*", |
| //"modernize-*", // explicitly list the modernize as they can be subjective. |
| "modernize-avoid-bind", |
| //"modernize-avoid-c-arrays", // std::array<> can be verbose |
| "modernize-concat-nested-namespaces", |
| //"modernize-deprecated-headers", // C headers still ok even if there is C++ equivalent. |
| "modernize-deprecated-ios-base-aliases", |
| "modernize-loop-convert", |
| "modernize-make-shared", |
| "modernize-make-unique", |
| // "modernize-pass-by-value", // found in TimeMachine.h |
| "modernize-raw-string-literal", |
| "modernize-redundant-void-arg", |
| "modernize-replace-auto-ptr", |
| "modernize-replace-random-shuffle", |
| "modernize-return-braced-init-list", |
| "modernize-shrink-to-fit", |
| "modernize-unary-static-assert", |
| // "modernize-use-auto", // found in MediaMetricsService.h, debatable - auto can obscure type |
| "modernize-use-bool-literals", |
| "modernize-use-default-member-init", |
| "modernize-use-emplace", |
| "modernize-use-equals-default", |
| "modernize-use-equals-delete", |
| // "modernize-use-nodiscard", // found in TimeMachine.h |
| "modernize-use-noexcept", |
| "modernize-use-nullptr", |
| "modernize-use-override", |
| //"modernize-use-trailing-return-type", // not necessarily more readable |
| "modernize-use-transparent-functors", |
| "modernize-use-uncaught-exceptions", |
| "modernize-use-using", |
| "performance-*", |
| |
| // Remove some pedantic stylistic requirements. |
| "-google-readability-casting", // C++ casts not always necessary and may be verbose |
| "-google-readability-todo", // do not require TODO(info) |
| |
| "-bugprone-unhandled-self-assignment", // found in TimeMachine.h |
| "-bugprone-suspicious-string-compare", // found in TimeMachine.h |
| "-cert-oop54-cpp", // found in TransactionLog.h |
| "-bugprone-narrowing-conversions", // b/182410845 |
| ] |
| |
| cc_defaults { |
| name: "mediametrics_flags_defaults", |
| // https://clang.llvm.org/docs/UsersManual.html#command-line-options |
| // https://clang.llvm.org/docs/DiagnosticsReference.html |
| cflags: [ |
| "-Wall", |
| "-Wdeprecated", |
| "-Werror", |
| "-Werror=implicit-fallthrough", |
| "-Werror=sometimes-uninitialized", |
| "-Werror=conditional-uninitialized", |
| "-Wextra", |
| "-Wredundant-decls", |
| "-Wshadow", |
| "-Wstrict-aliasing", |
| "-fstrict-aliasing", |
| "-Wthread-safety", |
| //"-Wthread-safety-negative", // experimental - looks broken in R. |
| "-Wunreachable-code", |
| "-Wunreachable-code-break", |
| "-Wunreachable-code-return", |
| "-Wunused", |
| "-Wused-but-marked-unused", |
| ], |
| // https://clang.llvm.org/extra/clang-tidy/ |
| tidy: true, |
| tidy_checks: tidy_errors, |
| tidy_checks_as_errors: tidy_errors, |
| tidy_flags: [ |
| "-format-style=file", |
| ], |
| } |
| |
| cc_binary { |
| name: "mediametrics", |
| defaults: [ |
| "mediametrics_flags_defaults", |
| ], |
| |
| srcs: [ |
| "main_mediametrics.cpp", |
| ], |
| |
| shared_libs: [ |
| "libbinder", |
| "liblog", |
| "libmediametricsservice", |
| "libmediautils", |
| "libutils", |
| "mediametricsservice-aidl-cpp", |
| "packagemanager_aidl-cpp", |
| ], |
| header_libs: [ |
| "libaudioutils_headers", |
| "libmediametrics_headers", |
| ], |
| |
| init_rc: [ |
| "mediametrics.rc", |
| ], |
| } |
| |
| cc_library { |
| name: "libmediametricsservice", |
| defaults: [ |
| "mediametrics_flags_defaults", |
| ], |
| |
| srcs: [ |
| "AudioAnalytics.cpp", |
| "AudioPowerUsage.cpp", |
| "AudioTypes.cpp", |
| "cleaner.cpp", |
| "iface_statsd.cpp", |
| "MediaDrmStatsdHelper.cpp", |
| "MediaMetricsService.cpp", |
| "statsd_audiopolicy.cpp", |
| "statsd_audiorecord.cpp", |
| "statsd_audiothread.cpp", |
| "statsd_audiotrack.cpp", |
| "statsd_codec.cpp", |
| "statsd_drm.cpp", |
| "statsd_extractor.cpp", |
| "statsd_mediaparser.cpp", |
| "statsd_nuplayer.cpp", |
| "statsd_recorder.cpp", |
| "StringUtils.cpp", |
| "ValidateId.cpp", |
| ], |
| |
| proto: { |
| type: "lite", |
| }, |
| |
| shared_libs: [ |
| "mediametricsservice-aidl-cpp", |
| "libbase", // android logging |
| "libbinder", |
| "libcutils", |
| "liblog", |
| "libmedia_helper", |
| "libmediametrics", |
| "libmediautils", |
| "libmemunreachable", |
| "libprotobuf-cpp-lite", |
| "libstagefright_foundation", |
| "libstats_media_metrics", |
| "libstatspull", |
| "libstatssocket", |
| "libutils", |
| "packagemanager_aidl-cpp", |
| ], |
| |
| export_shared_lib_headers: [ |
| "libstats_media_metrics", |
| "libstatspull", |
| "libstatssocket", |
| ], |
| |
| // within the library, we use "xxx.h" |
| local_include_dirs: [ |
| "include/mediametricsservice", |
| ], |
| |
| // external parties use <mediametricsservice/xxx.h> |
| export_include_dirs: [ |
| "include", |
| ], |
| |
| static_libs: [ |
| "libplatformprotos", |
| ], |
| |
| header_libs: [ |
| "libaaudio_headers", |
| "libaudioutils_headers", |
| ], |
| } |
| |
| cc_library { |
| name: "libstats_media_metrics", |
| generated_sources: ["stats_media_metrics.cpp"], |
| generated_headers: ["stats_media_metrics.h"], |
| export_generated_headers: ["stats_media_metrics.h"], |
| shared_libs: [ |
| "libcutils", |
| "libstatspull", |
| "libstatssocket", |
| ], |
| } |
| |
| genrule { |
| name: "stats_media_metrics.h", |
| tools: ["stats-log-api-gen"], |
| cmd: "$(location stats-log-api-gen) --header $(genDir)/stats_media_metrics.h --module media_metrics --namespace android,stats,media_metrics", |
| out: [ |
| "stats_media_metrics.h", |
| ], |
| } |
| |
| genrule { |
| name: "stats_media_metrics.cpp", |
| tools: ["stats-log-api-gen"], |
| cmd: "$(location stats-log-api-gen) --cpp $(genDir)/stats_media_metrics.cpp --module media_metrics --namespace android,stats,media_metrics --importHeader stats_media_metrics.h", |
| out: [ |
| "stats_media_metrics.cpp", |
| ], |
| } |