logd: Drop the LogStatistics dependency on LogBufferElement

Other log buffers may not use LogBufferElement, so we should decouple
the two classes.  This uses an intermediate LogStatisticsElement
structs instead of passing a large number of parameters to each
function.

This additionally moves IsBinary() and the GetTag() functions out into
LogUtils.h since they can be used generically by other users.

Test: logging unit tests
Change-Id: I71f53257342c067bcccd5aa00bae47f714cd7c66
diff --git a/logd/ChattyLogBuffer.cpp b/logd/ChattyLogBuffer.cpp
index c2e89fc..62c8629 100644
--- a/logd/ChattyLogBuffer.cpp
+++ b/logd/ChattyLogBuffer.cpp
@@ -74,7 +74,8 @@
     }
 
     // audit message (except sequence number) identical?
-    if (last.IsBinary() && lenl > static_cast<ssize_t>(sizeof(android_log_event_string_t)) &&
+    if (IsBinary(last.log_id()) &&
+        lenl > static_cast<ssize_t>(sizeof(android_log_event_string_t)) &&
         lenr > static_cast<ssize_t>(sizeof(android_log_event_string_t))) {
         if (fastcmp<memcmp>(msgl, msgr, sizeof(android_log_event_string_t) - sizeof(int32_t))) {
             return DIFFERENT;
@@ -205,9 +206,9 @@
 #endif
 
     if (coalesce) {
-        stats()->Erase(element);
+        stats()->Erase(element.ToLogStatisticsElement());
     } else {
-        stats()->Subtract(element);
+        stats()->Subtract(element.ToLogStatisticsElement());
     }
 
     it = SimpleLogBuffer::Erase(it);
@@ -533,7 +534,7 @@
             if (leading) {
                 it = Erase(it);
             } else {
-                stats()->Drop(element);
+                stats()->Drop(element.ToLogStatisticsElement());
                 element.SetDropped(1);
                 if (last.coalesce(&element, 1)) {
                     it = Erase(it, true);