Merge "Prevent vendor libs from depending on private VNDK libraries"
diff --git a/core/Makefile b/core/Makefile
index e94939b..4959e0e 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1302,12 +1302,12 @@
.PHONY: recoveryimage
recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
-ifeq ($(BOARD_NAND_PAGE_SIZE),)
-BOARD_NAND_PAGE_SIZE := 2048
+ifneq ($(BOARD_NAND_PAGE_SIZE),)
+$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
endif
-ifeq ($(BOARD_NAND_SPARE_SIZE),)
-BOARD_NAND_SPARE_SIZE := 64
+ifneq ($(BOARD_NAND_SPARE_SIZE),)
+$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
endif
# -----------------------------------------------------------------
diff --git a/core/base_rules.mk b/core/base_rules.mk
index e7da560..a178b55 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -622,7 +622,7 @@
# Add this module name to the tag list of each specified tag.
$(foreach tag,$(my_module_tags),\
- $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
+ $(eval ALL_MODULE_NAME_TAGS.$(tag) := $$(ALL_MODULE_NAME_TAGS.$(tag)) $(my_register_name)))
###########################################################
## umbrella targets used to verify builds
diff --git a/core/definitions.mk b/core/definitions.mk
index 550634b..cb0a6bb 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2714,6 +2714,26 @@
$(hide) ln -sf $(2) $$@
endef
+# Copy an apk to a target location while removing classes*.dex
+# $(1): source file
+# $(2): destination file
+# $(3): LOCAL_DEX_PREOPT, if nostripping then leave classes*.dex
+define dexpreopt-copy-jar
+$(2): $(1)
+ @echo $(if $(filter nostripping,$(3)),"Copy: $$@","Copy without dex: $$@")
+ $$(copy-file-to-target)
+ $(if $(filter nostripping,$(3)),,$$(call dexpreopt-remove-classes.dex,$$@))
+endef
+
+# $(1): the .jar or .apk to remove classes.dex
+define dexpreopt-remove-classes.dex
+$(hide) zip --quiet --delete $(1) classes.dex; \
+dex_index=2; \
+while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
+ let dex_index=dex_index+1; \
+done
+endef
+
###########################################################
## Commands to call Proguard
###########################################################
@@ -2745,39 +2765,16 @@
$(error HOST_OS must define get-file-size)
endif
-# Convert a partition data size (eg, as reported in /proc/mtd) to the
-# size of the image used to flash that partition (which includes a
-# spare area for each page).
-# $(1): the partition data size
-define image-size-from-data-size
-$(strip $(eval _isfds_value := $$(shell echo $$$$(($(1) / $(BOARD_NAND_PAGE_SIZE) * \
- ($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE))))))\
-$(if $(filter 0, $(_isfds_value)),$(shell echo $$(($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE)))),$(_isfds_value))\
-$(eval _isfds_value :=))
-endef
-
# $(1): The file(s) to check (often $@)
-# $(2): The maximum total image size, in decimal bytes.
-# Make sure to take into account any reserved space needed for the FS.
-#
-# If $(2) is empty, evaluates to "true"
-#
-# Reserve bad blocks. Make sure that MAX(1% of partition size, 2 blocks)
-# is left over after the image has been flashed. Round the 1% up to the
-# next whole flash block size.
-define assert-max-file-size
+# $(2): The partition size.
+define assert-max-image-size
$(if $(2), \
size=$$(for i in $(1); do $(call get-file-size,$$i); echo +; done; echo 0); \
total=$$(( $$( echo "$$size" ) )); \
printname=$$(echo -n "$(1)" | tr " " +); \
- img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \
- twoblocks=$$((img_blocksize * 2)); \
- onepct=$$((((($(2) / 100) - 1) / img_blocksize + 1) * img_blocksize)); \
- reserve=$$((twoblocks > onepct ? twoblocks : onepct)); \
- maxsize=$$(($(2) - reserve)); \
- echo "$$printname maxsize=$$maxsize blocksize=$$img_blocksize total=$$total reserve=$$reserve"; \
+ maxsize=$(2); \
if [ "$$total" -gt "$$maxsize" ]; then \
- echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \
+ echo "error: $$printname too large ($$total > $$maxsize)"; \
false; \
elif [ "$$total" -gt $$((maxsize - 32768)) ]; then \
echo "WARNING: $$printname approaching size limit ($$total now; limit $$maxsize)"; \
@@ -2787,17 +2784,6 @@
)
endef
-# Like assert-max-file-size, but the second argument is a partition
-# size, which we'll convert to a max image size before checking it
-# against the files.
-#
-# $(1): The file(s) to check (often $@)
-# $(2): The partition size.
-define assert-max-image-size
-$(if $(2), \
- $(call assert-max-file-size,$(1),$(call image-size-from-data-size,$(2))))
-endef
-
###########################################################
## Define device-specific radio files
@@ -2976,7 +2962,7 @@
base_rules \
HEADER_LIBRARY
-$(foreach $(s),$(STATS.MODULE_TYPE),$(eval STATS.MODULE_TYPE.$(s) :=))
+$(foreach s,$(STATS.MODULE_TYPE),$(eval STATS.MODULE_TYPE.$(s) :=))
define record-module-type
$(strip $(if $(LOCAL_RECORDED_MODULE_TYPE),,
$(if $(filter-out $(SOONG_ANDROID_MK),$(LOCAL_MODULE_MAKEFILE)),
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 439f7e5..aad0acd 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -48,15 +48,6 @@
GLOBAL_DEXPREOPT_FLAGS :=
-# $(1): the .jar or .apk to remove classes.dex
-define dexpreopt-remove-classes.dex
-$(hide) zip --quiet --delete $(1) classes.dex; \
-dex_index=2; \
-while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
- let dex_index=dex_index+1; \
-done
-endef
-
# Special rules for building stripped boot jars that override java_library.mk rules
# $(1): boot jar module name
@@ -64,11 +55,7 @@
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
-$$(_dbj_jar_no_dex) : $$(_dbj_src_jar)
- $$(call copy-file-to-target)
-ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
- $$(call dexpreopt-remove-classes.dex,$$@)
-endif
+$(call dexpreopt-copy-jar,$$(_dbj_src_jar),$$(_dbj_jar_no_dex),$(DEX_PREOPT_DEFAULT))
_dbj_jar_no_dex :=
_dbj_src_jar :=
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 136def4..ffcd798 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -30,7 +30,7 @@
ifdef LOCAL_UNINSTALLABLE_MODULE
LOCAL_DEX_PREOPT :=
endif
-ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file))) # contains no java code
+ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) # contains no java code
LOCAL_DEX_PREOPT :=
endif
# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip
diff --git a/core/java_common.mk b/core/java_common.mk
index 837983b..320c52f 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -22,7 +22,12 @@
ifneq ($(EXPERIMENTAL_USE_OPENJDK9),true)
LOCAL_JAVA_LANGUAGE_VERSION := 1.8
else
- LOCAL_JAVA_LANGUAGE_VERSION := 1.9
+ private_sdk_versions_without_any_java_19_support := 24 25 26
+ ifneq (,$(filter $(LOCAL_SDK_VERSION), $(private_sdk_versions_without_any_java_19_support)))
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ else
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.9
+ endif
endif
endif
endif
diff --git a/core/java_library.mk b/core/java_library.mk
index f933653..d728c53 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -86,10 +86,7 @@
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
-$(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
-ifneq (nostripping,$(LOCAL_DEX_PREOPT))
- $(call dexpreopt-remove-classes.dex,$@)
-endif
+$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
endif # ! boot jar
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 5dc4602..b79e68b 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -439,11 +439,7 @@
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
-$(built_module) : $(my_prebuilt_src_file)
- $(call copy-file-to-target)
-ifneq (nostripping,$(LOCAL_DEX_PREOPT))
- $(call dexpreopt-remove-classes.dex,$@)
-endif
+$(eval $(call dexpreopt-copy-jar,$(my_prebuilt_src_file),$(built_module),$(LOCAL_DEX_PREOPT)))
endif # boot jar
else # ! LOCAL_DEX_PREOPT
$(built_module) : $(my_prebuilt_src_file)
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 9198d68..b251d7c 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -35,11 +35,38 @@
endif # TURBINE_DISABLED != false
ifdef LOCAL_SOONG_DEX_JAR
-$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
-$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
-java-dex : $(LOCAL_BUILT_MODULE)
+ ifndef LOCAL_IS_HOST_MODULE
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
+
+ # defines built_odex along with rule to install odex
+ include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
+
+ ifdef LOCAL_DEX_PREOPT
+ ifneq ($(dexpreopt_boot_jar_module),) # boot jar
+ # boot jar's rules are defined in dex_preopt.mk
+ dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
+ $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE)))
+
+ # For libart boot jars, we don't have .odex files.
+ else # ! boot jar
+ $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
+ # Use pattern rule - we may have multiple built odex files.
+$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
+ @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
+ $(call dexpreopt-one-file,$<,$@)
+
+ $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
+ endif # ! boot jar
+ else # LOCAL_DEX_PREOPT
+ $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
+ endif # LOCAL_DEX_PREOPT
+ else # LOCAL_IS_HOST_MODULE
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
+ endif
+
+ java-dex : $(LOCAL_BUILT_MODULE)
else
-$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
+ $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
endif
javac-check : $(full_classes_jar)
diff --git a/target/board/generic_arm64_a/BoardConfig.mk b/target/board/generic_arm64_a/BoardConfig.mk
index fbac417..88bd87c 100644
--- a/target/board/generic_arm64_a/BoardConfig.mk
+++ b/target/board/generic_arm64_a/BoardConfig.mk
@@ -63,8 +63,6 @@
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736 # 1.5 GB
-# TODO(b/35790399): remove when b/35790399 is fixed.
-BOARD_NAND_SPARE_SIZE := 0
BOARD_FLASH_BLOCK_SIZE := 512
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
index 99dbe9f..dafd592 100644
--- a/target/board/generic_arm64_ab/BoardConfig.mk
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -74,8 +74,6 @@
# Fix this!
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648
-# TODO(b/35790399): remove when b/35790399 is fixed.
-BOARD_NAND_SPARE_SIZE := 0
BOARD_FLASH_BLOCK_SIZE := 512
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
diff --git a/target/board/generic_arm_a/BoardConfig.mk b/target/board/generic_arm_a/BoardConfig.mk
index 6c1b36f..6530e6e 100644
--- a/target/board/generic_arm_a/BoardConfig.mk
+++ b/target/board/generic_arm_a/BoardConfig.mk
@@ -55,8 +55,6 @@
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
-# TODO(b/35790399): remove when b/35790399 is fixed.
-BOARD_NAND_SPARE_SIZE := 0
BOARD_FLASH_BLOCK_SIZE := 512
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true