blob: bc0e891bae48ce00e635207c26a4e3427a3870e3 [file] [log] [blame]
Alex Deymo40d86b22015-09-03 22:27:10 -07001//
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 Deymo1b03f9f2015-12-09 00:38:36 -080017#ifndef UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
18#define UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
Alex Deymo40d86b22015-09-03 22:27:10 -070019
20#include <string>
21#include <vector>
22
23#include <base/macros.h>
24#include <base/time/time.h>
25
Alex Deymo39910dc2015-11-09 17:04:30 -080026#include "update_engine/common/hardware_interface.h"
Alex Deymo40d86b22015-09-03 22:27:10 -070027
28namespace chromeos_update_engine {
29
30// Implements the real interface with Chrome OS verified boot and recovery
31// process.
32class HardwareChromeOS final : public HardwareInterface {
33 public:
34 HardwareChromeOS() = default;
35 ~HardwareChromeOS() override = default;
36
Alex Deymo46a9aae2016-05-04 20:20:11 -070037 void Init();
38
Alex Deymo40d86b22015-09-03 22:27:10 -070039 // HardwareInterface methods.
40 bool IsOfficialBuild() const override;
41 bool IsNormalBootMode() const override;
Alex Deymo46a9aae2016-05-04 20:20:11 -070042 bool IsOOBEEnabled() const override;
Alex Deymo40d86b22015-09-03 22:27:10 -070043 bool IsOOBEComplete(base::Time* out_time_of_oobe) const override;
44 std::string GetHardwareClass() const override;
45 std::string GetFirmwareVersion() const override;
46 std::string GetECVersion() const override;
47 int GetPowerwashCount() const override;
Alex Deymofb905d92016-06-03 19:26:58 -070048 bool SchedulePowerwash() override;
49 bool CancelPowerwash() override;
Alex Deymodd132f32015-09-14 19:12:07 -070050 bool GetNonVolatileDirectory(base::FilePath* path) const override;
51 bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
Alex Deymo40d86b22015-09-03 22:27:10 -070052
53 private:
Alex Deymo46a9aae2016-05-04 20:20:11 -070054 friend class HardwareChromeOSTest;
55
56 // Load the update manager config flags (is_oobe_enabled flag) from the
57 // appropriate location based on whether we are in a normal mode boot (as
58 // passed in |normal_mode|) prefixing the paths with |root_prefix|.
59 void LoadConfig(const std::string& root_prefix, bool normal_mode);
60
61 bool is_oobe_enabled_;
62
Alex Deymo40d86b22015-09-03 22:27:10 -070063 DISALLOW_COPY_AND_ASSIGN(HardwareChromeOS);
64};
65
66} // namespace chromeos_update_engine
67
Alex Deymo1b03f9f2015-12-09 00:38:36 -080068#endif // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_