hardware_chromeos.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // Copyright (C) 2013 The Android Open Source Project
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #ifndef UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
  17. #define UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
  18. #include <memory>
  19. #include <string>
  20. #include <vector>
  21. #include <base/macros.h>
  22. #include <base/time/time.h>
  23. #include <debugd/dbus-proxies.h>
  24. #include "update_engine/common/hardware_interface.h"
  25. namespace chromeos_update_engine {
  26. // Implements the real interface with Chrome OS verified boot and recovery
  27. // process.
  28. class HardwareChromeOS final : public HardwareInterface {
  29. public:
  30. HardwareChromeOS() = default;
  31. ~HardwareChromeOS() override = default;
  32. void Init();
  33. // HardwareInterface methods.
  34. bool IsOfficialBuild() const override;
  35. bool IsNormalBootMode() const override;
  36. bool AreDevFeaturesEnabled() const override;
  37. bool IsOOBEEnabled() const override;
  38. bool IsOOBEComplete(base::Time* out_time_of_oobe) const override;
  39. std::string GetHardwareClass() const override;
  40. std::string GetFirmwareVersion() const override;
  41. std::string GetECVersion() const override;
  42. int GetMinKernelKeyVersion() const override;
  43. int GetMinFirmwareKeyVersion() const override;
  44. int GetMaxFirmwareKeyRollforward() const override;
  45. bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override;
  46. bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
  47. int GetPowerwashCount() const override;
  48. bool SchedulePowerwash(bool is_rollback) override;
  49. bool CancelPowerwash() override;
  50. bool GetNonVolatileDirectory(base::FilePath* path) const override;
  51. bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
  52. int64_t GetBuildTimestamp() const override;
  53. bool GetFirstActiveOmahaPingSent() const override;
  54. bool SetFirstActiveOmahaPingSent() override;
  55. private:
  56. friend class HardwareChromeOSTest;
  57. // Load the update manager config flags (is_oobe_enabled flag) from the
  58. // appropriate location based on whether we are in a normal mode boot (as
  59. // passed in |normal_mode|) prefixing the paths with |root_prefix|.
  60. void LoadConfig(const std::string& root_prefix, bool normal_mode);
  61. bool is_oobe_enabled_;
  62. std::unique_ptr<org::chromium::debugdProxyInterface> debugd_proxy_;
  63. DISALLOW_COPY_AND_ASSIGN(HardwareChromeOS);
  64. };
  65. } // namespace chromeos_update_engine
  66. #endif // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_