diff options
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 |