Add DynamicPartitionControl::EraseSystemOtherAvbFooter

Erase AVB footer of system other partition prior to any updates so that if
an update overwrites it partially, and the device rolled back (or even
before we finish writing the partition), and the device factory resets,
mapping system_other as /postinstall won't trigger verity errors and
reboots the device.

Fixes: 152444348
Test: apply update, rollback, then FDR
Test: apply update, then set sys.cppreopt=requested; observe that
/postinstall cannot be mounted.

Change-Id: I62e5bb8f4c31d9a1beff485c47fc4b07a3a5686b
(cherry picked from commit 2969290920696611a67aed184baf71cac062b416)
Merged-In: I62e5bb8f4c31d9a1beff485c47fc4b07a3a5686b
diff --git a/dynamic_partition_test_utils.h b/dynamic_partition_test_utils.h
index 346998f..70a176b 100644
--- a/dynamic_partition_test_utils.h
+++ b/dynamic_partition_test_utils.h
@@ -175,7 +175,7 @@
 }
 
 inline std::unique_ptr<MetadataBuilder> NewFakeMetadata(
-    const DeltaArchiveManifest& manifest) {
+    const DeltaArchiveManifest& manifest, uint32_t partition_attr = 0) {
   auto builder =
       MetadataBuilder::New(kDefaultSuperSize, kFakeMetadataSize, kMaxNumSlots);
   for (const auto& group : manifest.dynamic_partition_metadata().groups()) {
@@ -183,7 +183,7 @@
     for (const auto& partition_name : group.partition_names()) {
       EXPECT_NE(
           nullptr,
-          builder->AddPartition(partition_name, group.name(), 0 /* attr */));
+          builder->AddPartition(partition_name, group.name(), partition_attr));
     }
   }
   for (const auto& partition : manifest.partitions()) {