Do not set BOARD_VNDK_VERSION and PLATFORM_VNDK_VERSION

Do not set BOARD_VNDK_VERSION and PLATFORM_VNDK_VERSION if VNDK is
deprecated. BOARD_VNDK_VERSION and PLATFORM_VNDK_VERSION should not be
used once VNDK is deprecated with KEEP_VNDK=false

Bug: 316829758
Test: AOSP CF build succeeded
Change-Id: Iead60663bed3653e63e7a444a873cfaea50780b0
diff --git a/core/version_util.mk b/core/version_util.mk
index dfa0277..0ed4499 100644
--- a/core/version_util.mk
+++ b/core/version_util.mk
@@ -157,21 +157,23 @@
 endif
 .KATI_READONLY := DEFAULT_APP_TARGET_SDK
 
-ifndef PLATFORM_VNDK_VERSION
-  # This is the definition of the VNDK version for the current VNDK libraries.
-  # With trunk stable, VNDK will not be frozen but deprecated.
-  # This version will be removed with the VNDK deprecation.
-  ifeq (REL,$(PLATFORM_VERSION_CODENAME))
-    ifdef RELEASE_PLATFORM_VNDK_VERSION
-      PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION)
+ifeq ($(KEEP_VNDK),true)
+  ifndef PLATFORM_VNDK_VERSION
+    # This is the definition of the VNDK version for the current VNDK libraries.
+    # With trunk stable, VNDK will not be frozen but deprecated.
+    # This version will be removed with the VNDK deprecation.
+    ifeq (REL,$(PLATFORM_VERSION_CODENAME))
+      ifdef RELEASE_PLATFORM_VNDK_VERSION
+        PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION)
+      else
+        PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
+      endif
     else
-      PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
+      PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
     endif
-  else
-    PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
   endif
+  .KATI_READONLY := PLATFORM_VNDK_VERSION
 endif
-.KATI_READONLY := PLATFORM_VNDK_VERSION
 
 ifndef PLATFORM_SYSTEMSDK_MIN_VERSION
   # This is the oldest version of system SDK that the platform supports. Contrary