Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 1 | // |
| 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 Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_ |
| 18 | #define UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_ |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 19 | |
| 20 | #include <string> |
Kelvin Zhang | d719103 | 2020-08-11 10:48:16 -0400 | [diff] [blame] | 21 | #include <string_view> |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 22 | |
| 23 | #include <base/macros.h> |
| 24 | #include <base/time/time.h> |
| 25 | |
Yifan Hong | 8702933 | 2020-09-01 17:20:08 -0700 | [diff] [blame] | 26 | #include "update_engine/common/error_code.h" |
Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 27 | #include "update_engine/common/hardware.h" |
| 28 | #include "update_engine/common/hardware_interface.h" |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 29 | |
| 30 | namespace chromeos_update_engine { |
| 31 | |
| 32 | // Implements the real interface with the hardware in the Android platform. |
Kelvin Zhang | d719103 | 2020-08-11 10:48:16 -0400 | [diff] [blame] | 33 | class HardwareAndroid : public HardwareInterface { |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 34 | public: |
| 35 | HardwareAndroid() = default; |
| 36 | ~HardwareAndroid() override = default; |
| 37 | |
| 38 | // HardwareInterface methods. |
| 39 | bool IsOfficialBuild() const override; |
| 40 | bool IsNormalBootMode() const override; |
Sen Jiang | e67bb5b | 2016-06-20 15:53:56 -0700 | [diff] [blame] | 41 | bool AreDevFeaturesEnabled() const override; |
Alex Deymo | 46a9aae | 2016-05-04 20:20:11 -0700 | [diff] [blame] | 42 | bool IsOOBEEnabled() const override; |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 43 | bool IsOOBEComplete(base::Time* out_time_of_oobe) const override; |
| 44 | std::string GetHardwareClass() const override; |
Matt Ziegelbaum | aa8e1a4 | 2019-05-09 21:41:58 -0400 | [diff] [blame] | 45 | std::string GetDeviceRequisition() const override; |
Zentaro Kavanagh | baacb98 | 2018-02-20 17:48:39 -0800 | [diff] [blame] | 46 | int GetMinKernelKeyVersion() const override; |
Marton Hunyady | 99ced78 | 2018-05-08 12:59:50 +0200 | [diff] [blame] | 47 | int GetMinFirmwareKeyVersion() const override; |
Zentaro Kavanagh | 8f6f243 | 2018-05-16 13:48:12 -0700 | [diff] [blame] | 48 | int GetMaxFirmwareKeyRollforward() const override; |
| 49 | bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override; |
Zentaro Kavanagh | 5d95615 | 2018-05-15 09:40:33 -0700 | [diff] [blame] | 50 | bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override; |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 51 | int GetPowerwashCount() const override; |
Zentaro Kavanagh | 28def4f | 2019-01-15 17:15:01 -0800 | [diff] [blame] | 52 | bool SchedulePowerwash(bool save_rollback_data) override; |
Alex Deymo | fb905d9 | 2016-06-03 19:26:58 -0700 | [diff] [blame] | 53 | bool CancelPowerwash() override; |
Alex Deymo | dd132f3 | 2015-09-14 19:12:07 -0700 | [diff] [blame] | 54 | bool GetNonVolatileDirectory(base::FilePath* path) const override; |
| 55 | bool GetPowerwashSafeDirectory(base::FilePath* path) const override; |
Sen Jiang | 5011df6 | 2017-06-28 17:13:19 -0700 | [diff] [blame] | 56 | int64_t GetBuildTimestamp() const override; |
Tianjie Xu | 4ad3af6 | 2019-10-30 11:59:45 -0700 | [diff] [blame] | 57 | bool AllowDowngrade() const override; |
Amin Hassani | 1677e81 | 2017-06-21 13:36:36 -0700 | [diff] [blame] | 58 | bool GetFirstActiveOmahaPingSent() const override; |
Amin Hassani | 80f4d4c | 2018-05-16 13:34:00 -0700 | [diff] [blame] | 59 | bool SetFirstActiveOmahaPingSent() override; |
Tianjie Xu | d6aa91f | 2019-11-14 11:55:10 -0800 | [diff] [blame] | 60 | void SetWarmReset(bool warm_reset) override; |
Tianjie | 838793d | 2021-01-14 22:05:13 -0800 | [diff] [blame] | 61 | void SetVbmetaDigestForInactiveSlot(bool reset) override; |
Kelvin Zhang | d719103 | 2020-08-11 10:48:16 -0400 | [diff] [blame] | 62 | [[nodiscard]] std::string GetVersionForLogging( |
| 63 | const std::string& partition_name) const override; |
Yifan Hong | 8702933 | 2020-09-01 17:20:08 -0700 | [diff] [blame] | 64 | [[nodiscard]] ErrorCode IsPartitionUpdateValid( |
Kelvin Zhang | d719103 | 2020-08-11 10:48:16 -0400 | [diff] [blame] | 65 | const std::string& partition_name, |
| 66 | const std::string& new_version) const override; |
Alex Deymo | 40d86b2 | 2015-09-03 22:27:10 -0700 | [diff] [blame] | 67 | |
| 68 | private: |
| 69 | DISALLOW_COPY_AND_ASSIGN(HardwareAndroid); |
| 70 | }; |
| 71 | |
| 72 | } // namespace chromeos_update_engine |
| 73 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 74 | #endif // UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_ |