MediaMetrics: Report last statsd atoms pushed
Report all pushed statsd atoms (previously only audio
analytics atoms were listed). Move the statsd atom info
out of AudioAnalytics to the main dump.
Report last 4 atoms sent, 30 shown on dumpsys --all.
Test: adb shell dumpsys media.metrics
Bug: 184263266
Change-Id: I2abc2fe7a0ec42fcf20f6b9fca490c6396c5272e
diff --git a/services/mediametrics/iface_statsd.cpp b/services/mediametrics/iface_statsd.cpp
index b7c5296..df42184 100644
--- a/services/mediametrics/iface_statsd.cpp
+++ b/services/mediametrics/iface_statsd.cpp
@@ -48,10 +48,7 @@
// has its own routine to handle this.
//
-bool enabled_statsd = true;
-
-using statsd_pusher = bool (*)(const mediametrics::Item *);
-using statsd_puller = bool (*)(const mediametrics::Item *, AStatsEventList *);
+static bool enabled_statsd = true;
namespace {
template<typename Handler, typename... Args>
@@ -68,15 +65,17 @@
}
if (handlers.count(key)) {
- return (handlers.at(key))(item.get(), args...);
+ return (handlers.at(key))(item, args...);
}
return false;
}
} // namespace
// give me a record, I'll look at the type and upload appropriately
-bool dump2Statsd(const std::shared_ptr<const mediametrics::Item>& item) {
- static const std::map<std::string, statsd_pusher> statsd_pushers =
+bool dump2Statsd(
+ const std::shared_ptr<const mediametrics::Item>& item,
+ const std::shared_ptr<mediametrics::StatsdLog>& statsdLog) {
+ static const std::map<std::string, statsd_pusher*> statsd_pushers =
{
{ "audiopolicy", statsd_audiopolicy },
{ "audiorecord", statsd_audiorecord },
@@ -91,11 +90,11 @@
{ "nuplayer2", statsd_nuplayer },
{ "recorder", statsd_recorder },
};
- return dump2StatsdInternal(statsd_pushers, item);
+ return dump2StatsdInternal(statsd_pushers, item, statsdLog);
}
bool dump2Statsd(const std::shared_ptr<const mediametrics::Item>& item, AStatsEventList* out) {
- static const std::map<std::string, statsd_puller> statsd_pullers =
+ static const std::map<std::string, statsd_puller*> statsd_pullers =
{
{ "mediadrm", statsd_mediadrm_puller },
};