Set current state key earlier and do not reset hasCurrentState

- The current state key was updated to the new state key after the diff
calculations and base setting. There are a few cases where we exit the
current loop which results in the current state key not getting updated.
- When we reset the base, we should not reset the current state. All
instances where hasCurrentState was set to false have been removed.
- I added a unit test for a value metric that is sliced by state and has
a condition.

Bug: 157661456
Test: m statsd_test && adb sync data && adb shell
data/nativetest/statsd_test/statsd_test32

Change-Id: Ib75bd9d08e6785f9e03b4b5984dbdaf86a7e1749
diff --git a/cmds/statsd/src/metrics/MetricProducer.cpp b/cmds/statsd/src/metrics/MetricProducer.cpp
index cdd20cd..fe143e4 100644
--- a/cmds/statsd/src/metrics/MetricProducer.cpp
+++ b/cmds/statsd/src/metrics/MetricProducer.cpp
@@ -98,7 +98,7 @@
 
     // Stores atom id to primary key pairs for each state atom that the metric is
     // sliced by.
-    std::map<int, HashableDimensionKey> statePrimaryKeys;
+    std::map<int32_t, HashableDimensionKey> statePrimaryKeys;
 
     // For states with primary fields, use MetricStateLinks to get the primary
     // field values from the log event. These values will form a primary key