Delete COW group for downgrade Virtual A/B
am: a4e7da3b8a
Change-Id: Ia885195d05129c223cfd700843fd9edad0f01cd5
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index 88a787a..2bd7d51 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -423,6 +423,11 @@
MetadataBuilder* builder,
uint32_t target_slot,
const DeltaArchiveManifest& manifest) {
+ // If applying downgrade from Virtual A/B to non-Virtual A/B, the left-over
+ // COW group needs to be deleted to ensure there are enough space to create
+ // target partitions.
+ builder->RemoveGroupAndPartitions(android::snapshot::kCowGroupName);
+
const std::string target_suffix = SlotSuffixForSlotNumber(target_slot);
DeleteGroupsWithSuffix(builder, target_suffix);