Merge "Pass OpenJDK 8's bootclasspath for host tools targeting <= 1.8."
diff --git a/core/config.mk b/core/config.mk
index d1beaad..6e624ed 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -773,6 +773,28 @@
requirements :=
+# If PRODUCT_USE_VNDK is true and BOARD_VNDK_VERSION is not defined yet,
+# BOARD_VNDK_VERSION will be set to "current" as default.
+# PRODUCT_USE_VNDK will be true in Android-P or later launching devices.
+PRODUCT_USE_VNDK := false
+ifneq ($(PRODUCT_USE_VNDK_OVERRIDE),)
+ PRODUCT_USE_VNDK := $(PRODUCT_USE_VNDK_OVERRIDE)
+else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+ # No shipping level defined
+else ifeq ($(call math_gt_or_eq,27,$(PRODUCT_SHIPPING_API_LEVEL)),)
+ PRODUCT_USE_VNDK := $(PRODUCT_FULL_TREBLE)
+endif
+
+ifeq ($(PRODUCT_USE_VNDK),true)
+ ifndef BOARD_VNDK_VERSION
+ BOARD_VNDK_VERSION := current
+ endif
+endif
+
+$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use PRODUCT_USE_VNDK instead)
+.KATI_READONLY := \
+ PRODUCT_USE_VNDK
+
ifdef PRODUCT_SHIPPING_API_LEVEL
ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),)
ifneq ($(TARGET_USES_MKE2FS),true)
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 4b12bfe..1ff9b91 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -176,7 +176,7 @@
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_desugar_jar) $(DX)
+$(built_dex): $(full_classes_desugar_jar) $(DX) $(ZIP2ZIP)
ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
else
diff --git a/core/java.mk b/core/java.mk
index 08e4035..dda4a32 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -777,7 +777,7 @@
endif # LOCAL_PROGUARD_ENABLED
ifndef my_r8
-$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
+$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
else
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 11ca473..bbad4c8 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -122,6 +122,8 @@
$(call add_json_bool, Uml, $(filter true,$(TARGET_USER_MODE_LINUX)))
$(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR))
+$(call add_json_str, OdmPath, $(TARGET_COPY_OUT_ODM))
+$(call add_json_str, OemPath, $(TARGET_COPY_OUT_OEM))
$(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
$(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA)))
diff --git a/core/tasks/vndk.mk b/core/tasks/vndk.mk
index 962fae1..1bbd3b0 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -46,6 +46,22 @@
)
endef
+# Returns paths of notice files under $(TARGET_OUT_NOTICE_FILES)
+#
+# Args:
+# $(1): list of lib names (e.g., libfoo.vendor)
+# $(2): vndk lib type, one of 'vndk' or 'vndk-sp'
+define paths-of-notice-files
+$(strip \
+ $(eval lib_dir := lib$(if $(TARGET_IS_64BIT),64,)) \
+ $(eval vndk_dir := $(2)-$(PLATFORM_VNDK_VERSION)) \
+ $(foreach lib,$(1), \
+ $(eval notice_file_name := $(patsubst %.vendor,%.so.txt,$(lib))) \
+ $(TARGET_OUT_NOTICE_FILES)/src/system/$(lib_dir)/$(vndk_dir)/$(notice_file_name) \
+ ) \
+)
+endef
+
# If in the future libclang_rt.ubsan* is removed from the VNDK-core list,
# need to update the related logic in this file.
ifeq (,$(filter libclang_rt.ubsan%,$(VNDK_CORE_LIBRARIES)))
@@ -101,9 +117,21 @@
$(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
+#######################################
+# module_paths.txt
+module_paths.txt := $(vndk_snapshot_configs_out)/module_paths.txt
+$(module_paths.txt): $(vndk_snapshot_libs)
+ @echo 'Generating: $@'
+ @rm -f $@
+ @mkdir -p $(dir $@)
+ $(hide) echo -n > $@
+ $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
+
+
vndk_snapshot_configs := \
$(vndkcore.libraries.txt) \
- $(vndkprivate.libraries.txt)
+ $(vndkprivate.libraries.txt) \
+ $(module_paths.txt)
#######################################
# vndk_snapshot_zip
@@ -125,6 +153,11 @@
$(call paths-of-intermediates,$(vndk_prebuilt_txts),ETC) \
$(vndk_snapshot_configs)
+$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_OUT := $(vndk_snapshot_arch)/NOTICE_FILES
+$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_INTERMEDIATES := \
+ $(call paths-of-notice-files,$(vndk_core_libs),vndk) \
+ $(call paths-of-notice-files,$(vndk_sp_libs),vndk-sp)
+
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# vndk_snapshot_arch_2ND := $(vndk_snapshot_out)/arch-$(TARGET_2ND_ARCH)-$(TARGET_2ND_ARCH_VARIANT)
@@ -165,6 +198,8 @@
$(PRIVATE_VNDK_SP_OUT),$(PRIVATE_VNDK_SP_INTERMEDIATES))
$(call private-copy-vndk-intermediates, \
$(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
+ $(call private-copy-vndk-intermediates, \
+ $(PRIVATE_NOTICE_FILES_OUT),$(PRIVATE_NOTICE_FILES_INTERMEDIATES))
# TODO(b/69834489): Package additional arch variants
# ifdef TARGET_2ND_ARCH
# $(call private-copy-vndk-intermediates, \
@@ -182,6 +217,7 @@
# clear global vars
clang-ubsan-vndk-core :=
paths-of-intermediates :=
+paths-of-notice-files :=
vndk_core_libs :=
vndk_sp_libs :=
vndk_snapshot_libs :=
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 32d9003..f6bc76b 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -187,17 +187,18 @@
ifndef PLATFORM_VNDK_VERSION
# This is the definition of the VNDK version for the current VNDK libraries.
# The version is only available when PLATFORM_VERSION_CODENAME == REL.
- # Otherwise, it will be set to "current". The ABI is allowed to be changed
- # only if PLATFORM_VNDK_VERSION == current. Once PLATFORM_VNDK_VERSION is set
- # to actual version, the ABI for this version will be frozon and emit build
- # errors if any ABI for the VNDK libs are changed.
+ # Otherwise, it will be set to a CODENAME version. The ABI is allowed to be
+ # changed only before the Android version is released. Once
+ # PLATFORM_VNDK_VERSION is set to actual version, the ABI for this version
+ # will be frozon and emit build errors if any ABI for the VNDK libs are
+ # changed.
# After that the snapshot of the VNDK with this version will be generated.
#
- # The version follows PLATFORM_SDK_VERSION.
+ # The VNDK version follows PLATFORM_SDK_VERSION.
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
else
- PLATFORM_VNDK_VERSION := current
+ PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
endif
endif
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index 2377188..7ff5acb 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -81,3 +81,9 @@
$(error BOARD_AVB_ENABLE cannot be set for Treble GSI)
endif
BOARD_BUILD_DISABLED_VBMETAIMAGE := true
+
+#GSI support for the devices that disable VNDK enforcing
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/etc/ld.config.txt:system/etc/ld.config.noenforce.txt \
+ build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc \
+ build/make/target/product/vndk/init.noenforce.rc:system/etc/init/gsi/init.noenforce.rc
diff --git a/target/product/vndk/init.gsi.rc b/target/product/vndk/init.gsi.rc
new file mode 100644
index 0000000..3e6b1fb
--- /dev/null
+++ b/target/product/vndk/init.gsi.rc
@@ -0,0 +1,2 @@
+# If ro.vndk.version is not defined, import init.noenforce.rc
+import /system/etc/init/gsi/init.${ro.vndk.version:-noenforce}.rc
diff --git a/target/product/vndk/init.noenforce.rc b/target/product/vndk/init.noenforce.rc
new file mode 100644
index 0000000..9371cc8
--- /dev/null
+++ b/target/product/vndk/init.noenforce.rc
@@ -0,0 +1,3 @@
+on early-init
+ # If ro.vndk.version is not set, use ld.config.nonenforce.txt
+ export LD_CONFIG_FILE /system/etc/ld.config.noenforce.txt