Fix two android metrics reporting in update engine
1. The AttemptCurrentBytesDownloadedMiB was reported in bytes.
2. We were using the same start timestamp (in monotonic_time) for both
boot_time and monotonic_time. This leads to an inaccurate update
duration reporting. This cl saves an extra perf for the boot time and
calculates the duration accordingly.
Also report these information with a different metrics name.
Bug: 30989466
Test: Run an update and check the report
Change-Id: I69e20648501a736a59ff60ca9202ce7bdd9b6e34
diff --git a/update_attempter_android_unittest.cc b/update_attempter_android_unittest.cc
index 6b53a21..2593d44 100644
--- a/update_attempter_android_unittest.cc
+++ b/update_attempter_android_unittest.cc
@@ -120,13 +120,14 @@
prefs_.SetInt64(kPrefsNumReboots, 3);
prefs_.SetInt64(kPrefsPayloadAttemptNumber, 2);
prefs_.SetString(kPrefsPreviousVersion, "56789");
+ prefs_.SetInt64(kPrefsUpdateBootTimestampStart, 10000);
prefs_.SetInt64(kPrefsUpdateTimestampStart, 12345);
Time boot_time = Time::FromInternalValue(22345);
Time up_time = Time::FromInternalValue(21345);
clock_->SetBootTime(boot_time);
clock_->SetMonotonicTime(up_time);
- TimeDelta duration = boot_time - Time::FromInternalValue(12345);
+ TimeDelta duration = boot_time - Time::FromInternalValue(10000);
TimeDelta duration_uptime = up_time - Time::FromInternalValue(12345);
EXPECT_CALL(
*metrics_reporter_,