Do not erase system_other if zero length.
To be precise, do not erase it if the partition
size is smaller than the AVB_FOOTER_SIZE, because
it doesn't make sense to erase.
Test: pass
Fixes: 155263137
Change-Id: I20778a8965526beb7ece1d79100646e770d0aa2e
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index 7486d09..a9c2bb3 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -656,6 +656,13 @@
return true;
}
+ if (p->size() < AVB_FOOTER_SIZE) {
+ LOG(INFO) << partition_name_suffix << " has length " << p->size()
+ << "( < AVB_FOOTER_SIZE " << AVB_FOOTER_SIZE
+ << "), skip erasing.";
+ return true;
+ }
+
// Delete any pre-existing device with name |partition_name_suffix| and
// also remove it from |mapped_devices_|.
// In recovery, metadata might not be mounted, and