Update indices of preserved matchers
This cl updates mIndex and mChildren of preserved atom matchers across
config updates, since the index of the sp<> in mAllAtomMatchers can
change during a config update.
Test: atest statsd_test
Bug: 164282429
Change-Id: I7eb252439876d7330b9bba81e046fe3e89df6e5d
diff --git a/cmds/statsd/src/matchers/SimpleAtomMatchingTracker.cpp b/cmds/statsd/src/matchers/SimpleAtomMatchingTracker.cpp
index 86b148d..423da5b 100644
--- a/cmds/statsd/src/matchers/SimpleAtomMatchingTracker.cpp
+++ b/cmds/statsd/src/matchers/SimpleAtomMatchingTracker.cpp
@@ -50,6 +50,14 @@
return mInitialized;
}
+bool SimpleAtomMatchingTracker::onConfigUpdated(
+ const AtomMatcher& matcher, const int index,
+ const unordered_map<int64_t, int>& atomMatchingTrackerMap) {
+ mIndex = index;
+ // Do not need to update mMatcher since the matcher must be identical across the update.
+ return mInitialized;
+}
+
void SimpleAtomMatchingTracker::onLogEvent(
const LogEvent& event, const vector<sp<AtomMatchingTracker>>& allAtomMatchingTrackers,
vector<MatchingState>& matcherResults) {