Merge "logcat: permit transition to Android.bp"
diff --git a/Android.mk b/Android.mk
index a1455d4..5053e7d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,8 +1 @@
-LOCAL_PATH := $(call my-dir)
-
-# We're relocating the build project to a subdirectory, then using symlinks
-# to expose the subdirectories where they used to be. If the manifest hasn't
-# been updated, we need to include all the subdirectories.
-ifeq ($(LOCAL_PATH),build)
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
+include $(call all-subdir-makefiles)
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 91f1a0b..6a3e53e 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -424,6 +424,10 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/nativetest*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/nativetest*)
+# Jack is no longer the default compiler, remove the intermediates
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*/classes*.jack)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*/jack*)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 7c4c28b..fae81a4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1110,8 +1110,8 @@
$(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
$(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
$(hide) $(DEPMOD) -b $(4) 0.0
- $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' -i $(4)/lib/modules/0.0/modules.dep
- $(hide) cp $(4)/lib/modules/0.0/modules.dep $(2)/lib/modules
+ $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
+ $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
endef
# $(1): output file
@@ -2647,6 +2647,26 @@
.PHONY: dalvikfiles
dalvikfiles: $(INTERNAL_DALVIK_MODULES)
+ifeq ($(BUILD_QEMU_IMAGES),true)
+INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
+MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
+SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
+$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+ @echo Create system-qemu.img
+ (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
+
+systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
+droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
+ifeq ($(BOARD_USES_VENDORIMAGE),true)
+INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
+$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+ @echo Create vendor-qemu.img
+ (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
+
+vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
+droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
+endif
+endif
# -----------------------------------------------------------------
# The emulator package
ifeq ($(BUILD_EMULATOR),true)
@@ -2742,6 +2762,7 @@
$(SYMBOLS_ZIP) \
$(COVERAGE_ZIP) \
$(INSTALLED_SYSTEMIMAGE) \
+ $(INSTALLED_QEMU_SYSTEMIMAGE) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_SDK_BUILD_PROP_TARGET) \
diff --git a/core/binary.mk b/core/binary.mk
index 6753e18..6d6b6a9 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -270,7 +270,7 @@
endif
ifneq ($(LOCAL_USE_VNDK),)
- my_cflags += -D__ANDROID_API__=__ANDROID_API_FUTURE__
+ my_cflags += -D__ANDROID_API__=__ANDROID_API_FUTURE__ -D__ANDROID_VNDK__
endif
ifndef LOCAL_IS_HOST_MODULE
@@ -464,6 +464,8 @@
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LINKER)
endif
+# Modules from soong do not need this since the dependencies are already handled there.
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
include $(BUILD_SYSTEM)/config_sanitizers.mk
ifneq ($(LOCAL_NO_LIBCOMPILER_RT),true)
@@ -477,6 +479,7 @@
ifeq ($($(my_prefix)OS),windows)
my_static_libraries += libwinpthread
endif
+endif # this module is not from soong
ifneq ($(filter ../%,$(my_src_files)),)
my_soong_problems += dotdot_srcs
@@ -1324,14 +1327,9 @@
## switch all soong libraries over to the /vendor
## variant.
####################################################
- ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
- # Soong-built libraries should always use the .vendor variant
- my_whole_static_libraries := $(addsuffix .vendor,$(my_whole_static_libraries))
- my_static_libraries := $(addsuffix .vendor,$(my_static_libraries))
- my_shared_libraries := $(addsuffix .vendor,$(my_shared_libraries))
- my_system_shared_libraries := $(addsuffix .vendor,$(my_system_shared_libraries))
- my_header_libraries := $(addsuffix .vendor,$(my_header_libraries))
- else
+ ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ # We don't do this renaming for soong-defined modules since they already have correct
+ # names (with .vendor suffix when necessary) in their LOCAL_*_LIBRARIES.
my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
$(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
my_static_libraries := $(foreach l,$(my_static_libraries),\
@@ -1375,7 +1373,7 @@
import_includes := $(intermediates)/import_includes
import_includes_deps := $(strip \
$(if $(LOCAL_USE_VNDK),\
- $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers.vendor,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
+ $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(installed_shared_library_module_names), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
diff --git a/core/clang/config.mk b/core/clang/config.mk
index be43a26..d41c17f 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -72,6 +72,7 @@
# INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS is defined later in other config.mk.
LOCAL_CLANG_EXCEPTION_PROJECTS = \
bionic/tests/ \
+ device/google/contexthub/ \
device/huawei/angler/ \
device/lge/bullhead/ \
external/gentoo/integration/ \
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 0e1c88d..5768ab3 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -58,7 +58,7 @@
# If the clean_steps.mk file is missing (usually after a clean build)
# then we won't do anything.
-CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)
+CURRENT_CLEAN_BUILD_VERSION := MISSING
CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)
# Read the current state from the file, if present.
@@ -67,7 +67,9 @@
clean_steps_file := $(PRODUCT_OUT)/clean_steps.mk
-include $(clean_steps_file)
-ifneq ($(CURRENT_CLEAN_BUILD_VERSION),$(INTERNAL_CLEAN_BUILD_VERSION))
+ifeq ($(CURRENT_CLEAN_BUILD_VERSION),MISSING)
+ # Do nothing
+else ifneq ($(CURRENT_CLEAN_BUILD_VERSION),$(INTERNAL_CLEAN_BUILD_VERSION))
# The major clean version is out-of-date. Do a full clean, and
# don't even bother with the clean steps.
$(info *** A clean build is required because of a recent change.)
@@ -109,36 +111,19 @@
# Write the new state to the file.
#
-rewrite_clean_steps_file :=
ifneq ($(CURRENT_CLEAN_BUILD_VERSION)-$(CURRENT_CLEAN_STEPS),$(INTERNAL_CLEAN_BUILD_VERSION)-$(INTERNAL_CLEAN_STEPS))
-rewrite_clean_steps_file := true
-endif
-ifeq ($(wildcard $(clean_steps_file)),)
-# This is the first build.
-rewrite_clean_steps_file := true
-endif
-ifeq ($(rewrite_clean_steps_file),true)
-$(shell \
- mkdir -p $(dir $(clean_steps_file)) && \
- echo "CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)" > \
- $(clean_steps_file) ;\
- echo "CURRENT_CLEAN_STEPS := $(wordlist 1,500,$(INTERNAL_CLEAN_STEPS))" >> $(clean_steps_file) \
- )
-define -cs-write-clean-steps-if-arg1-not-empty
-$(if $(1),$(shell echo "CURRENT_CLEAN_STEPS += $(1)" >> $(clean_steps_file)))
-endef
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 501,1000,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 1001,1500,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 1501,2000,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 2001,2500,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 2501,3000,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 3001,99999,$(INTERNAL_CLEAN_STEPS)))
+$(shell mkdir -p $(dir $(clean_steps_file)))
+$(file >$(clean_steps_file).tmp,CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)$(newline)CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)$(newline))
+$(shell if ! cmp -s $(clean_steps_file).tmp $(clean_steps_file); then \
+ mv $(clean_steps_file).tmp $(clean_steps_file); \
+ else \
+ rm $(clean_steps_file).tmp; \
+ fi)
endif
CURRENT_CLEAN_BUILD_VERSION :=
CURRENT_CLEAN_STEPS :=
clean_steps_file :=
-rewrite_clean_steps_file :=
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index 5c2668c..0538c52 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -10,22 +10,40 @@
#
ifndef ANDROID_COMPILE_WITH_JACK
-# Defines if compilation with jack is enabled by default.
-ANDROID_COMPILE_WITH_JACK := true
+ # TODO(b/64113890, b/35788202): remove PRODUCT_COMPILE_WITH_JACK
+ ifdef PRODUCT_COMPILE_WITH_JACK
+ ANDROID_COMPILE_WITH_JACK := $(PRODUCT_COMPILE_WITH_JACK)
+ else
+ # TODO(b/62038127): remove TARGET_BUILD_APPS check
+ ifdef TARGET_BUILD_APPS
+ ANDROID_COMPILE_WITH_JACK := true
+ else
+ ANDROID_COMPILE_WITH_JACK := false
+ endif
+ endif
endif
common_jdk_flags := -Xmaxerrs 9999999
+ifeq ($(OVERRIDE_ANDROID_JAVA_HOME),)
+ANDROID_JAVA_HOME := prebuilts/jdk/jdk8/$(HOST_PREBUILT_TAG)
+else
+# Use this build toolchain instead of the bundled one.
+ANDROID_JAVA_HOME := $(OVERRIDE_ANDROID_JAVA_HOME)
+endif
+ANDROID_JAVA_TOOLCHAIN := $(ANDROID_JAVA_HOME)/bin
+export JAVA_HOME := $(abspath $(ANDROID_JAVA_HOME))
+
# Use the indexer wrapper to index the codebase instead of the javac compiler
ifeq ($(ALTERNATE_JAVAC),)
-JAVACC := javac
+JAVACC := $(ANDROID_JAVA_TOOLCHAIN)/javac
else
JAVACC := $(ALTERNATE_JAVAC)
endif
-JAVA := java
-JAVADOC := javadoc
-JAR := jar
+JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java
+JAVADOC := $(ANDROID_JAVA_TOOLCHAIN)/javadoc
+JAR := $(ANDROID_JAVA_TOOLCHAIN)/jar
# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
ifdef JAVAC_WRAPPER
@@ -34,16 +52,8 @@
endif
endif
-# Whatever compiler is on this system.
COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags)
-# Eclipse.
-ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
- COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
- -maxProblems 9999999 -nowarn
- $(info CUSTOM_JAVA_COMPILER=eclipse)
-endif
-
GLOBAL_JAVAC_DEBUG_FLAGS := -g
HOST_JAVAC ?= $(COMMON_JAVAC)
diff --git a/core/config.mk b/core/config.mk
index f40f07e..7d4581d 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -71,6 +71,8 @@
$(error Please remove --color=always from your $$GREP_OPTIONS)
endif
+UNAME := $(shell uname -sm)
+
SRC_TARGET_DIR := $(TOPDIR)build/target
SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
@@ -499,11 +501,6 @@
USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
-# TODO(ccross): remove this once the build server no longer references it
-ifdef DX_ALT_JAR
-DX_JAR := DX_ALT_JAR
-endif
-
#
# Tools that are prebuilts for TARGET_BUILD_APPS
#
@@ -511,16 +508,24 @@
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2
- DX_JAR ?= $(HOST_OUT_JAVA_LIBRARIES)/dx.jar
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign
+
+ ifndef DX_ALT_JAR
+ DX := $(HOST_OUT_EXECUTABLES)/dx
+ DX_COMMAND := $(DX) -JXms16M -JXmx2048M
+ else
+ DX := $(DX_ALT_JAR)
+ DX_COMMAND := $(JAVA) -Xms16M -Xmx2048M -jar $(DX)
+ endif
else # TARGET_BUILD_APPS || TARGET_BUILD_PDK
AIDL := $(prebuilt_sdk_tools_bin)/aidl
AAPT := $(prebuilt_sdk_tools_bin)/aapt
AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2
- DX_JAR ?= $(prebuilt_sdk_tools)/lib/dx.jar
+ DX := $(prebuilt_sdk_tools)/dx
+ DX_COMMAND := $(DX) -JXms16M -JXmx2048M
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
@@ -558,16 +563,6 @@
ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip
ZIPTIME := $(prebuilt_build_tools_bin)/ziptime
-# DX can be overriden on the command line
-ifndef DX
-#TODO: use a smaller -Xmx value for most libraries;
-# only core.jar and framework.jar need a heap this big.
-DX := $(JAVA) -Xms16M -Xmx2048M -jar $(DX_JAR)
-DX_DEPS := $(DX_JAR)
-else
-DX_DEPS ?= $(DX)
-endif
-
# ---------------------------------------------------------------
# Generic tools.
JACK := $(HOST_OUT_EXECUTABLES)/jack
@@ -683,31 +678,15 @@
COLUMN:= column
-# We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh.
-ifneq ($(CALLED_FROM_SETUP),true)
-
# Path to tools.jar, or empty if EXPERIMENTAL_USE_OPENJDK9 is set
HOST_JDK_TOOLS_JAR :=
# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8
# toolchains are no longer supported (i.e. when what is now
# EXPERIMENTAL_USE_OPENJDK9 becomes the standard). http://b/38418220
ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
-HOST_JDK_TOOLS_JAR := $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
-
-ifneq ($(HOST_JDK_TOOLS_JAR),)
-ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
-$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly)
-endif
-endif
+HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA_TOOLCHAIN)/../lib/tools.jar
endif # ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
-# Is the host JDK 64-bit version?
-HOST_JDK_IS_64BIT_VERSION :=
-ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),)
-HOST_JDK_IS_64BIT_VERSION := true
-endif
-endif # CALLED_FROM_SETUP not true
-
# It's called md5 on Mac OS and md5sum on Linux
ifeq ($(HOST_OS),darwin)
MD5SUM:=md5 -q
@@ -856,6 +835,17 @@
unexport JAVA_HOME
export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS)
export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH)
+else
+ # Put java first on the path
+ # TODO(ccross): remove this once tools run during the build no longer depend on
+ # finding java in the path
+ ifeq (,$(strip $(CALLED_FROM_SETUP)))
+ ifneq ($(shell which java),$(abspath $(ANDROID_JAVA_TOOLCHAIN)/java))
+ $(warning Found incorrect java $(shell which java) in $$PATH)
+ $(warning Adding $(abspath $(ANDROID_JAVA_TOOLCHAIN)) to $$PATH)
+ export PATH:=$(abspath $(ANDROID_JAVA_TOOLCHAIN)):$(PATH)
+ endif
+ endif
endif
# Projects clean of compiler warnings should be compiled with -Werror.
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index ab68d8d..c011284 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -22,6 +22,18 @@
endif
endif
+# Disable global integer_overflow in excluded paths.
+ifneq ($(filter integer_overflow, $(my_global_sanitize)),)
+ combined_exclude_paths := $(INTEGER_OVERFLOW_EXCLUDE_PATHS) \
+ $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS)
+
+ ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_exclude_paths)),\
+ $(filter $(dir)%,$(LOCAL_PATH)))),)
+ my_global_sanitize := $(filter-out integer_overflow,$(my_global_sanitize))
+ my_global_sanitize_diag := $(filter-out integer_overflow,$(my_global_sanitize_diag))
+ endif
+endif
+
ifneq ($(my_global_sanitize),)
my_sanitize := $(my_global_sanitize) $(my_sanitize)
endif
@@ -111,7 +123,6 @@
endif
endif
-
my_nosanitize = $(strip $(LOCAL_NOSANITIZE))
ifneq ($(my_nosanitize),)
my_sanitize := $(filter-out $(my_nosanitize),$(my_sanitize))
@@ -276,12 +287,6 @@
endif
endif
-ifneq ($(filter undefined,$(my_sanitize)),)
- ifndef LOCAL_IS_HOST_MODULE
- $(error ubsan is not yet supported on the target)
- endif
-endif
-
ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_RECOVER)),
my_cflags += -fsanitize-recover=$(recover_arg)
diff --git a/core/definitions.mk b/core/definitions.mk
index ae26030..235cf67 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2219,7 +2219,7 @@
$(addprefix -classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
- -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) -s $(PRIVATE_ANNO_INTERMEDIATES_DIR) \
+ -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) -s $(PRIVATE_ANNO_INTERMEDIATES_DIR) \
$(PRIVATE_JAVACFLAGS) \
\@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \
|| ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) \
@@ -2515,7 +2515,7 @@
$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
endef
-define desugar-classpath
+define desugar-bootclasspath
$(filter-out -classpath -bootclasspath "",$(subst :,$(space),$(1)))
endef
@@ -2527,6 +2527,7 @@
endef
# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
+# --desugar_try_with_resources_if_needed=false is needed due to b/63180735, b/63901645, b/63900665
define desugar-classes-jar
@echo Desugar: $@
@mkdir -p $(dir $@)
@@ -2540,6 +2541,7 @@
$(addprefix --bootclasspath_entry ,$(call desugar-bootclasspath,$(PRIVATE_BOOTCLASSPATH))) \
$(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_LIBRARIES)) \
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
+ --desugar_try_with_resources_if_needed=false \
--allow_empty_bootclasspath \
$(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
-i $< -o $@.tmp
@@ -2551,7 +2553,7 @@
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex
-$(hide) $(DX) \
+$(hide) $(DX_COMMAND) \
--dex --output=$(dir $@) \
--min-sdk-version=$(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(if $(NO_OPTIMIZE_DX), \
@@ -2682,6 +2684,17 @@
fi
endef
+# Add resources (non .class files) from a jar to a package
+# $(1): the package file
+# $(2): the jar file
+# $(3): temporary directory
+define add-jar-resources-to-package
+ rm -rf $(3)
+ mkdir -p $(3)
+ unzip -qo $(2) -d $(3) $$(zipinfo -1 $(2) | grep -v -E "\.class$$")
+ $(JAR) uf $(1) -C $(3) .
+endef
+
# Sign a package using the specified key/cert.
#
define sign-package
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 9db5dbf..aa11d15 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -11,9 +11,9 @@
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
endif
-# Pass special classpath to skip uses library check.
+# Pass special class loader context to skip the classpath and collision check.
# Should modify build system to pass used libraries properly later.
-DEX2OAT_CLASSPATH := "&"
+DEX2OAT_CLASS_LOADER_CONTEXT := "&"
DEX2OAT_DEPENDENCY += $(DEX2OAT)
@@ -25,6 +25,10 @@
COMPILED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
+# Use the first dirty-image-objects file in PRODUCT_COPY_FILES.
+DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \
+ $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES))))
+
define get-product-default-property
$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
endef
@@ -88,6 +92,42 @@
LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat boot-$(jar).vdex)
LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat boot.vdex
+# If we use a boot image profile.
+my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE)
+ifeq (,$(my_use_profile_for_boot_image))
+# If not set, use the default.
+my_use_profile_for_boot_image := false
+endif
+
+ifeq (true,$(my_use_profile_for_boot_image))
+
+# Location of text based profile for the boot image.
+my_boot_image_profile_location := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
+ifeq (,$(my_boot_image_profile_location))
+# If not set, use the default.
+my_boot_image_profile_location := frameworks/base/boot-image-profile.txt
+endif
+
+# Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs.
+my_out_boot_image_profile_location := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.prof
+$(my_out_boot_image_profile_location): PRIVATE_PROFILE_INPUT_LOCATION := $(my_boot_image_profile_location)
+$(my_out_boot_image_profile_location): $(PROFMAN) $(LIBART_TARGET_BOOT_DEX_FILES) $(my_boot_image_profile_location)
+ @echo "target profman: $@"
+ @mkdir -p $(dir $@)
+ ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
+ --create-profile-from=$(PRIVATE_PROFILE_INPUT_LOCATION) \
+ $(addprefix --apk=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
+ $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
+ --reference-profile-file=$@
+
+# We want to install the profile even if we are not using preopt since it is required to generate
+# the image on the device.
+my_installed_profile := $(TARGET_OUT)/etc/boot-image.prof
+$(eval $(call copy-one-file,$(my_out_boot_image_profile_location),$(my_installed_profile)))
+ALL_DEFAULT_INSTALLED_MODULES += $(my_installed_profile)
+
+endif
+
my_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
@@ -110,7 +150,7 @@
$(hide) mkdir -p $(dir $(2))
$(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
- --runtime-arg -classpath --runtime-arg $(DEX2OAT_CLASSPATH) \
+ --class-loader-context=$(DEX2OAT_CLASS_LOADER_CONTEXT) \
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
--dex-file=$(1) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 860a66a..d728118 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -37,6 +37,12 @@
COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES)
endif
+# If we have a dirty-image-objects file, create a parameter.
+DIRTY_IMAGE_OBJECTS_FLAGS :=
+ifneq ($(DIRTY_IMAGE_OBJECTS),)
+ DIRTY_IMAGE_OBJECTS_FLAGS := --dirty-image-objects=$(DIRTY_IMAGE_OBJECTS)
+endif
+
# The rule to install boot.art
# Depends on installed boot.oat, boot-*.art, boot-*.oat
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES)
@@ -50,18 +56,28 @@
@mkdir -p $(dir $@)
$(hide) $(ACP) -fp $(dir $<)$(notdir $@) $@
+ifeq (,$(my_out_boot_image_profile_location))
+my_boot_image_flags := $(COMPILED_CLASSES_FLAGS)
+my_boot_image_flags += --image-classes=$(PRELOADED_CLASSES)
+my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS)
+else
+my_boot_image_flags := --compiler-filter=speed-profile
+my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
+endif
+
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags)
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
# Use dex2oat debug version for better error reporting
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DEX2OAT_DEPENDENCY)
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_profile_location)
@echo "target dex2oat: $@"
@mkdir -p $(dir $@)
@mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
@rm -f $(dir $@)/*.art $(dir $@)/*.oat
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
- $(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
+ $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
- --image-classes=$(PRELOADED_CLASSES) \
+ $(PRIVATE_BOOT_IMAGE_FLAGS) \
$(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
$(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
--oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \
@@ -75,4 +91,4 @@
--runtime-arg -Xnorelocate --compile-pic \
--no-generate-debug-info --generate-build-id \
--multi-image --no-inline-from=core-oj.jar \
- $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(COMPILED_CLASSES_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
+ $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index b9c0fc6..136def4 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -59,6 +59,31 @@
built_installed_art :=
ifdef LOCAL_DEX_PREOPT
+
+ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
+LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
+endif
+
+ifdef LOCAL_VENDOR_MODULE
+ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+$(error profiles are not supported for vendor modules)
+endif
+else
+ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
+# If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
+# profile class listing. TODO: Use product specific directory here.
+my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
+LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING := $(my_classes_directory)/$(LOCAL_MODULE).prof.txt
+ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)))
+# Profile listing exists, use it to generate the profile.
+ifeq ($(LOCAL_DEX_PREOPT_APP_IMAGE),)
+LOCAL_DEX_PREOPT_APP_IMAGE := true
+endif
+LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
+endif
+endif
+endif
+
dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
ifdef dexpreopt_boot_jar_module
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
@@ -113,13 +138,6 @@
installed_art := $(strip $(installed_art))
ifdef built_odex
-
-ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
-ifeq (true,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
- LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
-endif
-endif
-
ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
ifndef LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING
$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING))
@@ -141,7 +159,12 @@
--apk=$(PRIVATE_BUILT_MODULE) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
--reference-profile-file=$@
+my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
+$(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
+build_installed_profile:=$(my_built_profile):$(my_installed_profile)
else
+build_installed_profile:=
+my_installed_profile :=
$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
endif
@@ -152,14 +175,44 @@
endif
endif
-ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
- # Jars of system server, apps loaded into system server, and apps the product wants to be
- # compiled with the 'speed' compiler filter.
- LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
-else
- # If no compiler filter is specified, default to 'quicken' to save on storage.
- ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
- LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken
+my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
+ifeq (,$(my_system_server_compiler_filter))
+my_system_server_compiler_filter := speed
+endif
+
+ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
+ ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
+ # Jars of system server, use the product option if it is set, speed otherwise.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter)
+ else
+ ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
+ # Apps loaded into system server, and apps the product default to being compiled with the
+ # 'speed' compiler filter.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
+ else
+ ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+ # For non system server jars, use speed-profile when we have a profile.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
+ else
+ # If no compiler filter is specified, default to 'quicken' to save on storage.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken
+ endif
+ endif
+ endif
+endif
+
+# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
+my_system_server_debug_info := $(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)
+ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
+# Only enable for non-eng builds.
+ifeq (,$(my_system_server_debug_info))
+my_system_server_debug_info := true
+endif
+endif
+
+ifeq (true, $(my_system_server_debug_info))
+ ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
+ LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
endif
endif
@@ -172,9 +225,11 @@
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
+ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
+ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
# Record dex-preopt config.
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
@@ -190,6 +245,6 @@
# Make sure to install the .odex and .vdex when you run "make <module_name>"
-$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
+$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art) $(my_installed_profile)
endif # LOCAL_DEX_PREOPT
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 48a930d..e98df2f 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -86,8 +86,7 @@
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
endif # !LOCAL_IS_HOST_MODULE
-$(full_target): PRIVATE_CLASSPATH := $(subst $(space),:,$(full_java_libs))
-
+$(full_target): PRIVATE_CLASSPATH := $(call normalize-path-list,$(full_java_libs))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
@@ -166,6 +165,10 @@
# TODO: not clear if this is used any more
$(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+# TODO(tobiast): Clean this up once we move to -source 1.9.
+# OpenJDK 9 does not have the concept of a "boot classpath" so we should
+# then rename PRIVATE_BOOTCLASSPATH to PRIVATE_MODULE or similar. For now,
+# keep -bootclasspath here since it works in combination with -source 1.8.
$(full_target): \
$(full_src_files) \
$(droiddoc_templates) \
@@ -210,6 +213,18 @@
## standard doclet only
##
##
+
+ifneq ($(EXPERIMENTAL_USE_OPENJDK9),)
+# For OpenJDK 9 we use --patch-module to define the core libraries code.
+# TODO(tobiast): Reorganize this when adding proper support for OpenJDK 9
+# modules. Here we treat all code in core libraries as being in java.base
+# to work around the OpenJDK 9 module system. http://b/62049770
+$(full_target): PRIVATE_BOOTCLASSPATH_ARG := --patch-module=java.base=$(PRIVATE_BOOTCLASSPATH)
+else
+# For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
+$(full_target): PRIVATE_BOOTCLASSPATH_ARG := $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH))
+endif
+
$(full_target): $(full_src_files) $(full_java_lib_deps)
@echo Docs javadoc: $(PRIVATE_OUT_DIR)
@mkdir -p $(dir $@)
@@ -225,7 +240,7 @@
-Xdoclint:none \
$(PRIVATE_PROFILING_OPTIONS) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
- $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
+ $(PRIVATE_BOOTCLASSPATH_ARG) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
-d $(PRIVATE_OUT_DIR) \
-quiet \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 46066e3..d17e9e0 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -97,8 +97,6 @@
# compiles except for arm/mips, so the HOST is whatever we are
# running on
-UNAME := $(shell uname -sm)
-
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
HOST_OS := linux
@@ -110,7 +108,15 @@
HOST_OS := darwin
endif
-HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
+HOST_OS_EXTRA := $(shell uname -rsm)
+ifeq ($(HOST_OS),linux)
+ ifneq ($(wildcard /etc/os-release),)
+ HOST_OS_EXTRA += $(shell source /etc/os-release; echo $$PRETTY_NAME)
+ endif
+else ifeq ($(HOST_OS),darwin)
+ HOST_OS_EXTRA += $(shell sw_vers -productVersion)
+endif
+HOST_OS_EXTRA := $(subst $(space),-,$(HOST_OS_EXTRA))
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)
diff --git a/core/find-jdk-tools-jar.sh b/core/find-jdk-tools-jar.sh
deleted file mode 100755
index ac0b3b6..0000000
--- a/core/find-jdk-tools-jar.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-if [ "x$ANDROID_JAVA_HOME" != x ] && [ -e "$ANDROID_JAVA_HOME/lib/tools.jar" ] ; then
- echo $ANDROID_JAVA_HOME/lib/tools.jar
-else
- JAVAC=$(realpath $(which javac) 2>/dev/null)
- if [ -z "$JAVAC" ]; then
- JAVAC=$(readlink -f $(which javac) 2>/dev/null)
- fi
- if [ -z "$JAVAC" ]; then
- JAVAC=$(which javac)
- fi
- if [ -z "$JAVAC" ] ; then
- exit 1
- fi
- while [ -L "$JAVAC" ] ; do
- LSLINE=$(ls -l "$JAVAC")
- JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //")
- done
- echo $JAVAC | sed -e 's:\(.*\)/javac$:\1/../lib/tools.jar:'
-fi
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 94ce5b3..4f3069f 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -136,7 +136,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_jar) $(DX_DEPS)
+$(built_dex): $(full_classes_jar) $(DX)
$(transform-classes.jar-to-dex)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index 0e92153..b5f10cf 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -116,7 +116,7 @@
else
my_link_type := app:platform
my_warn_types :=
-my_allowed_types := native:ndk native:platform
+my_allowed_types := native:ndk native:platform native:vendor
endif
my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
diff --git a/core/java.mk b/core/java.mk
index c9dc32a..c457bd8 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -665,7 +665,7 @@
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
endif
-$(built_dex_intermediate): $(full_classes_jar) $(DX_DEPS)
+$(built_dex_intermediate): $(full_classes_jar) $(DX)
$(transform-classes.jar-to-dex)
endif # LOCAL_JACK_ENABLED is disabled
diff --git a/core/java_common.mk b/core/java_common.mk
index 3c9b18f..ba00b368 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -19,7 +19,11 @@
ifneq (,$(filter $(LOCAL_SDK_VERSION), $(private_sdk_versions_without_any_java_18_support)))
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
else
- LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ ifneq ($(EXPERIMENTAL_USE_OPENJDK9),true)
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ else
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.9
+ endif
endif
endif
LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)
diff --git a/core/link_type.mk b/core/link_type.mk
index ff525cb..f7604ff 100644
--- a/core/link_type.mk
+++ b/core/link_type.mk
@@ -10,7 +10,7 @@
# my_link_deps: the dependencies, in the form of <MODULE_CLASS>:<name>
#
-my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
+my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross))$(if $(filter AUX,$(my_kind)),-$(AUX_OS_VARIANT)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE)
ALL_LINK_TYPES := $(ALL_LINK_TYPES) $(link_type)
$(link_type).TYPE := $(my_link_type)
diff --git a/core/main.mk b/core/main.mk
index d14d64b..ef690e0 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -214,6 +214,11 @@
endif
endif
+# Add the system server compiler filter if they are specified for the product.
+ifneq (,$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
+ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.systemservercompilerfilter=$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
+endif
+
## user/userdebug ##
user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
@@ -592,7 +597,7 @@
# - TARGET
# - HOST
# - HOST_CROSS
-# - AUX
+# - AUX-<variant-name>
# 3: Whether to use the common intermediates directory or not
# - _
# - COMMON
@@ -619,9 +624,15 @@
link_type_error :=
-define link-type-prefix
+define link-type-prefix-base
$(word 2,$(subst :,$(space),$(1)))
endef
+define link-type-prefix
+$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,AUX,$(link-type-prefix-base)),$(link-type-prefix-base))
+endef
+define link-type-aux-variant
+$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,%,$(link-type-prefix-base)))
+endef
define link-type-common
$(patsubst _,,$(word 3,$(subst :,$(space),$(1))))
endef
@@ -712,7 +723,11 @@
# 2. The jni_link_type rule for embedded native code
# 3. The 2ND_jni_link_type for the second architecture native code
define link-type-file
-$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type
+$(eval _ltf_aux_variant:=$(link-type-aux-variant))\
+$(if $(_ltf_aux_variant),$(call aux-variant-load-env,$(_ltf_aux_variant)))\
+$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type\
+$(if $(_ltf_aux_variant),$(call aux-variant-load-env,none))\
+$(eval _ltf_aux_variant:=)
endef
# Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 89d3b34..e3ec91a 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -548,7 +548,10 @@
$(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
endif
+
$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
+$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
+$(LOCAL_BUILT_MODULE): PRIVATE_FULL_CLASSES_JAR := $(full_classes_jar)
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
ifdef LOCAL_USE_AAPT2
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
@@ -577,6 +580,11 @@
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else # full_classes_jar
$(add-dex-to-package)
+ifdef LOCAL_USE_AAPT2
+ifndef LOCAL_JACK_ENABLED
+ $(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
+endif
+endif
endif # full_classes_jar
ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources)
diff --git a/core/pathmap.mk b/core/pathmap.mk
index c328e58..717844f 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -63,12 +63,6 @@
endef
#
-# Many modules expect to be able to say "#include <jni.h>",
-# so make it easy for them to find the correct path.
-#
-JNI_H_INCLUDE := libnativehelper/include/nativehelper
-
-#
# A list of all source roots under frameworks/base, which will be
# built into the android.jar.
#
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 9f4c903..28ab0e7 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -84,7 +84,11 @@
endif
ifdef LOCAL_USE_VNDK
- SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(patsubst %.vendor,%,$(LOCAL_MODULE)) := 1
+ name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE))
+ ifneq ($(name_without_suffix),$(LOCAL_MODULE)
+ SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
+ endif
+ name_without_suffix :=
endif
endif
@@ -172,9 +176,7 @@
# Extra shared libraries introduced by LOCAL_CXX_STL.
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
ifdef LOCAL_USE_VNDK
- ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
- my_shared_libraries := $(addsuffix .vendor,$(my_shared_libraries))
- else
+ ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
$(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
endif
diff --git a/core/product.mk b/core/product.mk
index 5e943ce..1a0e8c6 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -120,9 +120,14 @@
PRODUCT_VERITY_SIGNING_KEY \
PRODUCT_SYSTEM_VERITY_PARTITION \
PRODUCT_VENDOR_VERITY_PARTITION \
+ PRODUCT_SYSTEM_SERVER_DEBUG_INFO \
PRODUCT_DEX_PREOPT_MODULE_CONFIGS \
PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \
PRODUCT_DEX_PREOPT_BOOT_FLAGS \
+ PRODUCT_DEX_PREOPT_PROFILE_DIR \
+ PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \
+ PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
+ PRODUCT_SYSTEM_SERVER_COMPILER_FILTER \
PRODUCT_SANITIZER_MODULE_CONFIGS \
PRODUCT_SYSTEM_BASE_FS_PATH \
PRODUCT_VENDOR_BASE_FS_PATH \
@@ -135,6 +140,8 @@
PRODUCT_IOT \
PRODUCT_SYSTEM_HEADROOM \
PRODUCT_MINIMIZE_JAVA_DEBUG_INFO \
+ PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS \
+ PRODUCT_COMPILE_WITH_JACK \
diff --git a/core/product_config.mk b/core/product_config.mk
index 71a342d..4194e00 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -380,6 +380,20 @@
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_DEFAULT_FLAGS))
PRODUCT_DEX_PREOPT_BOOT_FLAGS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_FLAGS))
+PRODUCT_DEX_PREOPT_PROFILE_DIR := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_PROFILE_DIR))
+
+# Boot image options.
+PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE))
+PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION))
+
+PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
+PRODUCT_SYSTEM_SERVER_DEBUG_INFO := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
+
# Resolve and setup per-module dex-preopt configs.
PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS))
@@ -431,3 +445,11 @@
# Whether to save disk space by minimizing java debug info
PRODUCT_MINIMIZE_JAVA_DEBUG_INFO := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))
+
+# Whether any paths are excluded from sanitization when SANITIZE_TARGET=integer_overflow
+PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
+
+# Temporarily force Jack back on for a product
+PRODUCT_COMPILE_WITH_JACK := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_COMPILE_WITH_JACK))
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 54a30ea..fea0465 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -34,7 +34,8 @@
echo ' "Make_suffix": "-$(TARGET_PRODUCT)",'; \
echo ''; \
echo ' "Platform_sdk_version": $(PLATFORM_SDK_VERSION),'; \
- echo ' "Platform_version_all_codenames": $(call csv_to_json_list,$(PLATFORM_VERSION_ALL_CODENAMES)),'; \
+ echo ' "Platform_version_active_codenames": $(call csv_to_json_list,$(PLATFORM_VERSION_ALL_CODENAMES)),'; \
+ echo ' "Platform_version_future_codenames": $(call csv_to_json_list,$(PLATFORM_VERSION_FUTURE_CODENAMES)),'; \
echo ' "Unbundled_build": $(if $(TARGET_BUILD_APPS),true,false),'; \
echo ' "Brillo": $(if $(BRILLO),true,false),'; \
echo ' "Malloc_not_svelte": $(if $(filter true,$(MALLOC_SVELTE)),false,true),'; \
@@ -79,6 +80,7 @@
echo ' "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \
echo ' "EnableCFI": $(if $(filter false,$(ENABLE_CFI)),false,true),'; \
+ echo ' "IntegerOverflowExcludePaths": $(call json_list,$(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS)),'; \
echo ' "Device_uses_hwc2": $(if $(filter true,$(TARGET_USES_HWC2)),true,false),'; \
echo ' "Override_rs_driver": "$(OVERRIDE_RS_DRIVER)",'; \
echo ' "Treble": $(if $(filter true,$(PRODUCT_FULL_TREBLE)),true,false),'; \
diff --git a/core/tasks/device-tests.mk b/core/tasks/device-tests.mk
index b1b936a..d679c59 100644
--- a/core/tasks/device-tests.mk
+++ b/core/tasks/device-tests.mk
@@ -17,11 +17,11 @@
device-tests-zip := $(PRODUCT_OUT)/device-tests.zip
$(device-tests-zip): $(COMPATIBILITY.device-tests.FILES) $(SOONG_ZIP)
- echo $(sort $(COMPATIBILITY.device-tests.FILES)) > $@.list
- sed -i -e 's/\s\+/\n/g' $@.list
+ echo $(sort $(COMPATIBILITY.device-tests.FILES)) | tr " " "\n" > $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
+ rm -f $@.list $@-host.list $@-target.list
device-tests: $(device-tests-zip)
$(call dist-for-goals, device-tests, $(device-tests-zip))
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index 763dd51..bf4eb1d 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -16,11 +16,11 @@
general-tests-zip := $(PRODUCT_OUT)/general-tests.zip
$(general-tests-zip): $(COMPATIBILITY.general-tests.FILES) $(SOONG_ZIP)
- echo $(sort $(COMPATIBILITY.general-tests.FILES)) > $@.list
- sed -i -e 's/\s\+/\n/g' $@.list
+ echo $(sort $(COMPATIBILITY.general-tests.FILES)) | tr " " "\n" > $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
+ rm -f $@.list $@-host.list $@-target.list
general-tests: $(general-tests-zip)
$(call dist-for-goals, general-tests, $(general-tests-zip))
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 610e0ce..e3bd47d 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -63,7 +63,7 @@
# Files copied in the system-image directory
files_to_copy += \
- $(addon_dir_img):$(BUILT_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \
+ $(addon_dir_img):$(INSTALLED_QEMU_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \
$(addon_dir_img):$(BUILT_USERDATAIMAGE_TARGET):images/$(TARGET_CPU_ABI)/userdata.img \
$(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \
$(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 5a89fc9..083e01b 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -129,14 +129,17 @@
PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION)
endif
- # This is all of the development codenames that are active. Should be either
- # the same as PLATFORM_VERSION_CODENAME or a comma-separated list of additional
- # codenames after PLATFORM_VERSION_CODENAME.
+ # This is all of the *active* development codenames. There are future
+ # codenames not included in this list. This confusing name is needed because
+ # all_codenames has been baked into build.prop for ages.
+ #
+ # Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated
+ # list of additional codenames after PLATFORM_VERSION_CODENAME.
PLATFORM_VERSION_ALL_CODENAMES :=
- # Build a list of all possible code names. Avoid duplicates, and stop when we
+ # Build a list of all active code names. Avoid duplicates, and stop when we
# reach a codename that matches PLATFORM_VERSION_CODENAME (anything beyond
- # that is not included in our build.
+ # that is not included in our build).
_versions_in_target := \
$(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
$(foreach version,$(_versions_in_target),\
@@ -144,9 +147,23 @@
$(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\
$(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename))))
+ # This is all of the inactive development codenames. Available to be targeted
+ # in this branch but in the future relative to our current target.
+ PLATFORM_VERSION_FUTURE_CODENAMES :=
+
+ # Build a list of all untargeted code names. Avoid duplicates.
+ _versions_not_in_target := \
+ $(filter-out $(PLATFORM_VERSION_ALL_CODENAMES),$(ALL_VERSIONS))
+ $(foreach version,$(_versions_not_in_target),\
+ $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\
+ $(if $(filter $(_codename),$(PLATFORM_VERSION_FUTURE_CODENAMES)),,\
+ $(eval PLATFORM_VERSION_FUTURE_CODENAMES += $(_codename))))
+
# And convert from space separated to comma separated.
PLATFORM_VERSION_ALL_CODENAMES := \
$(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES)))
+ PLATFORM_VERSION_FUTURE_CODENAMES := \
+ $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_FUTURE_CODENAMES)))
endif
@@ -212,7 +229,7 @@
BUILD_DATETIME := $(shell date +%s)
endif
-ifneq (,$(findstring Darwin,$(shell uname -sm)))
+ifneq (,$(findstring Darwin,$(UNAME)))
DATE := date -r $(BUILD_DATETIME)
else
DATE := date -d @$(BUILD_DATETIME)
diff --git a/envsetup.sh b/envsetup.sh
index d2bcd36..ae65832 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -248,13 +248,11 @@
export PATH=$ANDROID_BUILD_PATHS$PATH
export PYTHONPATH=$T/development/python-packages:$PYTHONPATH
- unset ANDROID_JAVA_TOOLCHAIN
- unset ANDROID_PRE_BUILD_PATHS
- if [ -n "$JAVA_HOME" ]; then
- export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
- export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN:
- export PATH=$ANDROID_PRE_BUILD_PATHS$PATH
- fi
+ export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME)
+ export JAVA_HOME=$ANDROID_JAVA_HOME
+ export ANDROID_JAVA_TOOLCHAIN=$(get_abs_build_var ANDROID_JAVA_TOOLCHAIN)
+ export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN:
+ export PATH=$ANDROID_PRE_BUILD_PATHS$PATH
unset ANDROID_PRODUCT_OUT
export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
@@ -287,7 +285,6 @@
function set_stuff_for_environment()
{
settitle
- set_java_home
setpaths
set_sequence_number
@@ -1528,46 +1525,6 @@
\cd $T/$pathname
}
-# Force JAVA_HOME to point to java 1.7/1.8 if it isn't already set.
-function set_java_home() {
- # Clear the existing JAVA_HOME value if we set it ourselves, so that
- # we can reset it later, depending on the version of java the build
- # system needs.
- #
- # If we don't do this, the JAVA_HOME value set by the first call to
- # build/envsetup.sh will persist forever.
- if [ -n "$ANDROID_SET_JAVA_HOME" ]; then
- export JAVA_HOME=""
- fi
-
- if [ ! "$JAVA_HOME" ]; then
- if [ -n "$LEGACY_USE_JAVA7" ]; then
- echo Warning: Support for JDK 7 will be dropped. Switch to JDK 8.
- case `uname -s` in
- Darwin)
- export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
- ;;
- *)
- export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
- ;;
- esac
- else
- case `uname -s` in
- Darwin)
- export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
- ;;
- *)
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
- ;;
- esac
- fi
-
- # Keep track of the fact that we set JAVA_HOME ourselves, so that
- # we can change it on the next envsetup.sh, if required.
- export ANDROID_SET_JAVA_HOME=true
- fi
-}
-
# Print colored exit condition
function pez {
"$@"
@@ -1585,6 +1542,13 @@
{
# If we're in the top of an Android tree, use soong_ui.bash instead of make
if [ -f build/soong/soong_ui.bash ]; then
+ # Always use the real make if -C is passed in
+ for arg in "$@"; do
+ if [[ $arg == -C* ]]; then
+ echo command make
+ return
+ fi
+ done
echo build/soong/soong_ui.bash --make-mode
else
echo command make
@@ -1631,7 +1595,7 @@
function make()
{
- _wrap_build $(get_make_command) "$@"
+ _wrap_build $(get_make_command "$@") "$@"
}
function provision()
diff --git a/target/Android.mk b/target/Android.mk
new file mode 100644
index 0000000..9929b00
--- /dev/null
+++ b/target/Android.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# Only if this Android.mk was included not by a symlink should it be used.
+# This facilitates the transition away from symlinks: b/64397960
+ifeq ($(LOCAL_PATH),build/make/target)
+include $(call first-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index ed259db..8bef7ab 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -41,6 +41,7 @@
# Build OpenGLES emulation guest and host libraries
BUILD_EMULATOR_OPENGL := true
+BUILD_QEMU_IMAGES := true
# Build and enable the OpenGL ES View renderer. When running on the emulator,
# the GLES renderer disables itself if host GL acceleration isn't available.
diff --git a/target/board/generic/sepolicy/goldfish_setup.te b/target/board/generic/sepolicy/goldfish_setup.te
index a863aa6..78d20fc 100644
--- a/target/board/generic/sepolicy/goldfish_setup.te
+++ b/target/board/generic/sepolicy/goldfish_setup.te
@@ -1,5 +1,5 @@
# goldfish-setup service: runs init.goldfish.sh script
-type goldfish_setup, domain, domain_deprecated;
+type goldfish_setup, domain;
type goldfish_setup_exec, exec_type, file_type;
init_daemon_domain(goldfish_setup)
diff --git a/target/board/generic/sepolicy/qemu_props.te b/target/board/generic/sepolicy/qemu_props.te
index 95174d6..d5571fd 100644
--- a/target/board/generic/sepolicy/qemu_props.te
+++ b/target/board/generic/sepolicy/qemu_props.te
@@ -1,5 +1,5 @@
# qemu-props service: Sets system properties on boot.
-type qemu_props, domain, domain_deprecated;
+type qemu_props, domain;
type qemu_props_exec, exec_type, file_type;
init_daemon_domain(qemu_props)
diff --git a/target/board/generic/sepolicy/qemud.te b/target/board/generic/sepolicy/qemud.te
index 797cf5c..eee21c4 100644
--- a/target/board/generic/sepolicy/qemud.te
+++ b/target/board/generic/sepolicy/qemud.te
@@ -1,5 +1,5 @@
# qemu support daemon
-type qemud, domain, domain_deprecated;
+type qemud, domain;
type qemud_exec, exec_type, file_type;
init_daemon_domain(qemud)
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 34fffed..ea4b05b 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -71,6 +71,7 @@
# Build OpenGLES emulation host and guest libraries
BUILD_EMULATOR_OPENGL := true
+BUILD_QEMU_IMAGES := true
# Build and enable the OpenGL ES View renderer. When running on the emulator,
# the GLES renderer disables itself if host GL acceleration isn't available.
diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk
index b68d88b..9ce8fce 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -48,6 +48,7 @@
# Build OpenGLES emulation guest and host libraries
BUILD_EMULATOR_OPENGL := true
+BUILD_QEMU_IMAGES := true
# Build and enable the OpenGL ES View renderer. When running on the emulator,
# the GLES renderer disables itself if host GL acceleration isn't available.
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
index 44e6287..0d15fe9 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -63,6 +63,7 @@
# Build OpenGLES emulation guest and host libraries
BUILD_EMULATOR_OPENGL := true
+BUILD_QEMU_IMAGES := true
# Build and enable the OpenGL ES View renderer. When running on the emulator,
# the GLES renderer disables itself if host GL acceleration isn't available.
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index f8ac496..34f955b 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -28,6 +28,10 @@
# Build OpenGLES emulation host and guest libraries
BUILD_EMULATOR_OPENGL := true
+# Build partitioned system.img and vendor.img (if applicable)
+# for qemu, otherwise, init cannot find PART_NAME
+BUILD_QEMU_IMAGES := true
+
# Build and enable the OpenGL ES View renderer. When running on the emulator,
# the GLES renderer disables itself if host GL acceleration isn't available.
USE_OPENGL_RENDERER := true
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index bd2f987..046cac9 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -33,6 +33,7 @@
# Build OpenGLES emulation host and guest libraries
BUILD_EMULATOR_OPENGL := true
+BUILD_QEMU_IMAGES := true
# Build and enable the OpenGL ES View renderer. When running on the emulator,
# the GLES renderer disables itself if host GL acceleration isn't available.
diff --git a/target/product/base.mk b/target/product/base.mk
index 62c1354..3f50731 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -144,5 +144,9 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/compiled-classes:system/etc/compiled-classes)
+# Note: it is acceptable to not have a dirty-image-objects file. In that case, the special bin
+# for known dirty objects in the image will be empty.
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
+ frameworks/base/dirty-image-objects:system/etc/dirty-image-objects)
$(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk)
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index da56d3a..58bd217 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -136,6 +136,10 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/compiled-classes-phone:system/etc/compiled-classes)
+# Enable dirty image object binning to reduce dirty pages in the image.
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
+ frameworks/base/dirty-image-objects-phone:system/etc/dirty-image-objects)
+
# On userdebug builds, collect more tombstones by default.
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
diff --git a/tools/Android.mk b/tools/Android.mk
index 9073ac3..c05d681 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -16,4 +16,8 @@
LOCAL_PATH := $(call my-dir)
+# Only if this Android.mk was included not by a symlink should it be used.
+# This facilitates the transition away from symlinks: b/64397960
+ifeq ($(LOCAL_PATH),build/make/tools)
include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 4ff4213..1ce22e7 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -376,7 +376,27 @@
args = OPTIONS.info_dict.get("avb_vbmeta_args")
if args and args.strip():
- cmd.extend(shlex.split(args))
+ split_args = shlex.split(args)
+ for index, arg in enumerate(split_args[:-1]):
+ # Sanity check that the image file exists. Some images might be defined
+ # as a path relative to source tree, which may not be available at the
+ # same location when running this script (we have the input target_files
+ # zip only). For such cases, we additionally scan other locations (e.g.
+ # IMAGES/, RADIO/, etc) before bailing out.
+ if arg == '--include_descriptors_from_image':
+ image_path = split_args[index + 1]
+ if os.path.exists(image_path):
+ continue
+ found = False
+ for dir in ['IMAGES', 'RADIO', 'VENDOR_IMAGES', 'PREBUILT_IMAGES']:
+ alt_path = os.path.join(
+ OPTIONS.input_tmp, dir, os.path.basename(image_path))
+ if os.path.exists(alt_path):
+ split_args[index + 1] = alt_path
+ found = True
+ break
+ assert found, 'failed to find %s' % (image_path,)
+ cmd.extend(split_args)
p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()