Remove SystemState references from DeltaPerformer.
DeltaPerformer is used as part of the DownloadAction and had
references to the global SystemState. The common references to
BootControlInterface (to query the partitions based on the names
from the payload) and the HardwareInterface (for dev-mode bits) are
now referenced directly from the DeltaPerformer. The calls to
UpdateAttempter and PayloadState were moved to the
DownloadActionDelegate since these calls are received by classes
outside the payload_consumer.
Bug: 25773375
TEST=FEATURES=test emerge-link update_engine
Change-Id: Id2e81d5ccf835cad22f03b069c681dcce104c456
diff --git a/update_attempter.cc b/update_attempter.cc
index 4406149..461d10d 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -1057,7 +1057,13 @@
}
}
-void UpdateAttempter::BytesReceived(uint64_t bytes_received, uint64_t total) {
+void UpdateAttempter::BytesReceived(uint64_t bytes_progressed,
+ uint64_t bytes_received,
+ uint64_t total) {
+ // The PayloadState keeps track of how many bytes were actually downloaded
+ // from a given URL for the URL skipping logic.
+ system_state_->payload_state()->DownloadProgress(bytes_progressed);
+
double progress = static_cast<double>(bytes_received) /
static_cast<double>(total);
// Self throttle based on progress. Also send notifications if
@@ -1072,6 +1078,10 @@
}
}
+void UpdateAttempter::DownloadComplete() {
+ system_state_->payload_state()->DownloadComplete();
+}
+
bool UpdateAttempter::ResetStatus() {
LOG(INFO) << "Attempting to reset state from "
<< UpdateStatusToString(status_) << " to UpdateStatus::IDLE";