Resume multiple payloads.
DownloadAction will first go through all the already applied payload
and only downloading the manifest and filling in partitions info in
install plan without applying or downloading any operations.
And then resume the partially applied payload using states in prefs.
Moved constuction of MultiRangeHttpFetcher from UpdateAttempter to
DownloadAction, because we now need to setup the range for every
payload, also reduced code duplication.
Also fixed download progress for multi payload.
Bug: 36252799
Test: stop an update during second payload and resume the update
Change-Id: I9ee54a87d15d88c7a14a13575965b19c1773340b
(cherry picked from commit 7162b666318cdd6c75b73fa6a0b06b23559de3e5)
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index db471da..d8d9f57 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -61,10 +61,15 @@
uint64_t metadata_size = 0; // size of the metadata
std::string metadata_signature; // signature of the metadata in base64
brillo::Blob hash; // SHA256 hash of the payload
+ // Only download manifest and fill in partitions in install plan without
+ // apply the payload if true. Will be set by DownloadAction when resuming
+ // multi-payload.
+ bool already_applied = false;
bool operator==(const Payload& that) const {
return size == that.size && metadata_size == that.metadata_size &&
- metadata_signature == that.metadata_signature && hash == that.hash;
+ metadata_signature == that.metadata_signature &&
+ hash == that.hash && already_applied == that.already_applied;
}
};
std::vector<Payload> payloads;