Sanity check that no downgrade package on launch VAB device.

If the OTA server were misconfigured, OTA client can
reject the OTA if the current device launches
with VAB but is trying to update to a build that
does not support VAB. This operation is only
permitted on retrofit devices.

Bug: 138258570
Test: pass
Change-Id: I159ff2edc81555fee8bfa6296e0c6c969f2f4f6d
diff --git a/dynamic_partition_control_android.cc b/dynamic_partition_control_android.cc
index 0c1f0d3..e194670 100644
--- a/dynamic_partition_control_android.cc
+++ b/dynamic_partition_control_android.cc
@@ -369,6 +369,13 @@
       return PrepareSnapshotPartitionsForUpdate(
           source_slot, target_slot, manifest);
     }
+
+    if (GetVirtualAbFeatureFlag().IsLaunch() && !target_supports_snapshot_) {
+      LOG(ERROR) << "Cannot downgrade to a build that does not support "
+                 << "snapshots because this device launches with Virtual A/B.";
+      return false;
+    }
+
     if (!snapshot_->CancelUpdate()) {
       LOG(ERROR) << "Cannot cancel previous update.";
       return false;