bootstat: Two changes to aid in debugging TimeSinceFactoryReset.

* Also log to the BootEventRecordStore to check lossiness.
* Log factory_reset_current_time_failure separately.

Bug: 27550578
Change-Id: Id3d579a74a59ac28290cb7d6048765519f9ba59b
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 2639d05..b819797 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -224,13 +224,23 @@
 
   time_t current_time_utc = time(nullptr);
 
-  static const char* factory_reset_current_time = "factory_reset_current_time";
   if (current_time_utc < 0) {
     // UMA does not display negative values in buckets, so convert to positive.
-    bootstat::LogHistogram(factory_reset_current_time, std::abs(current_time_utc));
+    bootstat::LogHistogram(
+        "factory_reset_current_time_failure", std::abs(current_time_utc));
+
+    // Logging via BootEventRecordStore to see if using bootstat::LogHistogram
+    // is losing records somehow.
+    boot_event_store.AddBootEventWithValue(
+        "factory_reset_current_time_failure", std::abs(current_time_utc));
     return;
   } else {
-    bootstat::LogHistogram(factory_reset_current_time, current_time_utc);
+    bootstat::LogHistogram("factory_reset_current_time", current_time_utc);
+
+    // Logging via BootEventRecordStore to see if using bootstat::LogHistogram
+    // is losing records somehow.
+    boot_event_store.AddBootEventWithValue(
+        "factory_reset_current_time", current_time_utc);
   }
 
   // The factory_reset boot event does not exist after the device is reset, so
@@ -247,6 +257,12 @@
   // factory_reset time.
   time_t factory_reset_utc = record.second;
   bootstat::LogHistogram("factory_reset_record_value", factory_reset_utc);
+
+  // Logging via BootEventRecordStore to see if using bootstat::LogHistogram
+  // is losing records somehow.
+  boot_event_store.AddBootEventWithValue(
+      "factory_reset_record_value", factory_reset_utc);
+
   time_t time_since_factory_reset = difftime(current_time_utc,
                                              factory_reset_utc);
   boot_event_store.AddBootEventWithValue("time_since_factory_reset",