Merge "Install VNDK v35 in the vendor partition" into main
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 70ee78d..655a666 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -1,33 +1,23 @@
 LOCAL_PATH:= $(call my-dir)
 
-# VNDK will not be frozen if the PLATFORM_VNDK_VERSION is a codename or greater than 34
-ifeq ($(call math_is_number,$(PLATFORM_VNDK_VERSION)),)
-UNFROZEN_VNDK := true
-else
-ifeq ($(call math_gt,$(PLATFORM_VNDK_VERSION),34),true)
-UNFROZEN_VNDK := true
-endif
-endif
-
 #####################################################################
 # list of vndk libraries from the source code.
 INTERNAL_VNDK_LIB_LIST := $(SOONG_VNDK_LIBRARIES_FILE)
 
 #####################################################################
 # This is the up-to-date list of vndk libs.
-# TODO(b/62012285): the lib list should be stored somewhere under
-# /prebuilts/vndk
+LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/current.txt
+UNFROZEN_VNDK :=
 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
-ifndef UNFROZEN_VNDK
-LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/$(PLATFORM_VNDK_VERSION).txt
-ifeq ($(wildcard $(LATEST_VNDK_LIB_LIST)),)
-$(error $(LATEST_VNDK_LIB_LIST) file not found. Please copy "$(LOCAL_PATH)/current.txt" to "$(LATEST_VNDK_LIB_LIST)" and commit a CL for release branch)
-endif
-else # UNFROZEN_VNDK
-LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/current.txt
-endif # UNFROZEN_VNDK
-else
-LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/current.txt
+    # Use frozen vndk lib list only if "34 >= PLATFORM_VNDK_VERSION"
+    ifeq ($(call math_gt_or_eq,34,$(PLATFORM_VNDK_VERSION)),true)
+        LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/$(PLATFORM_VNDK_VERSION).txt
+        ifeq ($(wildcard $(LATEST_VNDK_LIB_LIST)),)
+            $(error $(LATEST_VNDK_LIB_LIST) file not found. Please copy "$(LOCAL_PATH)/current.txt" to "$(LATEST_VNDK_LIB_LIST)" and commit a CL for release branch)
+        endif
+    else
+        UNFROZEN_VNDK := true
+    endif
 endif
 
 #####################################################################
@@ -198,6 +188,11 @@
     $(VNDK_USING_CORE_VARIANT_LIBRARIES) \
     com.android.vndk.current
 
+# Install VNDK apex on vendor partition if VNDK is unfrozen
+ifdef UNFROZEN_VNDK
+LOCAL_REQUIRED_MODULES += com.android.vndk.current.on_vendor
+endif
+
 LOCAL_ADDITIONAL_DEPENDENCIES += $(call module-built-files,\
     $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES)))