Atom: DaveyOccurred

Atom for davey occurred

Test: cts test accompanying && statsd unit tests && hwui unit tests
Change-Id: I715ac213b09ef2b3ef1de75bc456a5edf7e0a244
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 3323bce..24d819e 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -134,6 +134,8 @@
     name: "libhwui_defaults",
     defaults: ["hwui_defaults"],
 
+    shared_libs: ["libstatslog"],
+
     whole_static_libs: ["libskia"],
 
     srcs: [
@@ -318,7 +320,10 @@
         "libgmock",
         "libhwui_static_debug",
     ],
-    shared_libs: ["libmemunreachable"],
+    shared_libs: [
+        "libmemunreachable",
+        "libstatslog",
+    ],
     cflags: [
         "-include debug/wrap_gles.h",
         "-DHWUI_NULL_GPU",
@@ -383,7 +388,10 @@
 
     // set to libhwui_static_debug to skip actual GL commands
     whole_static_libs: ["libhwui"],
-    shared_libs: ["libmemunreachable"],
+    shared_libs: [
+        "libmemunreachable",
+        "libstatslog",
+    ],
 
     srcs: [
         "tests/macrobench/TestSceneRunner.cpp",
@@ -405,7 +413,10 @@
     ],
 
     whole_static_libs: ["libhwui_static_debug"],
-    shared_libs: ["libmemunreachable"],
+    shared_libs: [
+        "libmemunreachable",
+        "libstatslog",
+    ],
 
     srcs: [
         "tests/microbench/main.cpp",
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index f41956c..ab27a0d 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -18,6 +18,7 @@
 
 #include <errno.h>
 #include <inttypes.h>
+#include <statslog.h>
 #include <sys/mman.h>
 
 #include <algorithm>
@@ -164,6 +165,7 @@
         ALOGI("%s", ss.str().c_str());
         // Just so we have something that counts up, the value is largely irrelevant
         ATRACE_INT(ss.str().c_str(), ++sDaveyCount);
+        android::util::stats_write(android::util::DAVEY_OCCURRED, ns2ms(totalDuration));
     }
 }