Skip filesystem verification if it's already done am: f844198240 am: d576ccce41
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2334902
Change-Id: I5027231759213630a173b7a2061a934c84cde782
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 0dc7f83..ff74f4d 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -38,6 +38,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/daemon_state_interface.h"
#include "update_engine/common/download_action.h"
+#include "update_engine/common/error_code.h"
#include "update_engine/common/error_code_utils.h"
#include "update_engine/common/file_fetcher.h"
#include "update_engine/common/metrics_reporter_interface.h"
@@ -569,7 +570,7 @@
void UpdateAttempterAndroid::ProcessingDone(const ActionProcessor* processor,
ErrorCode code) {
LOG(INFO) << "Processing Done.";
-
+ last_error_ = code;
if (status_ == UpdateStatus::CLEANUP_PREVIOUS_UPDATE) {
TerminateUpdateAndNotify(code);
return;
@@ -1202,22 +1203,30 @@
}
auto install_plan_action = std::make_unique<InstallPlanAction>(install_plan_);
- auto filesystem_verifier_action = std::make_unique<FilesystemVerifierAction>(
- boot_control_->GetDynamicPartitionControl());
auto postinstall_runner_action =
std::make_unique<PostinstallRunnerAction>(boot_control_, hardware_);
SetStatusAndNotify(UpdateStatus::VERIFYING);
- filesystem_verifier_action->set_delegate(this);
postinstall_runner_action->set_delegate(this);
- // Bond them together. We have to use the leaf-types when calling
- // BondActions().
- BondActions(install_plan_action.get(), filesystem_verifier_action.get());
- BondActions(filesystem_verifier_action.get(),
- postinstall_runner_action.get());
+ // If last error code is kUpdatedButNotActive, we know that we reached this
+ // state by calling applyPayload() with switch_slot=false. That applyPayload()
+ // call would have already performed filesystem verification, therefore, we
+ // can safely skip the verification to save time.
+ if (last_error_ == ErrorCode::kUpdatedButNotActive) {
+ BondActions(install_plan_action.get(), postinstall_runner_action.get());
+ processor_->EnqueueAction(std::move(install_plan_action));
+ } else {
+ auto filesystem_verifier_action =
+ std::make_unique<FilesystemVerifierAction>(
+ boot_control_->GetDynamicPartitionControl());
+ filesystem_verifier_action->set_delegate(this);
+ BondActions(install_plan_action.get(), filesystem_verifier_action.get());
+ BondActions(filesystem_verifier_action.get(),
+ postinstall_runner_action.get());
+ processor_->EnqueueAction(std::move(install_plan_action));
+ processor_->EnqueueAction(std::move(filesystem_verifier_action));
+ }
- processor_->EnqueueAction(std::move(install_plan_action));
- processor_->EnqueueAction(std::move(filesystem_verifier_action));
processor_->EnqueueAction(std::move(postinstall_runner_action));
ScheduleProcessingStart();
return true;
diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h
index f3feed0..f3ed604 100644
--- a/aosp/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -34,6 +34,7 @@
#include "update_engine/common/clock_interface.h"
#include "update_engine/common/daemon_state_interface.h"
#include "update_engine/common/download_action.h"
+#include "update_engine/common/error_code.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/network_selector_interface.h"
@@ -276,6 +277,7 @@
// The path to the zip file with X509 certificates.
std::string update_certificates_path_{constants::kUpdateCertificatesPath};
+ ErrorCode last_error_{ErrorCode::kSuccess};
DISALLOW_COPY_AND_ASSIGN(UpdateAttempterAndroid);
};