blob: 2d4393130454484e18a3b7a1de233b110f482d1e [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
Zentaro Kavanaghbaacb982018-02-20 17:48:39 -080020#include <memory>
Alex Deymo40d86b22015-09-03 22:27:10 -070021#include <string>
22#include <vector>
23
24#include <base/macros.h>
25#include <base/time/time.h>
Sen Jiange67bb5b2016-06-20 15:53:56 -070026#include <debugd/dbus-proxies.h>
Alex Deymo40d86b22015-09-03 22:27:10 -070027
Alex Deymo39910dc2015-11-09 17:04:30 -080028#include "update_engine/common/hardware_interface.h"
Alex Deymo40d86b22015-09-03 22:27:10 -070029
30namespace chromeos_update_engine {
31
32// Implements the real interface with Chrome OS verified boot and recovery
33// process.
34class HardwareChromeOS final : public HardwareInterface {
35 public:
36 HardwareChromeOS() = default;
37 ~HardwareChromeOS() override = default;
38
Alex Deymo46a9aae2016-05-04 20:20:11 -070039 void Init();
40
Alex Deymo40d86b22015-09-03 22:27:10 -070041 // HardwareInterface methods.
42 bool IsOfficialBuild() const override;
43 bool IsNormalBootMode() const override;
Sen Jiange67bb5b2016-06-20 15:53:56 -070044 bool AreDevFeaturesEnabled() const override;
Alex Deymo46a9aae2016-05-04 20:20:11 -070045 bool IsOOBEEnabled() const override;
Alex Deymo40d86b22015-09-03 22:27:10 -070046 bool IsOOBEComplete(base::Time* out_time_of_oobe) const override;
47 std::string GetHardwareClass() const override;
48 std::string GetFirmwareVersion() const override;
49 std::string GetECVersion() const override;
Zentaro Kavanaghbaacb982018-02-20 17:48:39 -080050 int GetMinKernelKeyVersion() const override;
51 bool SetMaxKernelKeyRollforward(int max_kernel_rollforward) override;
Alex Deymo40d86b22015-09-03 22:27:10 -070052 int GetPowerwashCount() const override;
Alex Deymofb905d92016-06-03 19:26:58 -070053 bool SchedulePowerwash() override;
54 bool CancelPowerwash() override;
Alex Deymodd132f32015-09-14 19:12:07 -070055 bool GetNonVolatileDirectory(base::FilePath* path) const override;
56 bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
Amin Hassani1677e812017-06-21 13:36:36 -070057 bool GetFirstActiveOmahaPingSent() const override;
58 void SetFirstActiveOmahaPingSent() override;
Alex Deymo40d86b22015-09-03 22:27:10 -070059
60 private:
Alex Deymo46a9aae2016-05-04 20:20:11 -070061 friend class HardwareChromeOSTest;
62
63 // Load the update manager config flags (is_oobe_enabled flag) from the
64 // appropriate location based on whether we are in a normal mode boot (as
65 // passed in |normal_mode|) prefixing the paths with |root_prefix|.
66 void LoadConfig(const std::string& root_prefix, bool normal_mode);
67
68 bool is_oobe_enabled_;
69
Sen Jiange67bb5b2016-06-20 15:53:56 -070070 std::unique_ptr<org::chromium::debugdProxyInterface> debugd_proxy_;
71
Alex Deymo40d86b22015-09-03 22:27:10 -070072 DISALLOW_COPY_AND_ASSIGN(HardwareChromeOS);
73};
74
75} // namespace chromeos_update_engine
76
Alex Deymo1b03f9f2015-12-09 00:38:36 -080077#endif // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_