Fix non-critical updates on boards without an OOBE flow.
A recent change in the policy made update_engine to ignore available
updates if the OOBE flow is not completed and the update is not
critical. Nevertheless, some custom boards don't have a OOBE flow as
Chromebooks do and set is_oobe_enabled=false in the policy manager.
These board were not getting regular updates because the OOBE flow is
considered not completed in those cases.
This patch moves the is_oobe_enabled flag to the HardwareInterface class
together with the IsOOBEComplete() method and updates the callers to
check the IsOOBEEnabled() value before.
Bug: 28460247
Bug: 28553821
TEST=Added unittest for the disabled and not complete case.
Change-Id: Ifd3ac2dc5e7a43f6c24eb014b7e3eacad22e3ab3
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index a7abdec..d4b166f 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -531,6 +531,22 @@
nullptr));
EXPECT_FALSE(response.update_exists);
+ // The IsOOBEComplete() value is ignored when the OOBE flow is not enabled.
+ fake_system_state_.fake_hardware()->SetIsOOBEEnabled(false);
+ ASSERT_TRUE(TestUpdateCheck(nullptr, // request_params
+ fake_update_response_.GetUpdateResponse(),
+ -1,
+ false, // ping_only
+ ErrorCode::kSuccess,
+ metrics::CheckResult::kUpdateAvailable,
+ metrics::CheckReaction::kUpdating,
+ metrics::DownloadErrorCode::kUnset,
+ &response,
+ nullptr));
+ EXPECT_TRUE(response.update_exists);
+ fake_system_state_.fake_hardware()->SetIsOOBEEnabled(true);
+
+ // The payload is applied when a deadline was set in the response.
fake_update_response_.deadline = "20101020";
ASSERT_TRUE(
TestUpdateCheck(nullptr, // request_params