Map all partitions before calling FinishUpdate for VAB as well
In virtual AB updates, all partitions must be mapped before calling
FinishUpdate. (same requirement as VABC).
Test: install VAB update w/o slot switch, then perform slot switch
Bug: 393082101
Change-Id: Iec7965b2d1a75b8a61507d75c83c733bfac38ce4
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index da9075a..1717dd7 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -108,16 +108,15 @@
auto dynamic_control = boot_control_->GetDynamicPartitionControl();
CHECK(dynamic_control);
- // Mount snapshot partitions for Virtual AB Compression Compression.
- if (dynamic_control->UpdateUsesSnapshotCompression()) {
- // 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);
- }
+ // 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);
}
}
@@ -324,10 +323,10 @@
void PostinstallRunnerAction::OnProgressFdReady() {
char buf[1024];
- size_t bytes_read;
+ size_t bytes_read{};
do {
bytes_read = 0;
- bool eof;
+ bool eof = false;
bool ok =
utils::ReadAll(progress_fd_, buf, std::size(buf), &bytes_read, &eof);
progress_buffer_.append(buf, bytes_read);