logd: move current sequence from LogBufferElement to LogBuffer

This is required for tests that are aware of sequence numbers to pass;
each new LogBuffer instance should start from sequence = 1, which
isn't the case if the current sequence number is a static.

Test: unit tests
Change-Id: Ie488f8ac5e22b946b7e6237d1d5caf14929c0ec3
diff --git a/logd/ChattyLogBuffer.cpp b/logd/ChattyLogBuffer.cpp
index fd2c236..68e0dc6 100644
--- a/logd/ChattyLogBuffer.cpp
+++ b/logd/ChattyLogBuffer.cpp
@@ -177,7 +177,8 @@
     // exact entry with time specified in ms or us precision.
     if ((realtime.tv_nsec % 1000) == 0) ++realtime.tv_nsec;
 
-    LogBufferElement elem(log_id, realtime, uid, pid, tid, msg, len);
+    auto sequence = sequence_.fetch_add(1, std::memory_order_relaxed);
+    LogBufferElement elem(log_id, realtime, uid, pid, tid, sequence, msg, len);
 
     // b/137093665: don't coalesce security messages.
     if (log_id == LOG_ID_SECURITY) {