Skip writing verity if already written.
Computing FEC on device could take up to 3 minutes depending on
partition size, we should skip it if it's already written.
This is similar to how we skip postinstall for postponed OTA, but we
don't require passing additional header here because we can verify the
correctness of the verity data within update_engine itself.
Bug: 28171891
Test: update_engine_unittests
Change-Id: Ie9883e2260d95c05aec169dd1fde12beea0bdade
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index d74d81d..c9cb5af 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -134,7 +134,8 @@
hasher_ = std::make_unique<HashCalculator>();
offset_ = 0;
- if (verifier_step_ == VerifierStep::kVerifyTargetHash) {
+ if (verifier_step_ == VerifierStep::kVerifyTargetHash &&
+ install_plan_.write_verity) {
if (!verity_writer_->Init(partition)) {
Cleanup(ErrorCode::kVerityCalculationError);
return;
@@ -201,7 +202,8 @@
return;
}
- if (verifier_step_ == VerifierStep::kVerifyTargetHash) {
+ if (verifier_step_ == VerifierStep::kVerifyTargetHash &&
+ install_plan_.write_verity) {
if (!verity_writer_->Update(offset_, buffer_.data(), bytes_read)) {
Cleanup(ErrorCode::kVerityCalculationError);
return;