| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 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 |  | 
| Alex Deymo | 1b03f9f | 2015-12-09 00:38:36 -0800 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_HARDWARE_CHROMEOS_H_ | 
|  | 18 | #define UPDATE_ENGINE_HARDWARE_CHROMEOS_H_ | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 19 |  | 
|  | 20 | #include <string> | 
|  | 21 | #include <vector> | 
|  | 22 |  | 
|  | 23 | #include <base/macros.h> | 
|  | 24 | #include <base/time/time.h> | 
| Sen Jiang | e67bb5b | 2016-06-20 15:53:56 -0700 | [diff] [blame] | 25 | #include <debugd/dbus-proxies.h> | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 26 |  | 
| Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 27 | #include "update_engine/common/hardware_interface.h" | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 28 |  | 
|  | 29 | namespace chromeos_update_engine { | 
|  | 30 |  | 
|  | 31 | // Implements the real interface with Chrome OS verified boot and recovery | 
|  | 32 | // process. | 
|  | 33 | class HardwareChromeOS final : public HardwareInterface { | 
|  | 34 | public: | 
|  | 35 | HardwareChromeOS() = default; | 
|  | 36 | ~HardwareChromeOS() override = default; | 
|  | 37 |  | 
| Alex Deymo | 46a9aae | 2016-05-04 20:20:11 -0700 | [diff] [blame] | 38 | void Init(); | 
|  | 39 |  | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 40 | // HardwareInterface methods. | 
|  | 41 | bool IsOfficialBuild() const override; | 
|  | 42 | bool IsNormalBootMode() const override; | 
| Sen Jiang | e67bb5b | 2016-06-20 15:53:56 -0700 | [diff] [blame] | 43 | bool AreDevFeaturesEnabled() const override; | 
| Alex Deymo | 46a9aae | 2016-05-04 20:20:11 -0700 | [diff] [blame] | 44 | bool IsOOBEEnabled() const override; | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 45 | bool IsOOBEComplete(base::Time* out_time_of_oobe) const override; | 
|  | 46 | std::string GetHardwareClass() const override; | 
|  | 47 | std::string GetFirmwareVersion() const override; | 
|  | 48 | std::string GetECVersion() const override; | 
|  | 49 | int GetPowerwashCount() const override; | 
| Alex Deymo | fb905d9 | 2016-06-03 19:26:58 -0700 | [diff] [blame] | 50 | bool SchedulePowerwash() override; | 
|  | 51 | bool CancelPowerwash() override; | 
| Alex Deymo | dd132f3 | 2015-09-14 19:12:07 -0700 | [diff] [blame] | 52 | bool GetNonVolatileDirectory(base::FilePath* path) const override; | 
|  | 53 | bool GetPowerwashSafeDirectory(base::FilePath* path) const override; | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 54 |  | 
|  | 55 | private: | 
| Alex Deymo | 46a9aae | 2016-05-04 20:20:11 -0700 | [diff] [blame] | 56 | friend class HardwareChromeOSTest; | 
|  | 57 |  | 
|  | 58 | // Load the update manager config flags (is_oobe_enabled flag) from the | 
|  | 59 | // appropriate location based on whether we are in a normal mode boot (as | 
|  | 60 | // passed in |normal_mode|) prefixing the paths with |root_prefix|. | 
|  | 61 | void LoadConfig(const std::string& root_prefix, bool normal_mode); | 
|  | 62 |  | 
|  | 63 | bool is_oobe_enabled_; | 
|  | 64 |  | 
| Sen Jiang | e67bb5b | 2016-06-20 15:53:56 -0700 | [diff] [blame] | 65 | std::unique_ptr<org::chromium::debugdProxyInterface> debugd_proxy_; | 
|  | 66 |  | 
| Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 67 | DISALLOW_COPY_AND_ASSIGN(HardwareChromeOS); | 
|  | 68 | }; | 
|  | 69 |  | 
|  | 70 | }  // namespace chromeos_update_engine | 
|  | 71 |  | 
| Alex Deymo | 1b03f9f | 2015-12-09 00:38:36 -0800 | [diff] [blame] | 72 | #endif  // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_ |