summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2020-05-13 16:50:40 -0700
committerYifan Hong <elsk@google.com>2020-05-14 18:40:50 +0000
commita74d2f0ef5a9431b6833c60ee618a7135eb9328e (patch)
tree2a4a6cdc226ae7a962efaf877fea525ce8ee82f1
parent23279926785d1933954ca0cb65e9d99c5e793059 (diff)
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 Bug: 155263137 Change-Id: I20778a8965526beb7ece1d79100646e770d0aa2e Merged-In: I20778a8965526beb7ece1d79100646e770d0aa2e
-rw-r--r--dynamic_partition_control_android.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index a310f209..ee9c6e3f 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -644,6 +644,13 @@ bool DynamicPartitionControlAndroid::GetSystemOtherPath(
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