Reduce memory footprint of LogEvent

This reduces the memory footprint by 16 bytes per LogEvent.

Test: atest statsd_test
Test: atest CtsStatsdHostTestCases
Bug: 154857643
Change-Id: I1e541816377ae8b14d789dc4d1f0a4ec91eef998
diff --git a/cmds/statsd/src/logd/LogEvent.h b/cmds/statsd/src/logd/LogEvent.h
index 731b966..53fb5d9 100644
--- a/cmds/statsd/src/logd/LogEvent.h
+++ b/cmds/statsd/src/logd/LogEvent.h
@@ -160,7 +160,7 @@
     //    }
     // Note that atomIndex is 1-indexed.
     inline int getUidFieldIndex() {
-        return mUidFieldIndex;
+        return static_cast<int>(mUidFieldIndex);
     }
 
     // Returns whether this LogEvent has an AttributionChain.
@@ -179,7 +179,7 @@
     //    }
     // Note that atomIndex is 1-indexed.
     inline int getExclusiveStateFieldIndex() const {
-        return mExclusiveStateFieldIndex;
+        return static_cast<int>(mExclusiveStateFieldIndex);
     }
 
     // If a reset state is not sent in the StatsEvent, returns -1. Note that a
@@ -212,10 +212,6 @@
         return mValid;
     }
 
-    int32_t getErrorBitmask() const {
-        return mErrorBitmask;
-    }
-
 private:
     /**
      * Only use this if copy is absolutely needed.
@@ -316,16 +312,16 @@
     // The pid of the logging client (defaults to -1).
     int32_t mLogPid = -1;
 
-    // Bitmask of errors sent by StatsEvent/AStatsEvent.
-    int32_t mErrorBitmask = 0;
-
     // Annotations
     bool mTruncateTimestamp = false;
-    int mUidFieldIndex = -1;
-    int mAttributionChainStartIndex = -1;
-    int mAttributionChainEndIndex = -1;
-    int mExclusiveStateFieldIndex = -1;
     int mResetState = -1;
+
+    // Indexes within the FieldValue vector can be stored in 7 bits because
+    // that's the assumption enforced by the encoding used in FieldValue.
+    int8_t mUidFieldIndex = -1;
+    int8_t mAttributionChainStartIndex = -1;
+    int8_t mAttributionChainEndIndex = -1;
+    int8_t mExclusiveStateFieldIndex = -1;
 };
 
 void writeExperimentIdsToProto(const std::vector<int64_t>& experimentIds, std::vector<uint8_t>* protoOut);