Check allocatable space correctly when sideloading on VAB
Picked single logical fix for this error. See bug for details.
Test: pre-submit
Bug: 169781891
Change-Id: I4facf2cd157143846c873e2b458d37356692d68c
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index ecd6252..708380a 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -795,7 +795,12 @@
std::string expr;
uint64_t allocatable_space = builder->AllocatableSpace();
- if (!GetDynamicPartitionsFeatureFlag().IsRetrofit()) {
+ // On device retrofitting dynamic partitions, allocatable_space = super.
+ // On device launching dynamic partitions w/o VAB,
+ // allocatable_space = super / 2.
+ // On device launching dynamic partitions with VAB, allocatable_space = super.
+ if (!GetDynamicPartitionsFeatureFlag().IsRetrofit() &&
+ !GetVirtualAbFeatureFlag().IsEnabled()) {
allocatable_space /= 2;
expr = "half of ";
}