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.cc b/omaha_request_action.cc
index 16338a8..173d387 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -605,9 +605,10 @@
// inspecting the timestamp of when OOBE happened.
Time time_of_oobe;
- if (!system_state->hardware()->IsOOBEComplete(&time_of_oobe)) {
+ if (!system_state->hardware()->IsOOBEEnabled() ||
+ !system_state->hardware()->IsOOBEComplete(&time_of_oobe)) {
LOG(INFO) << "Not generating Omaha InstallData as we have "
- << "no prefs file and OOBE is not complete.";
+ << "no prefs file and OOBE is not complete or not enabled.";
return -1;
}
@@ -1037,7 +1038,8 @@
OmahaResponse& output_object = const_cast<OmahaResponse&>(GetOutputObject());
PayloadStateInterface* payload_state = system_state_->payload_state();
- if (!system_state_->hardware()->IsOOBEComplete(nullptr) &&
+ if (system_state_->hardware()->IsOOBEEnabled() &&
+ !system_state_->hardware()->IsOOBEComplete(nullptr) &&
output_object.deadline.empty() &&
params_->app_version() != "ForcedUpdate") {
output_object.update_exists = false;