Make native metrics logger write to statsd socket
Bug: 110537511
Test: compiles without failures and verified the correct metric
Change-Id: Ie8019a20a2112ed6cbbc0999d68592efb8f0f538
diff --git a/libstats/Android.bp b/libstats/Android.bp
index d58f294..f5ee1da 100644
--- a/libstats/Android.bp
+++ b/libstats/Android.bp
@@ -17,12 +17,13 @@
// ==========================================================
// Native library to write stats log to statsd socket
// ==========================================================
-cc_library_static {
+cc_library {
name: "libstatssocket",
srcs: [
"stats_event_list.c",
"statsd_writer.c",
],
+ host_supported: true,
cflags: [
"-Wall",
"-Werror",
@@ -32,6 +33,7 @@
],
export_include_dirs: ["include"],
shared_libs: [
+ "libcutils",
"liblog",
],
}
diff --git a/libstats/statsd_writer.c b/libstats/statsd_writer.c
index afe401f..e24dff0 100644
--- a/libstats/statsd_writer.c
+++ b/libstats/statsd_writer.c
@@ -15,7 +15,9 @@
*/
#include "statsd_writer.h"
+#include <cutils/fs.h>
#include <cutils/sockets.h>
+#include <cutils/threads.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>