diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2024-01-18 14:50:01 -0800 |
---|---|---|
committer | Kelvin Zhang <zhangkelvin@google.com> | 2024-01-18 17:54:58 -0800 |
commit | 99cbbe7c4ccc4ceb805b8ff98b0fbde66fcecbde (patch) | |
tree | 8a8a711fe88ba06f4d4b87b6fa8f59852bc2152e | |
parent | e532af3f045057159c7b5a06edc8868ae94a89ec (diff) | |
download | update_engine-99cbbe7c4ccc4ceb805b8ff98b0fbde66fcecbde.tar.gz |
Fix sideload OTA breakage
MapAllPartitions doesn't work in recovery, which prevented slot switch.
A logic error in code prevented this from being reporeted correctly, so
device proceeded to reboot thinking that OTA is successful, even though
slot isn't switched.
Bug: 320206874
Test: sideload an recovery OTA
Change-Id: Ief560ef8c3eddc1162d784f1bb03bf9c76c3d8eb
-rw-r--r-- | payload_consumer/postinstall_runner_action.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc index 2cfd3c6b..bfdd39e3 100644 --- a/payload_consumer/postinstall_runner_action.cc +++ b/payload_consumer/postinstall_runner_action.cc @@ -36,6 +36,8 @@ #include "update_engine/common/action_processor.h" #include "update_engine/common/boot_control_interface.h" +#include "update_engine/common/error_code_utils.h" +#include "update_engine/common/platform_constants.h" #include "update_engine/common/subprocess.h" #include "update_engine/common/utils.h" @@ -443,7 +445,8 @@ void PostinstallRunnerAction::CompletePostinstall(ErrorCode error_code) { DEFER { if (error_code != ErrorCode::kSuccess && error_code != ErrorCode::kUpdatedButNotActive) { - LOG(ERROR) << "Postinstall action failed."; + LOG(ERROR) << "Postinstall action failed. " + << utils::ErrorCodeToString(error_code); // Undo any changes done to trigger Powerwash. if (powerwash_scheduled_) @@ -453,10 +456,13 @@ void PostinstallRunnerAction::CompletePostinstall(ErrorCode error_code) { }; if (error_code == ErrorCode::kSuccess) { if (install_plan_.switch_slot_on_reboot) { - if (!boot_control_->GetDynamicPartitionControl()->MapAllPartitions()) { - LOG(ERROR) << "Failed to map all partitions before marking snapshot as " - "ready for slot switch."; - return; + 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) || |