Snap for 12406339 from f69c69b15863d2419493ce7a72127b85c6464e5f to 24Q4-release
Change-Id: I9e72b14f289f5688cdd4be744c80347e6fe52abb
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 67b0d5a..4de75aa 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -113,9 +113,11 @@
// Mount snapshot partitions for Virtual AB Compression Compression.
if (dynamic_control->UpdateUsesSnapshotCompression()) {
- // Before calling MapAllPartitions to map snapshot devices, all CowWriters
- // must be closed, and MapAllPartitions() should be called.
- if (!install_plan_.partitions.empty()) {
+ // 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()) {
return CompletePostinstall(ErrorCode::kPostInstallMountError);
}
@@ -456,14 +458,6 @@
};
if (error_code == ErrorCode::kSuccess) {
if (install_plan_.switch_slot_on_reboot) {
- if constexpr (!constants::kIsRecovery) {
- if (!boot_control_->GetDynamicPartitionControl()->MapAllPartitions()) {
- LOG(WARNING)
- << "Failed to map all partitions before marking snapshot as "
- "ready for slot switch. Subsequent FinishUpdate() call may or "
- "may not work";
- }
- }
if (!boot_control_->GetDynamicPartitionControl()->FinishUpdate(
install_plan_.powerwash_required) ||
!boot_control_->SetActiveBootSlot(install_plan_.target_slot)) {