MediaMetrics: Add const correctness for items in service

Allows multithreaded use of items without lock.

Test: mediametrics dumpsys, atest mediametrics_tests
Bug: 138583596
Change-Id: Ieb901076b9acc33a89737b320a4fc8ce82f2608d
diff --git a/services/mediaanalytics/iface_statsd.cpp b/services/mediaanalytics/iface_statsd.cpp
index e02c9cf..dccc76a 100644
--- a/services/mediaanalytics/iface_statsd.cpp
+++ b/services/mediaanalytics/iface_statsd.cpp
@@ -27,6 +27,7 @@
 #include <pthread.h>
 #include <unistd.h>
 
+#include <memory>
 #include <string.h>
 #include <pwd.h>
 
@@ -48,7 +49,7 @@
 
 struct statsd_hooks {
     const char *key;
-    bool (*handler)(MediaAnalyticsItem *);
+    bool (*handler)(const MediaAnalyticsItem *);
 };
 
 // keep this sorted, so we can do binary searches
@@ -69,7 +70,7 @@
 };
 
 // give me a record, i'll look at the type and upload appropriately
-bool dump2Statsd(MediaAnalyticsItem *item) {
+bool dump2Statsd(const std::shared_ptr<const MediaAnalyticsItem>& item) {
     if (item == NULL) return false;
 
     // get the key
@@ -82,7 +83,7 @@
 
     for (const auto &statsd_handler : statsd_handlers) {
         if (key == statsd_handler.key) {
-            return statsd_handler.handler(item);
+            return statsd_handler.handler(item.get());
         }
     }
     return false;