Add missing vndk-sp libs to the VNDK-SP list
For the Treble devices without BOARD_VNDK_VERSION, we must have a
list of vndk-sp libs.
If there are some missing vndk-sp libs in the list, add them to the
list automatically.
Bug: 72470805
Bug: 69526027
Test: build sailfish/marlin and check boot
Change-Id: If4a5b85746ae67cff1efc5e49d883de95b42d757
diff --git a/vndk/Android.mk b/vndk/Android.mk
index 2143431..48a72f4 100644
--- a/vndk/Android.mk
+++ b/vndk/Android.mk
@@ -2,7 +2,20 @@
LOCAL_PATH := $(call my-dir)
-include $(LOCAL_PATH)/vndk-sp-libs.mk
+# b/69526027: This VNDK-SP install routine must be removed. Instead, we must
+# build vendor variants of the VNDK-SP modules.
+
+ifndef BOARD_VNDK_VERSION
+# The libs with "vndk: {enabled: true, support_system_process: true}" will be
+# added VNDK_SP_LIBRARIES automatically. And the core variants of the VNDK-SP
+# libs will be copied to vndk-sp directory.
+# However, some of those libs need FWK-ONLY libs, which must be listed here
+# manually.
+VNDK_SP_LIBRARIES := \
+ libdexfile
+
+install_in_hw_dir := \
+ android.hidl.memory@1.0-impl
define define-vndk-sp-lib
include $$(CLEAR_VARS)
@@ -14,7 +27,7 @@
LOCAL_MODULE_TAGS := optional
LOCAL_INSTALLED_MODULE_STEM := $1.so
LOCAL_MODULE_SUFFIX := .so
-LOCAL_MODULE_RELATIVE_PATH := vndk-sp
+LOCAL_MODULE_RELATIVE_PATH := vndk-sp$(if $(filter $1,$(install_in_hw_dir)),/hw)
include $$(BUILD_PREBUILT)
ifneq ($$(TARGET_2ND_ARCH),)
@@ -28,20 +41,27 @@
LOCAL_MODULE_TAGS := optional
LOCAL_INSTALLED_MODULE_STEM := $1.so
LOCAL_MODULE_SUFFIX := .so
-LOCAL_MODULE_RELATIVE_PATH := vndk-sp
+LOCAL_MODULE_RELATIVE_PATH := vndk-sp$(if $(filter $1,$(install_in_hw_dir)),/hw)
include $$(BUILD_PREBUILT)
endif # TARGET_TRANSLATE_2ND_ARCH is not true
endif # TARGET_2ND_ARCH is not empty
endef
+# Add VNDK-SP libs to the list if they are missing
+$(foreach lib,$(VNDK_SAMEPROCESS_LIBRARIES),\
+ $(if $(filter $(lib),$(VNDK_SP_LIBRARIES)),,\
+ $(eval VNDK_SP_LIBRARIES += $(lib))))
+
$(foreach lib,$(VNDK_SP_LIBRARIES),\
$(eval $(call define-vndk-sp-lib,$(lib))))
+install_in_hw_dir :=
+
include $(CLEAR_VARS)
LOCAL_MODULE := vndk-sp
LOCAL_MODULE_OWNER := google
LOCAL_MODULE_TAGS := optional
LOCAL_REQUIRED_MODULES := $(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES))
include $(BUILD_PHONY_PACKAGE)
-
+endif # BOARD_VNDK_VERSION
endif # TARGET_DEVICE is generic*
diff --git a/vndk/vndk-sp-libs.mk b/vndk/vndk-sp-libs.mk
deleted file mode 100644
index 08f9aca..0000000
--- a/vndk/vndk-sp-libs.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-ifndef BOARD_VNDK_VERSION
-VNDK_SP_LIBRARIES := \
- android.hardware.graphics.allocator@2.0 \
- android.hardware.graphics.mapper@2.0 \
- android.hardware.graphics.common@1.0 \
- android.hardware.renderscript@1.0 \
- android.hidl.memory@1.0 \
- libbacktrace \
- libbase \
- libc++ \
- libcutils \
- libRSCpuRef \
- libRSDriver \
- libRS_internal \
- libbcinfo \
- libblas \
- libcompiler_rt \
- libft2 \
- libpng \
- libhardware \
- libhwbinder \
- libion \
- liblzma \
- libunwind \
- libunwindstack \
- libutils \
- libhidlbase \
- libhidlmemory \
- libhidltransport \
- libz \
-
-endif