update_engine: remove is_rollback
is_rollback is a field inherited from chromesOS and is never actually
set within android. Remove this deprecated field
Test: th
Change-Id: I55853b5f4af3d5774ca966bab86310064b407002
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index cea8e5a..9c3934d 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -99,7 +99,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)},
- {"is_rollback", utils::ToString(is_rollback)},
{"rollback_data_save_requested",
utils::ToString(rollback_data_save_requested)},
{"write_verity", utils::ToString(write_verity)},
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index dbbe4b2..097c6ce 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 update is a rollback.
- bool is_rollback{false};
-
// True if this rollback should preserve some system data.
bool rollback_data_save_requested{false};
diff --git a/payload_consumer/install_plan_unittest.cc b/payload_consumer/install_plan_unittest.cc
index 193d936..d2a3f5f 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
-is_rollback: false
rollback_data_save_requested: false
write_verity: true
Partition: foo-partition_name
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index bfdd39e..67b0d5a 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -126,7 +126,7 @@
// if this is a full/normal powerwash, or a special rollback powerwash
// 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 || install_plan_.is_rollback) {
+ if (install_plan_.powerwash_required) {
if (hardware_->SchedulePowerwash(
install_plan_.rollback_data_save_requested)) {
powerwash_scheduled_ = true;
diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
index 75d93dc..c899599 100644
--- a/payload_consumer/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -104,7 +104,6 @@
void RunPostinstallAction(const string& device_path,
const string& postinstall_program,
bool powerwash_required,
- bool is_rollback,
bool save_rollback_data);
void RunPostinstallActionWithInstallPlan(const InstallPlan& install_plan);
@@ -189,7 +188,6 @@
const string& device_path,
const string& postinstall_program,
bool powerwash_required,
- bool is_rollback,
bool save_rollback_data) {
InstallPlan::Partition part;
part.name = "part";
@@ -201,7 +199,6 @@
install_plan.partitions = {part};
install_plan.download_url = "http://127.0.0.1:8080/update";
install_plan.powerwash_required = powerwash_required;
- install_plan.is_rollback = is_rollback;
install_plan.rollback_data_save_requested = save_rollback_data;
RunPostinstallActionWithInstallPlan(install_plan);
}
@@ -279,8 +276,7 @@
TEST_F(PostinstallRunnerActionTest, RunAsRootSimpleTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- RunPostinstallAction(
- loop.dev(), kPostinstallDefaultScript, false, false, false);
+ RunPostinstallAction(loop.dev(), kPostinstallDefaultScript, false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
EXPECT_TRUE(processor_delegate_.processing_done_called_);
@@ -291,7 +287,7 @@
TEST_F(PostinstallRunnerActionTest, RunAsRootRunSymlinkFileTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- RunPostinstallAction(loop.dev(), "bin/postinst_link", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/postinst_link", false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
}
@@ -301,7 +297,6 @@
RunPostinstallAction(loop.dev(),
"bin/postinst_example",
/*powerwash_required=*/true,
- false,
false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
@@ -310,43 +305,10 @@
EXPECT_FALSE(fake_hardware_.GetIsRollbackPowerwashScheduled());
}
-TEST_F(PostinstallRunnerActionTest, RunAsRootRollbackTestNoDataSave) {
- ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
-
- // Run a simple postinstall program, rollback happened.
- RunPostinstallAction(loop.dev(),
- "bin/postinst_example",
- false,
- /*is_rollback=*/true,
- /*save_rollback_data=*/false);
- EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
-
- // Check that powerwash was scheduled and that it's NOT a rollback powerwash.
- EXPECT_TRUE(fake_hardware_.IsPowerwashScheduled());
- EXPECT_FALSE(fake_hardware_.GetIsRollbackPowerwashScheduled());
-}
-
-TEST_F(PostinstallRunnerActionTest, RunAsRootRollbackTestWithDataSave) {
- ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
-
- // Run a simple postinstall program, rollback happened.
- RunPostinstallAction(loop.dev(),
- "bin/postinst_example",
- false,
- /*is_rollback=*/true,
- /*save_rollback_data=*/true);
- EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
-
- // Check that powerwash was scheduled and that it's a rollback powerwash.
- EXPECT_TRUE(fake_hardware_.IsPowerwashScheduled());
- EXPECT_TRUE(fake_hardware_.GetIsRollbackPowerwashScheduled());
-}
-
// Runs postinstall from a partition file that doesn't mount, so it should
// fail.
TEST_F(PostinstallRunnerActionTest, RunAsRootCantMountTest) {
- RunPostinstallAction(
- "/dev/null", kPostinstallDefaultScript, false, false, false);
+ RunPostinstallAction("/dev/null", kPostinstallDefaultScript, false, false);
EXPECT_EQ(ErrorCode::kPostInstallMountError, processor_delegate_.code_);
// In case of failure, Postinstall should not signal a powerwash even if it
@@ -382,7 +344,7 @@
// fail.
TEST_F(PostinstallRunnerActionTest, RunAsRootErrScriptTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- RunPostinstallAction(loop.dev(), "bin/postinst_fail1", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/postinst_fail1", false, false);
EXPECT_EQ(ErrorCode::kPostinstallRunnerError, processor_delegate_.code_);
}
@@ -390,7 +352,7 @@
// UMA with a different error code. Test those cases are properly detected.
TEST_F(PostinstallRunnerActionTest, RunAsRootFirmwareBErrScriptTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- RunPostinstallAction(loop.dev(), "bin/postinst_fail3", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/postinst_fail3", false, false);
EXPECT_EQ(ErrorCode::kPostinstallBootedFromFirmwareB,
processor_delegate_.code_);
}
@@ -398,7 +360,7 @@
// Check that you can't specify an absolute path.
TEST_F(PostinstallRunnerActionTest, RunAsRootAbsolutePathNotAllowedTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- RunPostinstallAction(loop.dev(), "/etc/../bin/sh", false, false, false);
+ RunPostinstallAction(loop.dev(), "/etc/../bin/sh", false, false);
EXPECT_EQ(ErrorCode::kPostinstallRunnerError, processor_delegate_.code_);
}
@@ -407,8 +369,7 @@
// SElinux labels are only set on Android.
TEST_F(PostinstallRunnerActionTest, RunAsRootCheckFileContextsTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- RunPostinstallAction(
- loop.dev(), "bin/self_check_context", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/self_check_context", false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
}
@@ -417,7 +378,7 @@
TEST_F(PostinstallRunnerActionTest, RunAsRootCheckDefaultFileContextsTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
RunPostinstallAction(
- loop.dev(), "bin/self_check_default_context", false, false, false);
+ loop.dev(), "bin/self_check_default_context", false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
}
#endif // __ANDROID__
@@ -430,7 +391,7 @@
loop_.PostTask(FROM_HERE,
base::Bind(&PostinstallRunnerActionTest::SuspendRunningAction,
base::Unretained(this)));
- RunPostinstallAction(loop.dev(), "bin/postinst_suspend", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/postinst_suspend", false, false);
// postinst_suspend returns 0 only if it was suspended at some point.
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
EXPECT_TRUE(processor_delegate_.processing_done_called_);
@@ -442,7 +403,7 @@
// Wait for the action to start and then cancel it.
CancelWhenStarted();
- RunPostinstallAction(loop.dev(), "bin/postinst_suspend", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/postinst_suspend", false, false);
// When canceling the action, the action never finished and therefore we had
// a ProcessingStopped call instead.
EXPECT_FALSE(processor_delegate_.code_set_);
@@ -465,8 +426,7 @@
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
setup_action_delegate_ = &mock_delegate_;
- RunPostinstallAction(
- loop.dev(), "bin/postinst_progress", false, false, false);
+ RunPostinstallAction(loop.dev(), "bin/postinst_progress", false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
}