Ignore invalid vndk snapshot versions

Device targets may set PRODUCT_EXTRA_VNDK_VERSIONS to include invalid
snapshot versions with the trunk-stable next configuration.
Ignore those versions that are less than or equal to the
PLATFORM_VNDK_VERSION.

Bug: 296488609
Test: lunch cf_x86_64_phone-next-userdebug; m nothing
Change-Id: I2ba9d7f41a0d75db034b1c08d15f2796ef9ed506
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 86d4622..adeb159 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -195,7 +195,10 @@
 include $(CLEAR_VARS)
 _vndk_versions :=
 ifeq ($(filter com.android.vndk.current.on_vendor, $(PRODUCT_PACKAGES)),)
-	_vndk_versions += $(PRODUCT_EXTRA_VNDK_VERSIONS)
+	_vndk_versions += $(if $(call math_is_number,$(PLATFORM_VNDK_VERSION)),\
+		$(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),\
+			$(if $(call math_lt,$(vndk_ver),$(PLATFORM_VNDK_VERSION)),$(vndk_ver))),\
+		$(PRODUCT_EXTRA_VNDK_VERSIONS))
 endif
 ifneq ($(BOARD_VNDK_VERSION),current)
 	_vndk_versions += $(BOARD_VNDK_VERSION)