update_engine: Send UMA stats about kernel key versions
Adding the following UMA stats:
- UpdateEngine.KernelKey.MinVersion: Minimum kernel key version
already set in the TPM.
- UpdateEngine.KernelKey.MaxRollforwardVersion: Maximum kernel key
rollforward version set by update_engine.
- UpdateEngine.KernelKey.MaxRollforwardSetSuccess: Whether setting
the maximum kernely key rollforward version succeeded.
Chromium CL of the new histograms: crrev.com/c/1078750
BUG=chromium:843622
TEST='cros_run_unit_tests --board=caroline --packages update_engine'
Change-Id: I14192b5ff9c07f8a003e0589450202f488cccc01
Reviewed-on: https://chromium-review.googlesource.com/1078968
Commit-Ready: Zentaro Kavanagh <zentaro@chromium.org>
Tested-by: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org>
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 0e5ffb0..f2a83f7 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -2797,6 +2797,11 @@
EXPECT_EQ(min_kernel_version, fake_hw->GetMinKernelKeyVersion());
EXPECT_EQ(kRollforwardInfinity, fake_hw->GetMaxKernelKeyRollforward());
+ EXPECT_CALL(
+ *fake_system_state_.mock_metrics_reporter(),
+ ReportKeyVersionMetrics(min_kernel_version, min_kernel_version, true))
+ .Times(1);
+
TestRollbackCheck(false /* is_consumer_device */,
3 /* rollback_allowed_milestones */,
false /* is_policy_loaded */);
@@ -2824,6 +2829,11 @@
EXPECT_EQ(min_kernel_version, fake_hw->GetMinKernelKeyVersion());
EXPECT_EQ(kRollforwardInfinity, fake_hw->GetMaxKernelKeyRollforward());
+ EXPECT_CALL(
+ *fake_system_state_.mock_metrics_reporter(),
+ ReportKeyVersionMetrics(min_kernel_version, kRollforwardInfinity, true))
+ .Times(1);
+
TestRollbackCheck(true /* is_consumer_device */,
3 /* rollback_allowed_milestones */,
false /* is_policy_loaded */);
@@ -2850,6 +2860,11 @@
EXPECT_EQ(min_kernel_version, fake_hw->GetMinKernelKeyVersion());
EXPECT_EQ(kRollforwardInfinity, fake_hw->GetMaxKernelKeyRollforward());
+ EXPECT_CALL(
+ *fake_system_state_.mock_metrics_reporter(),
+ ReportKeyVersionMetrics(min_kernel_version, min_kernel_version, true))
+ .Times(1);
+
TestRollbackCheck(false /* is_consumer_device */,
allowed_milestones,
true /* is_policy_loaded */);
@@ -2877,6 +2892,11 @@
EXPECT_EQ(min_kernel_version, fake_hw->GetMinKernelKeyVersion());
EXPECT_EQ(kRollforwardInfinity, fake_hw->GetMaxKernelKeyRollforward());
+ EXPECT_CALL(
+ *fake_system_state_.mock_metrics_reporter(),
+ ReportKeyVersionMetrics(min_kernel_version, kRollforwardInfinity, true))
+ .Times(1);
+
TestRollbackCheck(false /* is_consumer_device */,
allowed_milestones,
true /* is_policy_loaded */);