Use sdk variant of Soong modules when LOCAL_SDK_VERSION is set
Soong now makes a variant of native modules that set sdk_version.
Use the new variant for native modules or apps with JNI that are
defined in Make and set LOCAL_SDK_VERSION.
Test: m checkbuild
Bug: 149591340
Change-Id: Ief378a007e43b0aea31fd5845410bbffec0ffae6
Merged-In: Ief378a007e43b0aea31fd5845410bbffec0ffae6
(cherry picked from commit b93411699498d893b7e8d71be73edb1f857c5079)
diff --git a/core/binary.mk b/core/binary.mk
index 38ff9d6..75f4874 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1160,6 +1160,18 @@
$(if $(filter $(l),$(VENDOR_PUBLIC_LIBRARIES)),$(l).vendorpublic,$(l)))
endif
+###########################################################
+## When compiling against the NDK, use SDK variants of Soong libraries
+###########################################################
+
+ifneq ($(LOCAL_SDK_VERSION),)
+ my_whole_static_libraries := $(call use_soong_sdk_libraries,$(my_whole_static_libraries))
+ my_static_libraries := $(call use_soong_sdk_libraries,$(my_static_libraries))
+ my_shared_libraries := $(call use_soong_sdk_libraries,$(my_shared_libraries))
+ my_system_shared_libraries := $(call use_soong_sdk_libraries,$(my_system_shared_libraries))
+ my_header_libraries := $(call use_soong_sdk_libraries,$(my_header_libraries))
+endif
+
##########################################################
## Set up installed module dependency
## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for