blob: b071e060c901c2bc4350de4d463bd9e72ea7a7a6 [file] [log] [blame]
Alex Deymo40d86b22015-09-03 22:27:10 -07001//
2// Copyright (C) 2015 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
Amin Hassaniec7bc112020-10-29 16:47:58 -070017#ifndef UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_
18#define UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_
Alex Deymo40d86b22015-09-03 22:27:10 -070019
20#include <string>
21
Kokoa Matsuda1783eb32024-10-16 13:49:17 +090022#include <android-base/macros.h>
Alex Deymo40d86b22015-09-03 22:27:10 -070023#include <base/time/time.h>
24
Yifan Hong87029332020-09-01 17:20:08 -070025#include "update_engine/common/error_code.h"
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 the hardware in the Android platform.
Kelvin Zhangd7191032020-08-11 10:48:16 -040031class HardwareAndroid : public HardwareInterface {
Alex Deymo40d86b22015-09-03 22:27:10 -070032 public:
33 HardwareAndroid() = default;
34 ~HardwareAndroid() override = default;
35
36 // HardwareInterface methods.
37 bool IsOfficialBuild() const override;
38 bool IsNormalBootMode() const override;
Sen Jiange67bb5b2016-06-20 15:53:56 -070039 bool AreDevFeaturesEnabled() const override;
Alex Deymo46a9aae2016-05-04 20:20:11 -070040 bool IsOOBEEnabled() const override;
Alex Deymo40d86b22015-09-03 22:27:10 -070041 bool IsOOBEComplete(base::Time* out_time_of_oobe) const override;
42 std::string GetHardwareClass() const override;
Matt Ziegelbaumaa8e1a42019-05-09 21:41:58 -040043 std::string GetDeviceRequisition() const override;
Zentaro Kavanaghbaacb982018-02-20 17:48:39 -080044 int GetMinKernelKeyVersion() const override;
Marton Hunyady99ced782018-05-08 12:59:50 +020045 int GetMinFirmwareKeyVersion() const override;
Zentaro Kavanagh8f6f2432018-05-16 13:48:12 -070046 int GetMaxFirmwareKeyRollforward() const override;
47 bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override;
Zentaro Kavanagh5d956152018-05-15 09:40:33 -070048 bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
Alex Deymo40d86b22015-09-03 22:27:10 -070049 int GetPowerwashCount() const override;
Kelvin Zhang399bd4d2024-12-03 11:08:30 -080050 bool SchedulePowerwash() override;
Alex Deymofb905d92016-06-03 19:26:58 -070051 bool CancelPowerwash() override;
Alex Deymodd132f32015-09-14 19:12:07 -070052 bool GetNonVolatileDirectory(base::FilePath* path) const override;
53 bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
Sen Jiang5011df62017-06-28 17:13:19 -070054 int64_t GetBuildTimestamp() const override;
Tianjie Xu4ad3af62019-10-30 11:59:45 -070055 bool AllowDowngrade() const override;
Amin Hassani1677e812017-06-21 13:36:36 -070056 bool GetFirstActiveOmahaPingSent() const override;
Amin Hassani80f4d4c2018-05-16 13:34:00 -070057 bool SetFirstActiveOmahaPingSent() override;
Tianjie Xud6aa91f2019-11-14 11:55:10 -080058 void SetWarmReset(bool warm_reset) override;
Tianjie838793d2021-01-14 22:05:13 -080059 void SetVbmetaDigestForInactiveSlot(bool reset) override;
Kelvin Zhangd7191032020-08-11 10:48:16 -040060 [[nodiscard]] std::string GetVersionForLogging(
61 const std::string& partition_name) const override;
Yifan Hong87029332020-09-01 17:20:08 -070062 [[nodiscard]] ErrorCode IsPartitionUpdateValid(
Kelvin Zhangd7191032020-08-11 10:48:16 -040063 const std::string& partition_name,
64 const std::string& new_version) const override;
Alex Light7361d272021-03-12 09:05:55 -080065 [[nodiscard]] const char* GetPartitionMountOptions(
66 const std::string& partition_name) const override;
Alex Deymo40d86b22015-09-03 22:27:10 -070067
68 private:
69 DISALLOW_COPY_AND_ASSIGN(HardwareAndroid);
70};
71
72} // namespace chromeos_update_engine
73
Amin Hassaniec7bc112020-10-29 16:47:58 -070074#endif // UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_