Delete COW group for downgrade Virtual A/B am: a4e7da3b8a am: fbc9ac74a7
am: 3dc17f4075
Change-Id: I13df60898cafb977501215e3cf8170b12ec08b60
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);