Revert "do not map partitions on A/B devices" am: 2f8976bd6a
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/3480990
Change-Id: Iccbb89c5d52879106ad4e76687a4fc17b229a05c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 84237b1..1717dd7 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -111,17 +111,12 @@
// If we are switching slots, then we are required to MapAllPartitions,
// as FinishUpdate() requires all partitions to be mapped.
// And switching slots requires FinishUpdate() to be called first
- if (dynamic_control->GetVirtualAbFeatureFlag().IsEnabled()) {
- // If we are switching slots, then we are required to MapAllPartitions,
- // as FinishUpdate() requires all partitions to be mapped.
- // And switching slots requires FinishUpdate() to be called first
- if (!install_plan_.partitions.empty() ||
- install_plan_.switch_slot_on_reboot) {
- if (!dynamic_control->MapAllPartitions()) {
- LOG(ERROR) << "Failed to map all partitions, this would cause "
- "FinishUpdate to fail. Abort early.";
- return CompletePostinstall(ErrorCode::kPostInstallMountError);
- }
+ if (!install_plan_.partitions.empty() ||
+ install_plan_.switch_slot_on_reboot) {
+ if (!dynamic_control->MapAllPartitions()) {
+ LOG(ERROR) << "Failed to map all partitions, this would cause "
+ "FinishUpdate to fail. Abort early.";
+ return CompletePostinstall(ErrorCode::kPostInstallMountError);
}
}
diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
index 74775ad..7416e66 100644
--- a/payload_consumer/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -112,8 +112,6 @@
.WillByDefault(Return(true));
ON_CALL(*mock_dynamic_control_, UnmapAllPartitions())
.WillByDefault(Return(true));
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::NONE)));
}
// Setup an action processor and run the PostinstallRunnerAction with a single
@@ -293,8 +291,6 @@
// /postinst command which only exits 0.
TEST_F(PostinstallRunnerActionTest, RunAsRootSimpleTest) {
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
RunPostinstallAction(loop.dev(), kPostinstallDefaultScript, false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
@@ -306,16 +302,12 @@
}
TEST_F(PostinstallRunnerActionTest, RunAsRootRunSymlinkFileTest) {
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
RunPostinstallAction(loop.dev(), "bin/postinst_link", false, false);
EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
}
TEST_F(PostinstallRunnerActionTest, RunAsRootPowerwashRequiredTest) {
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
// Run a simple postinstall program but requiring a powerwash.
RunPostinstallAction(loop.dev(),
@@ -332,8 +324,6 @@
// Runs postinstall from a partition file that doesn't mount, so it should
// fail.
TEST_F(PostinstallRunnerActionTest, RunAsRootCantMountTest) {
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
RunPostinstallAction("/dev/null", kPostinstallDefaultScript, false, false);
EXPECT_EQ(ErrorCode::kPostInstallMountError, processor_delegate_.code_);
@@ -344,8 +334,6 @@
}
TEST_F(PostinstallRunnerActionTest, RunAsRootSkipOptionalPostinstallTest) {
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
InstallPlan::Partition part;
part.name = "part";
@@ -427,8 +415,6 @@
// Test that we can cancel a postinstall action while it is running.
TEST_F(PostinstallRunnerActionTest, RunAsRootCancelPostinstallActionTest) {
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
ScopedLoopbackDeviceBinder loop(postinstall_image_, false, nullptr);
EXPECT_CALL(*mock_dynamic_control_, MapAllPartitions()).Times(AtLeast(1));
@@ -444,8 +430,6 @@
// Test that we parse and process the progress reports from the progress
// file descriptor.
TEST_F(PostinstallRunnerActionTest, RunAsRootProgressUpdatesTest) {
- ON_CALL(*mock_dynamic_control_, GetVirtualAbFeatureFlag)
- .WillByDefault(Return(FeatureFlag(FeatureFlag::Value::LAUNCH)));
EXPECT_CALL(*mock_dynamic_control_, MapAllPartitions())
.Times(AtLeast(1))
.WillRepeatedly(Return(true));