Remove kStateAtomsInfo from atoms_info.

Use the annotation information in LogEvent/FieldValue instead.

- Initialize nested to true in FieldValue.mAnnotations

- Add filterPrimaryKey function to HashableDimensionKey for populating a
HashableDimensionKey with all FieldValues that have the primary key
annotation set.

- Create StateTrackers without checking if atom is a state atom. (We
  can't do this check anymore)

- Remove mAtomId, mStateField, mNested, mPrimaryFields, mDefaultState,
    mResetState members from StateTracker. Use the information passed in
    LogEvent in onLogEvent instead.

- Update tests to log annotations when logging events.

- Remote kStateAtomsFieldOptions from atoms_info.

- Make MetricProducer::mStateGroupMap const

- Rename handlePartialReset to clearStateForPrimaryKey

- Store "default" states in mStateMap. An entry in mStateMap means the
state is not kStateUnknown. Before, an entry in mStateMap meant the
state is not the "default" state.

- Consolidate all state change logic in updateStateForPrimaryKey()
    - remote StateTracker::updateState
    - handleReset and clearStateForPrimaryKey call
    updateStateForPrimaryKey for resetting and clearing of states
    respectively.

- Create a helper method for notifying StateTracker listeners

- Make StateManager::registerListener void

Bug: 151110842
Test: bit statsd_test:*
Change-Id: Ifb8371b213a178fcccaa484086fbdd283dbaec49
diff --git a/cmds/statsd/src/HashableDimensionKey.cpp b/cmds/statsd/src/HashableDimensionKey.cpp
index 29249f4..eba66e0 100644
--- a/cmds/statsd/src/HashableDimensionKey.cpp
+++ b/cmds/statsd/src/HashableDimensionKey.cpp
@@ -180,6 +180,23 @@
     return num_matches > 0;
 }
 
+bool filterPrimaryKey(const std::vector<FieldValue>& values, HashableDimensionKey* output) {
+    size_t num_matches = 0;
+    const int32_t simpleFieldMask = 0xff7f0000;
+    const int32_t attributionUidFieldMask = 0xff7f7f7f;
+    for (const auto& value : values) {
+        if (value.mAnnotations.isPrimaryField()) {
+            output->addValue(value);
+            output->mutableValue(num_matches)->mField.setTag(value.mField.getTag());
+            const int32_t mask =
+                    isAttributionUidField(value) ? attributionUidFieldMask : simpleFieldMask;
+            output->mutableValue(num_matches)->mField.setField(value.mField.getField() & mask);
+            num_matches++;
+        }
+    }
+    return num_matches > 0;
+}
+
 void filterGaugeValues(const std::vector<Matcher>& matcherFields,
                        const std::vector<FieldValue>& values, std::vector<FieldValue>* output) {
     for (const auto& field : matcherFields) {