Update TrainInfo and BinaryPushStateChanged atoms
Add trainName string field to TrainInfo atom
Add status enum to TrainInfo atom
Add additional states to BinaryPushStateChanged.State
Bug: 124397500
Bug: 126787525
Bug: 126780868
Test: add/edit tests in StorageManagerTest to verify new
serialization/deserialization logic
Change-Id: I7bf4cd3b3cb4fdb8b1ebe51a602cfde9fdace6e1
diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp
index 9ac888b..1526d66 100644
--- a/cmds/statsd/src/StatsService.cpp
+++ b/cmds/statsd/src/StatsService.cpp
@@ -1210,20 +1210,22 @@
(long long)expId);
}
- vector<uint8_t> buffer;
- buffer.resize(proto.size());
+ vector<uint8_t> experimentIdsProtoBuffer;
+ experimentIdsProtoBuffer.resize(proto.size());
size_t pos = 0;
auto iter = proto.data();
while (iter.readBuffer() != NULL) {
size_t toRead = iter.currentToRead();
- std::memcpy(&(buffer[pos]), iter.readBuffer(), toRead);
+ std::memcpy(&(experimentIdsProtoBuffer[pos]), iter.readBuffer(), toRead);
pos += toRead;
iter.rp()->move(toRead);
}
- LogEvent event(std::string(String8(trainName).string()), trainVersionCode, requiresStaging,
- rollbackEnabled, requiresLowLatencyMonitor, state, buffer, userId);
+
+ std::string trainNameUtf8 = std::string(String8(trainName).string());
+ LogEvent event(trainNameUtf8, trainVersionCode, requiresStaging, rollbackEnabled,
+ requiresLowLatencyMonitor, state, experimentIdsProtoBuffer, userId);
mProcessor->OnLogEvent(&event);
- StorageManager::writeTrainInfo(trainVersionCode, buffer);
+ StorageManager::writeTrainInfo(trainVersionCode, trainNameUtf8, state, experimentIdsProtoBuffer);
return Status::ok();
}