AU: Split applied update verification into a separate step.
Use instances of FilesystemCopierAction to do applied update verification. This
speeds it up slightly because asynchronous reads happen in parallel with hash
calculation but, more importantly, makes update_engine be responsive to D-Bus
during that step.
BUG=9140
TEST=unit tests, tested on device
Change-Id: I3ec9445de5e8258a63433a61f1a476aef4434f6c
Review URL: http://codereview.chromium.org/5516009
diff --git a/download_action.cc b/download_action.cc
index d06fb79..d6ae97d 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -65,10 +65,8 @@
writer_ = decompressing_file_writer_.get();
} else {
delta_performer_.reset(new DeltaPerformer(prefs_));
- delta_performer_->set_current_kernel_hash(
- &install_plan_.current_kernel_hash);
- delta_performer_->set_current_rootfs_hash(
- &install_plan_.current_rootfs_hash);
+ delta_performer_->set_current_kernel_hash(install_plan_.kernel_hash);
+ delta_performer_->set_current_rootfs_hash(install_plan_.rootfs_hash);
writer_ = delta_performer_.get();
}
}
@@ -169,11 +167,13 @@
LOG(ERROR) << "Download of " << install_plan_.download_url
<< " failed due to payload verification error.";
code = kActionCodeDownloadPayloadVerificationError;
- } else if (!delta_performer_->VerifyAppliedUpdate(
- install_plan_.install_path, install_plan_.kernel_install_path)) {
- LOG(ERROR) << "Download of " << install_plan_.download_url
- << " failed due to applied update verification error.";
- code = kActionCodeDownloadAppliedUpdateVerificationError;
+ } else if (!delta_performer_->GetNewPartitionInfo(
+ &install_plan_.kernel_size,
+ &install_plan_.kernel_hash,
+ &install_plan_.rootfs_size,
+ &install_plan_.rootfs_hash)) {
+ LOG(ERROR) << "Unable to get new partition hash info.";
+ code = kActionCodeDownloadNewPartitionInfoError;
}
} else {
// Makes sure the hash and size are correct for an old-style full update.
@@ -196,7 +196,7 @@
// Write the path to the output pipe if we're successful.
if (code == kActionCodeSuccess && HasOutputPipe())
- SetOutputObject(GetInputObject());
+ SetOutputObject(install_plan_);
processor_->ActionComplete(this, code);
}