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/hardware_chromeos.h b/hardware_chromeos.h
index 80888ab..d9a73f8 100644
--- a/hardware_chromeos.h
+++ b/hardware_chromeos.h
@@ -34,9 +34,12 @@
   HardwareChromeOS() = default;
   ~HardwareChromeOS() override = default;
 
+  void Init();
+
   // HardwareInterface methods.
   bool IsOfficialBuild() const override;
   bool IsNormalBootMode() const override;
+  bool IsOOBEEnabled() const override;
   bool IsOOBEComplete(base::Time* out_time_of_oobe) const override;
   std::string GetHardwareClass() const override;
   std::string GetFirmwareVersion() const override;
@@ -46,6 +49,15 @@
   bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
 
  private:
+  friend class HardwareChromeOSTest;
+
+  // Load the update manager config flags (is_oobe_enabled flag) from the
+  // appropriate location based on whether we are in a normal mode boot (as
+  // passed in |normal_mode|) prefixing the paths with |root_prefix|.
+  void LoadConfig(const std::string& root_prefix, bool normal_mode);
+
+  bool is_oobe_enabled_;
+
   DISALLOW_COPY_AND_ASSIGN(HardwareChromeOS);
 };