Prevent cancellation of merge polling after OTA reboot
After an OTA reboot, update-engine starts
CleanupPreviousUpdateAction, which continously polls libsnapshot
for merge status. Note continous polling is required for merge
to make progress and complete. If CleanupPreviousUpdateAction
is canceled, device could stuck on snapshotted partition forever.
Test: th
Bug: 390085345
Change-Id: Ib80baeca42fb87975191f3370eeb200f230427fc
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 89c79f3..943c3e4 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -482,6 +482,18 @@
}
bool UpdateAttempterAndroid::CancelUpdate(Error* error) {
+ auto action = processor_->current_action();
+ if (action != nullptr &&
+ action->Type() == CleanupPreviousUpdateAction::StaticType()) {
+ return LogAndSetError(
+ error,
+ __LINE__,
+ __FILE__,
+ "CleanupPreviousUpdateAction is running, this action cannot be "
+ "canceled. As it often performs critical merge operations after "
+ "reboot.",
+ ErrorCode::kRollbackNotPossible);
+ }
if (!processor_->IsRunning())
return LogAndSetGenericError(
error, __LINE__, __FILE__, "No ongoing update to cancel.");