Snap for 12755599 from 28c6b4839da4e8162d4a1fa66cbbb4d213d997f6 to 25Q1-release
Change-Id: I215bc657a9bbf1cd21d0fd68ab3af29d5a63fe4a
diff --git a/aosp/hardware_android.cc b/aosp/hardware_android.cc
index 29d742f..dd39fdd 100644
--- a/aosp/hardware_android.cc
+++ b/aosp/hardware_android.cc
@@ -213,10 +213,8 @@
return 0;
}
-bool HardwareAndroid::SchedulePowerwash(bool save_rollback_data) {
+bool HardwareAndroid::SchedulePowerwash() {
LOG(INFO) << "Scheduling a powerwash to BCB.";
- LOG_IF(WARNING, save_rollback_data) << "save_rollback_data was true but "
- << "isn't supported.";
string err;
if (!update_bootloader_message({"--wipe_data", "--reason=wipe_data_from_ota"},
&err)) {
diff --git a/aosp/hardware_android.h b/aosp/hardware_android.h
index cb655c9..b071e06 100644
--- a/aosp/hardware_android.h
+++ b/aosp/hardware_android.h
@@ -18,13 +18,11 @@
#define UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_
#include <string>
-#include <string_view>
#include <android-base/macros.h>
#include <base/time/time.h>
#include "update_engine/common/error_code.h"
-#include "update_engine/common/hardware.h"
#include "update_engine/common/hardware_interface.h"
namespace chromeos_update_engine {
@@ -49,7 +47,7 @@
bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override;
bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
int GetPowerwashCount() const override;
- bool SchedulePowerwash(bool save_rollback_data) override;
+ bool SchedulePowerwash() override;
bool CancelPowerwash() override;
bool GetNonVolatileDirectory(base::FilePath* path) const override;
bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 85f650c..f29383a 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -506,10 +506,6 @@
"Status reset not allowed in this state, please "
"cancel on going OTA first.");
}
- // last_error_ is used by setShouldSwitchSlot to determine if
- // FilesystemVerification is done. Since we are discarding update
- // state, discard this cache as well.
- last_error_ = ErrorCode::kSuccess;
if (apex_handler_android_ != nullptr) {
LOG(INFO) << "Cleaning up reserved space for compressed APEX (if any)";
@@ -715,7 +711,6 @@
LOG(INFO) << "Processing Done.";
metric_bytes_downloaded_.Flush(true);
metric_total_bytes_downloaded_.Flush(true);
- last_error_ = code;
if (status_ == UpdateStatus::CLEANUP_PREVIOUS_UPDATE) {
TerminateUpdateAndNotify(code);
return;
@@ -1354,11 +1349,13 @@
std::make_unique<PostinstallRunnerAction>(boot_control_, hardware_);
postinstall_runner_action->set_delegate(this);
- // 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
+ // If |kPrefsPostInstallSucceeded| is set, we know that we reached this
+ // state by calling applyPayload() That applyPayload() call would have
+ // already performed filesystem verification, therefore, we
// can safely skip the verification to save time.
- if (last_error_ == ErrorCode::kUpdatedButNotActive) {
+ bool postinstall_succeeded = false;
+ if (prefs_->GetBoolean(kPrefsPostInstallSucceeded, &postinstall_succeeded) &&
+ postinstall_succeeded) {
auto install_plan_action =
std::make_unique<InstallPlanAction>(install_plan_);
BondActions(install_plan_action.get(), postinstall_runner_action.get());
diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h
index eb3e29f..ac0cc51 100644
--- a/aosp/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -287,7 +287,6 @@
// The path to the zip file with X509 certificates.
std::string update_certificates_path_{constants::kUpdateCertificatesPath};
- ErrorCode last_error_{ErrorCode::kSuccess};
metrics_utils::PersistedValue<int64_t> metric_bytes_downloaded_;
metrics_utils::PersistedValue<int64_t> metric_total_bytes_downloaded_;
diff --git a/common/fake_hardware.h b/common/fake_hardware.h
index 6c25183..3b68958 100644
--- a/common/fake_hardware.h
+++ b/common/fake_hardware.h
@@ -107,15 +107,13 @@
int GetPowerwashCount() const override { return powerwash_count_; }
- bool SchedulePowerwash(bool save_rollback_data) override {
+ bool SchedulePowerwash() override {
powerwash_scheduled_ = true;
- save_rollback_data_ = save_rollback_data;
return true;
}
bool CancelPowerwash() override {
powerwash_scheduled_ = false;
- save_rollback_data_ = false;
return true;
}
diff --git a/common/hardware_interface.h b/common/hardware_interface.h
index 4e820f1..1b146d1 100644
--- a/common/hardware_interface.h
+++ b/common/hardware_interface.h
@@ -100,9 +100,8 @@
virtual int GetPowerwashCount() const = 0;
// Signals that a powerwash (stateful partition wipe) should be performed
- // after reboot. If |save_rollback_data| is true additional state is
- // preserved during shutdown that can be restored after the powerwash.
- virtual bool SchedulePowerwash(bool save_rollback_data) = 0;
+ // after reboot.
+ virtual bool SchedulePowerwash() = 0;
// Cancel the powerwash operation scheduled to be performed on next boot.
virtual bool CancelPowerwash() = 0;
diff --git a/common/test_utils.h b/common/test_utils.h
index b85f80d..2a582b1 100644
--- a/common/test_utils.h
+++ b/common/test_utils.h
@@ -175,7 +175,7 @@
// This is a simple Action class for testing. It feeds an object into
// another action.
template <typename T>
-class ObjectFeederAction : public Action<ObjectFeederAction<T>> {
+class ObjectFeederAction final : public Action<ObjectFeederAction<T>> {
public:
typedef NoneType InputObjectType;
typedef T OutputObjectType;
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index b55dea1..8916af5 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -98,8 +98,6 @@
{"powerwash_required", utils::ToString(powerwash_required)},
{"switch_slot_on_reboot", utils::ToString(switch_slot_on_reboot)},
{"run_post_install", utils::ToString(run_post_install)},
- {"rollback_data_save_requested",
- utils::ToString(rollback_data_save_requested)},
{"write_verity", utils::ToString(write_verity)},
},
"\n"));
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index 04f6667..e1c2c34 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -182,9 +182,6 @@
// False otherwise.
bool run_post_install{true};
- // True if this rollback should preserve some system data.
- bool rollback_data_save_requested{false};
-
// True if the update should write verity.
// False otherwise.
bool write_verity{true};
diff --git a/payload_consumer/install_plan_unittest.cc b/payload_consumer/install_plan_unittest.cc
index d2a3f5f..ca54360 100644
--- a/payload_consumer/install_plan_unittest.cc
+++ b/payload_consumer/install_plan_unittest.cc
@@ -54,7 +54,6 @@
powerwash_required: false
switch_slot_on_reboot: true
run_post_install: true
-rollback_data_save_requested: false
write_verity: true
Partition: foo-partition_name
source_size: 0
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 02417be..5a6eeab 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -127,8 +127,7 @@
// that retains a small amount of system state such as enrollment and
// network configuration. In both cases all user accounts are deleted.
if (install_plan_.powerwash_required) {
- if (hardware_->SchedulePowerwash(
- install_plan_.rollback_data_save_requested)) {
+ if (hardware_->SchedulePowerwash()) {
powerwash_scheduled_ = true;
} else {
return CompletePostinstall(ErrorCode::kPostinstallPowerwashError);
diff --git a/payload_consumer/postinstall_runner_action.h b/payload_consumer/postinstall_runner_action.h
index 6017069..1a3cdf6 100644
--- a/payload_consumer/postinstall_runner_action.h
+++ b/payload_consumer/postinstall_runner_action.h
@@ -26,7 +26,6 @@
#include <brillo/message_loops/message_loop.h>
#include <gtest/gtest_prod.h>
-#include "update_engine/common/action.h"
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/payload_consumer/install_plan.h"
diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
index 9eab1c1..028402a 100644
--- a/payload_consumer/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -198,7 +198,6 @@
install_plan.partitions = {part};
install_plan.download_url = "http://127.0.0.1:8080/update";
install_plan.powerwash_required = powerwash_required;
- install_plan.rollback_data_save_requested = save_rollback_data;
RunPostinstallActionWithInstallPlan(install_plan);
}