diff options
author | Amin Hassani <ahassani@chromium.org> | 2020-09-16 11:19:28 -0700 |
---|---|---|
committer | Amin Hassani <ahassani@chromium.org> | 2020-09-17 10:17:36 -0700 |
commit | e53b39b8b9c5c0871841bbbb86f23657c0b7f91b (patch) | |
tree | 12746e5e7e4716ba7fc94d3ed5c1a36c4d47d474 /common/hardware_interface.h | |
parent | a02a1f1dc837f22226499d9856a949fb180d099a (diff) | |
parent | 9956320ffa4edb340d20bd7f3c852a9e87437bd3 (diff) |
update_engine: Merge remote-tracking branch 'cros/upstream' into cros/master
Done with:
git merge cros/upstream --commit -s recursive
- Added EC key support and its unittests.
- Resolved a conlict on error codes. Since Android versions are not
uploading any UMA metrics, I gave the priority to the Android version
Since they can't be changed.
- Changed the openssl functions to get1 version (from get0) version
because of a current issue with gale. Once the issue is resolved we
need to change them back.
- Some remaining styling issues fixed by clang-format
BUG=b:163153182
TEST=CQ passes
TEST=unittests
Change-Id: Ib95034422b92433ce26e28336bc4806b34910d38
Diffstat (limited to 'common/hardware_interface.h')
-rw-r--r-- | common/hardware_interface.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/common/hardware_interface.h b/common/hardware_interface.h index da9f10ef..b37b0074 100644 --- a/common/hardware_interface.h +++ b/common/hardware_interface.h @@ -25,6 +25,8 @@ #include <base/files/file_path.h> #include <base/time/time.h> +#include "update_engine/common/error_code.h" + namespace chromeos_update_engine { // The hardware interface allows access to the crossystem exposed properties, @@ -126,6 +128,10 @@ class HardwareInterface { // Returns the timestamp of the current OS build. virtual int64_t GetBuildTimestamp() const = 0; + // Returns true if the current OS build allows installing the payload with an + // older timestamp. + virtual bool AllowDowngrade() const = 0; + // Returns whether the first active ping was sent to Omaha at some point, and // that the value is persisted across recovery (and powerwash) once set with // |SetFirstActiveOmahaPingSent()|. @@ -134,6 +140,30 @@ class HardwareInterface { // Persist the fact that first active ping was sent to omaha and returns false // if failed to persist it. virtual bool SetFirstActiveOmahaPingSent() = 0; + + // If |warm_reset| is true, sets the warm reset to indicate a warm reset is + // needed on the next reboot. Otherwise, clears the flag. + virtual void SetWarmReset(bool warm_reset) = 0; + + // Return the version/timestamp for partition `partition_name`. + // Don't make any assumption about the formatting of returned string. + // Only used for logging/debugging purposes. + virtual std::string GetVersionForLogging( + const std::string& partition_name) const = 0; + + // Return true if and only if `new_version` is "newer" than the + // version number of partition `partition_name`. The notion of + // "newer" is defined by this function. Caller should not make + // any assumption about the underlying logic. + // Return: + // - kSuccess if update is valid. + // - kPayloadTimestampError if downgrade is detected + // - kDownloadManifestParseError if |new_version| has an incorrect format + // - Other error values if the source of error is known, or kError for + // a generic error on the device. + virtual ErrorCode IsPartitionUpdateValid( + const std::string& partition_name, + const std::string& new_version) const = 0; }; } // namespace chromeos_update_engine |