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/common/mock_hardware.h b/common/mock_hardware.h
index 451af91..826b3b3 100644
--- a/common/mock_hardware.h
+++ b/common/mock_hardware.h
@@ -36,6 +36,9 @@
ON_CALL(*this, IsNormalBootMode())
.WillByDefault(testing::Invoke(&fake_,
&FakeHardware::IsNormalBootMode));
+ ON_CALL(*this, IsOOBEEnabled())
+ .WillByDefault(testing::Invoke(&fake_,
+ &FakeHardware::IsOOBEEnabled));
ON_CALL(*this, IsOOBEComplete(testing::_))
.WillByDefault(testing::Invoke(&fake_,
&FakeHardware::IsOOBEComplete));
@@ -64,6 +67,7 @@
// Hardware overrides.
MOCK_CONST_METHOD0(IsOfficialBuild, bool());
MOCK_CONST_METHOD0(IsNormalBootMode, bool());
+ MOCK_CONST_METHOD0(IsOOBEEnabled, bool());
MOCK_CONST_METHOD1(IsOOBEComplete, bool(base::Time* out_time_of_oobe));
MOCK_CONST_METHOD0(GetHardwareClass, std::string());
MOCK_CONST_METHOD0(GetFirmwareVersion, std::string());