Add StateTracker classes

One shared StateManager object will manage all StateTrackers across all configs, maintaining a map of atom ids to StateTrackers.

StateManager is responsible for initializing and removing StateTrackers and notifying them of event or StateListener changes.

Each StateTracker maintains a list of StateListeners and is responsible for tracking state values to primary keys and notifying StateListeners when a state change occurs.

Test: bit statsd_test:*
Bug: 136566566

Change-Id: Icb61c668a01b611aa75caa7bdc2a6801c650b119
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index 43058d5..05ff490 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -99,6 +99,8 @@
         "src/shell/shell_config.proto",
         "src/shell/ShellSubscriber.cpp",
         "src/socket/StatsSocketListener.cpp",
+        "src/state/StateManager.cpp",
+        "src/state/StateTracker.cpp",
         "src/stats_log_util.cpp",
         "src/statscompanion_util.cpp",
         "src/statsd_config.proto",
@@ -253,6 +255,7 @@
         "tests/metrics/ValueMetricProducer_test.cpp",
         "tests/MetricsManager_test.cpp",
         "tests/shell/ShellSubscriber_test.cpp",
+        "tests/state/StateTracker_test.cpp",
         "tests/statsd_test_util.cpp",
         "tests/StatsLogProcessor_test.cpp",
         "tests/StatsService_test.cpp",