Persist metric activation across beta4/5 ota
In beta 4, activeEventActivation proto object does not have a state field and assumed to be active if it is written to disk. In beta 5, we add a state field to support persisting metric activation status across a system server crash. However, if a device updated from beta 4 to 5, we don't have any knowledge of the state when we read. Therefore, assume the lack of the state field as the event activation should be active for the provided ttl. Bug: 134795027 Test: used flashstation to flash a device to beta 4. Then manually push and activate a simple config. Then use vendor/google/tools/flashall to update to qt-dev + this change. Manually ensure metric/config are still active. Test: gts-tradefed run gts-dev --module GtsStatsdHostTestCases Test: bit statsd_test:* Change-Id: I8594d04efaa2ae1f669113aaffd33e5fa5851e73
This commit is contained in:
@@ -171,7 +171,9 @@ void MetricProducer::loadActiveMetricLocked(const ActiveMetric& activeMetric,
|
||||
continue;
|
||||
}
|
||||
auto& activation = it->second;
|
||||
if (activeEventActivation.state() == ActiveEventActivation::ACTIVE) {
|
||||
// If the event activation does not have a state, assume it is active.
|
||||
if (!activeEventActivation.has_state() ||
|
||||
activeEventActivation.state() == ActiveEventActivation::ACTIVE) {
|
||||
// We don't want to change the ttl for future activations, so we set the start_ns
|
||||
// such that start_ns + ttl_ns == currentTimeNs + remaining_ttl_nanos
|
||||
activation->start_ns =
|
||||
|
||||
Reference in New Issue
Block a user