Use the configs from disk after reboot and separate out ConfigManager
startup for unit test to avoid reading configs for tests
Bug: 70667694
Test: manual testing conducted, statsd, statsd_test
Change-Id: I49cb82d2b1d7c178b7a4c30c089d8d93e7902faa
diff --git a/cmds/statsd/src/config/ConfigManager.cpp b/cmds/statsd/src/config/ConfigManager.cpp
index de75c71..876c7fb 100644
--- a/cmds/statsd/src/config/ConfigManager.cpp
+++ b/cmds/statsd/src/config/ConfigManager.cpp
@@ -49,15 +49,13 @@
void ConfigManager::Startup() {
map<ConfigKey, StatsdConfig> configsFromDisk;
StorageManager::readConfigFromDisk(configsFromDisk);
- // TODO(b/70667694): Make the configs from disk be used. And remove the fake config,
- // and tests shouldn't call this Startup(), maybe call StartupForTest() so we don't read
- // configs from disk for tests.
- // for (const auto& pair : configsFromDisk) {
- // UpdateConfig(pair.first, pair.second);
- //}
+ for (const auto& pair : configsFromDisk) {
+ UpdateConfig(pair.first, pair.second);
+ }
+}
- // Uncomment the following line and use the hard coded config for development.
- // UpdateConfig(ConfigKey(1000, "fake"), build_fake_config());
+void ConfigManager::StartupForTest() {
+ // Dummy function to avoid reading configs from disks for tests.
}
void ConfigManager::AddListener(const sp<ConfigListener>& listener) {