Support per-partition timestamps
update_engine is heading toward supporting partial updates, which an OTA
update can update just a subset of all partitions. In this context, a
single max_timestamp in OTA manifest is insufficient for checking
potential downgrades, as different partitions can have different
timestamps. This CL adds per-partition timestamp support on
update_engine side. update_engine will accept a payload with
per-partition timestamps and reject the update if any partition has an
older timestamp.
Changes made:
1. Add new version field to PartitionUpdate protobuf message.
2. Add new methods to HardwareInterface for fetching/checking
timestamp of each partition.
3. Update delta_performer to invoke new APIs in 2 properly.
4. Add relevant testcases.
Test: unittest
Bug: 162553432
Change-Id: I767343e003fd35ce0d22197b15040488cf30be30
diff --git a/hardware_android.h b/hardware_android.h
index e0368f9..2e55f97 100644
--- a/hardware_android.h
+++ b/hardware_android.h
@@ -18,6 +18,7 @@
#define UPDATE_ENGINE_HARDWARE_ANDROID_H_
#include <string>
+#include <string_view>
#include <base/macros.h>
#include <base/time/time.h>
@@ -28,7 +29,7 @@
namespace chromeos_update_engine {
// Implements the real interface with the hardware in the Android platform.
-class HardwareAndroid final : public HardwareInterface {
+class HardwareAndroid : public HardwareInterface {
public:
HardwareAndroid() = default;
~HardwareAndroid() override = default;
@@ -58,6 +59,11 @@
bool GetFirstActiveOmahaPingSent() const override;
bool SetFirstActiveOmahaPingSent() override;
void SetWarmReset(bool warm_reset) override;
+ [[nodiscard]] std::string GetVersionForLogging(
+ const std::string& partition_name) const override;
+ [[nodiscard]] bool IsPartitionUpdateValid(
+ const std::string& partition_name,
+ const std::string& new_version) const override;
private:
DISALLOW_COPY_AND_ASSIGN(HardwareAndroid);