Report more android update metrics in update engine
Report more metrics with android::metricslogger.
Metrics include:
ota_update_engine_attempt_number
ota_update_engine_attempt_result
ota_update_engine_attempt_duration_in_minutes
ota_update_engine_attempt_duration_uptime_in_minutes
ota_update_engine_attempt_payload_size_mib
ota_update_engine_attempt_payload_type
ota_update_engine_successful_update_attempt_count
ota_update_engine_successful_update_total_duration_in_minutes
ota_update_engine_successful_update_payload_size_mib
ota_update_engine_successful_update_payload_type
ota_update_engine_successful_update_reboot_count
And the google3 CL in cr/review/172829231
Bug: 30989466
Test: compile update_engine for marlin
Change-Id: Ic0ead07d1bd4a575244eb5e05588b47ba7b0bafe
diff --git a/update_attempter_android_unittest.cc b/update_attempter_android_unittest.cc
index 6c0718a..ac6cec2 100644
--- a/update_attempter_android_unittest.cc
+++ b/update_attempter_android_unittest.cc
@@ -120,16 +120,19 @@
prefs_.SetString(kPrefsPreviousVersion, "56789");
prefs_.SetInt64(kPrefsUpdateTimestampStart, 12345);
- Time now = Time::FromInternalValue(22345);
- clock_->SetMonotonicTime(now);
- TimeDelta duration = now - Time::FromInternalValue(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_uptime = up_time - Time::FromInternalValue(12345);
EXPECT_CALL(
*metrics_reporter_,
ReportUpdateAttemptMetrics(_,
2,
_,
- _,
duration,
+ duration_uptime,
_,
metrics::AttemptResult::kUpdateSucceeded,
ErrorCode::kSuccess))