Merge "Enforce linker version-scripts are valid"
diff --git a/core/Makefile b/core/Makefile
index 67ad228..301e8b2 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1393,13 +1393,14 @@
$(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libdivsufsort$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libdivsufsort64$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2fs_host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2_blkid_host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2_com_err_host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2_e2p_host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2_profile_host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2_quota_host$(HOST_SHLIB_SUFFIX) \
- $(HOST_LIBRARY_PATH)/libext2_uuid_host$(HOST_SHLIB_SUFFIX)
+ $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX)
.PHONY: otatools
otatools: $(OTATOOLS)
@@ -1561,9 +1562,11 @@
$(hide) mkdir -p $(zip_root)/OTA
$(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
ifneq ($(AB_OTA_UPDATER),true)
+ifneq ($(built_ota_tools),)
$(hide) mkdir -p $(zip_root)/OTA/bin
$(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
endif
+endif
@# Files that do not end up in any images, but are necessary to
@# build them.
$(hide) mkdir -p $(zip_root)/META
diff --git a/core/binary.mk b/core/binary.mk
index a62423c..ddc4a1b 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -85,11 +85,16 @@
# The bionic linker now has support for packed relocations and gnu style
# hashes (which are much faster!), but shipping to older devices requires
- # the old style hash and disabling packed relocations.
- #ifeq ($(shell expr $(LOCAL_SDK_VERSION) >= FIRST_SUPPORTED_VERSION),0)
- my_ldflags += -Wl,--hash-style=sysv
- LOCAL_PACK_MODULE_RELOCATIONS := false
- #endif
+ # the old style hash. Fortunately, we can build with both and it'll work
+ # anywhere.
+ #
+ # This is not currently supported on MIPS architectures.
+ ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
+ my_ldflags += -Wl,--hash-style=both
+ endif
+
+ # We don't want to expose the relocation packer to the NDK just yet.
+ LOCAL_PACK_MODULE_RELOCATIONS := false
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
# See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -106,15 +111,16 @@
ifeq (,$(LOCAL_NDK_STL_VARIANT))
LOCAL_NDK_STL_VARIANT := system
endif
- ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
+ ifneq (1,$(words $(filter none system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
$(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
endif
ifeq (system,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
- # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
+ my_system_shared_libraries += libstdc++
else # LOCAL_NDK_STL_VARIANT is not system
ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
+ my_system_shared_libraries += libstdc++
ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_static.a
else
@@ -133,11 +139,14 @@
my_ndk_stl_shared_lib := -lc++_shared
endif
my_ndk_stl_cppflags := -std=c++11
- else
- # LOCAL_NDK_STL_VARIANT is gnustl_static
+ else # LOCAL_NDK_STL_VARIANT is not c++_* either
+ ifneq (,$(filter gnustl_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \
$(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/libgnustl_static.a
+ else # LOCAL_NDK_STL_VARIANT must be none
+ # Do nothing.
+ endif
endif
endif
endif
@@ -177,6 +186,11 @@
my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix))
my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix))
+my_missing_exclude_files := $(filter-out $(my_src_files),$(my_src_files_exclude))
+ifneq ($(my_missing_exclude_files),)
+$(warning Files are listed in LOCAL_SRC_FILES_EXCLUDE but not LOCAL_SRC_FILES)
+$(error $(my_missing_exclude_files))
+endif
my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files))
my_clang := $(strip $(LOCAL_CLANG))
@@ -195,11 +209,13 @@
my_clang := true
endif
endif
-# Add option to make clang the default for device build
-else ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
+# Add option to make gcc the default for device build
+else ifeq ($(USE_CLANG_PLATFORM_BUILD),false)
ifeq ($(my_clang),)
- my_clang := true
+ my_clang := false
endif
+else ifeq ($(my_clang),)
+ my_clang := true
endif
my_cpp_std_version := -std=gnu++14
diff --git a/core/config.mk b/core/config.mk
index 930e82b..450c06c 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -444,6 +444,45 @@
endif
endif
+#
+# Tools that are prebuilts for TARGET_BUILD_APPS
+#
+
+ACP := $(HOST_OUT_EXECUTABLES)/acp
+AIDL := $(HOST_OUT_EXECUTABLES)/aidl
+AAPT := $(HOST_OUT_EXECUTABLES)/aapt
+ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign
+SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
+SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
+LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc
+BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat
+
+DX := $(HOST_OUT_EXECUTABLES)/dx
+MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
+
+# Override the definitions above for unbundled and PDK builds
+ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
+prebuilt_sdk_tools := prebuilts/sdk/tools
+prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
+
+ACP := $(prebuilt_sdk_tools_bin)/acp
+AIDL := $(prebuilt_sdk_tools_bin)/aidl
+AAPT := $(prebuilt_sdk_tools_bin)/aapt
+ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign
+SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
+# Use 64-bit libraries unconditionally because 32-bit JVMs are no longer supported
+SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
+
+DX := $(prebuilt_sdk_tools)/dx
+MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
+
+# Don't use prebuilts in PDK
+ifneq ($(TARGET_BUILD_PDK),true)
+LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc
+BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat
+endif # TARGET_BUILD_PDK
+endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK
+
# ---------------------------------------------------------------
# Generic tools.
@@ -463,8 +502,6 @@
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
DOXYGEN:= doxygen
-AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
-AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
AIDL_CPP := $(HOST_OUT_EXECUTABLES)/aidl-cpp$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(HOST_OS),linux)
BREAKPAD_DUMP_SYMS := $(HOST_OUT_EXECUTABLES)/dump_syms
@@ -474,7 +511,6 @@
endif
PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
DBUS_GENERATOR := $(HOST_OUT_EXECUTABLES)/dbus-binding-generator
-SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
@@ -519,8 +555,6 @@
JILL := java -Xmx3500m -jar $(JILL_JAR)
PROGUARD := external/proguard/bin/proguard.sh
JAVATAGS := build/tools/java-event-log-tags.py
-LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
-BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX)
RMTYPEDEFS := $(HOST_OUT_EXECUTABLES)/rmtypedefs
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
@@ -530,13 +564,6 @@
VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh
FEC := $(HOST_OUT_EXECUTABLES)/fec
-# ACP is always for the build OS, not for the host OS
-ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)
-
-# dx is java behind a shell script; no .exe necessary.
-DX := $(HOST_OUT_EXECUTABLES)/dx
-MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
-ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
ifndef TARGET_BUILD_APPS
ZIPTIME := $(HOST_OUT_EXECUTABLES)/ziptime$(HOST_EXECUTABLE_SUFFIX)
endif
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk
index be8a711..37be1f7 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -104,9 +104,6 @@
endif
else ifeq ($(my_cxx_stl),ndk)
# Using an NDK STL. Handled in binary.mk.
- ifndef LOCAL_IS_HOST_MODULE
- my_system_shared_libraries += libstdc++
- endif
else ifeq ($(my_cxx_stl),libstdc++)
# Using bionic's basic libstdc++. Not actually an STL. Only around until the
# tree is in good enough shape to not need it.
diff --git a/core/definitions.mk b/core/definitions.mk
index 89ffcf7..5119d65 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1960,7 +1960,7 @@
## Define a rule which generates .jar.toc and mark it as .KATI_RESTAT.
define define-jar-to-toc-rule
-$(eval $(call _transform-jar-to-toc,$1))
+$(eval $(call _transform-jar-to-toc,$1))\
$(eval .KATI_RESTAT: $1.toc)
endef
@@ -2165,7 +2165,7 @@
#
define sign-package
$(hide) mv $@ $@.unsigned
-$(hide) java -jar $(SIGNAPK_JAR) \
+$(hide) java -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) -jar $(SIGNAPK_JAR) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) \
$(PRIVATE_ADDITIONAL_CERTIFICATES) $@.unsigned $@.signed
$(hide) mv $@.signed $@
diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk
index 5d0b5bf..b2a3d64 100644
--- a/core/dpi_specific_apk.mk
+++ b/core/dpi_specific_apk.mk
@@ -48,7 +48,7 @@
$(built_dpi_apk) : $(R_file_stamp)
$(built_dpi_apk) : $(all_library_res_package_export_deps)
$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
-$(built_dpi_apk) : $(AAPT) | $(ZIPALIGN)
+$(built_dpi_apk) : $(AAPT)
$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
$(if $(PRIVATE_SOURCE_ARCHIVE),\
@@ -68,7 +68,6 @@
endif
endif
$(sign-package)
- $(align-package)
# Set up global variables to register this apk to the higher-level dependency graph.
ALL_MODULES += $(dpi_apk_name)
diff --git a/core/java_common.mk b/core/java_common.mk
index b7f07ab..6694f16 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -133,17 +133,23 @@
# be up-to-date.
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SDK_VERSION),)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart)
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
+my_bootclasspath := ""
+else # LOCAL_NO_STANDARD_LIBRARIES
+my_bootclasspath := $(call java-lib-files,core-libart)
+endif # LOCAL_NO_STANDARD_LIBRARIES
else
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current)
+my_bootclasspath := $(call java-lib-files,android_stubs_current)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_system_stubs_current)
+my_bootclasspath := $(call java-lib-files,android_system_stubs_current)
else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
+my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
endif # current or system_current
endif # LOCAL_SDK_VERSION
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
@@ -152,7 +158,12 @@
else # LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+my_bootclasspath := ""
+else
+my_bootclasspath := $(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) \
@@ -263,17 +274,22 @@
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SDK_VERSION),)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,core-libart)
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+my_bootclasspath :=
else
+my_bootclasspath := $(call jack-lib-files,core-libart)
+endif
+else # LOCAL_SDK_VERSION
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,android_stubs_current)
+my_bootclasspath := $(call jack-lib-files,android_stubs_current)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,android_system_stubs_current)
+my_bootclasspath := $(call jack-lib-files,android_system_stubs_current)
else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION))
+my_bootclasspath :=$(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION))
endif # current or system_current
endif # LOCAL_SDK_VERSION
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath)
full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
@@ -281,7 +297,12 @@
else # LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+my_bootclasspath :=
+else
+my_bootclasspath := $(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
+endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath)
full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
else
diff --git a/core/package_internal.mk b/core/package_internal.mk
index cb77e76..f5a00e5 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -390,7 +390,7 @@
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
# Define the rule to build the actual package.
-$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
+$(LOCAL_BUILT_MODULE): $(AAPT)
# PRIVATE_JNI_SHARED_LIBRARIES is a list of <abi>:<path_of_built_lib>.
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
# PRIVATE_JNI_SHARED_LIBRARIES_ABI is a list of ABI names.
@@ -439,8 +439,6 @@
endif
endif
$(sign-package)
- @# Alignment must happen after all other zip operations.
- $(align-package)
###############################
## Build dpi-specific apks, if it's apps_only build.
@@ -475,7 +473,7 @@
installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
# The splits should have been built in the same command building the base apk.
-# This rule just runs signing and zipalign etc.
+# This rule just runs signing.
# Note that we explicily check the existence of the split apk and remove the
# built base apk if the split apk isn't there.
# That way the build system will rerun the aapt after the user changes the splitting parameters.
@@ -487,7 +485,6 @@
rm $<; exit 1; \
fi
$(sign-package)
- $(align-package)
# Rules to install the splits
$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(built_module_path)/package_%.apk | $(ACP)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index aec08ed..9ff348c 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -224,8 +224,10 @@
endif
endif
$(sign-package)
-endif
+ # No need for align-package because sign-package takes care of alignment
+else
$(align-package)
+endif
###############################
## Rule to build the odex file
@@ -241,7 +243,7 @@
built_apk_splits := $(addprefix $(built_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS)))
installed_apk_splits := $(addprefix $(my_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS)))
-# Rules to sign and zipalign the split apks.
+# Rules to sign the split apks.
my_src_dir := $(sort $(dir $(LOCAL_PACKAGE_SPLITS)))
ifneq (1,$(words $(my_src_dir)))
$(error You must put all the split source apks in the same folder: $(LOCAL_PACKAGE_SPLITS))
@@ -253,7 +255,6 @@
$(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(ACP)
$(copy-file-to-new-target)
$(sign-package)
- $(align-package)
# Rules to install the split apks.
$(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk | $(ACP)
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index dcc1e18..d035036 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -43,7 +43,7 @@
# which is the version that we reveal to the end user.
# Update this value when the platform version changes (rather
# than overriding it somewhere else). Can be an arbitrary string.
- PLATFORM_VERSION := 6.0
+ PLATFORM_VERSION := 6.0.1
endif
ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -104,7 +104,7 @@
# Can be an arbitrary string, but must be a single word.
#
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2015-10-01
+ PLATFORM_SECURITY_PATCH := 2015-12-01
endif
ifeq "" "$(PLATFORM_BASE_OS)"
diff --git a/target/board/generic/sepolicy/file_contexts b/target/board/generic/sepolicy/file_contexts
index e626d9d..e704a8e 100644
--- a/target/board/generic/sepolicy/file_contexts
+++ b/target/board/generic/sepolicy/file_contexts
@@ -7,6 +7,6 @@
/dev/ttyGF[0-9]* u:object_r:serial_device:s0
/dev/ttyS2 u:object_r:console_device:s0
/system/bin/qemud u:object_r:qemud_exec:s0
-/sys/qemu_trace(/.*)? -- u:object_r:sysfs_writable:s0
+/sys/qemu_trace(/.*)? u:object_r:sysfs_writable:s0
/system/etc/init.goldfish.sh u:object_r:goldfish_setup_exec:s0
/system/bin/qemu-props u:object_r:qemu_props_exec:s0
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 0f92a1c..2428585 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -38,6 +38,7 @@
libFFTEm \
libGLESv1_CM \
libGLESv2 \
+ libGLESv3 \
libbinder \
libc \
libcutils \
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index 3a3a9a3..47c2992 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -353,7 +353,7 @@
<tr>
<!-- blank TD from Windows rowspan -->
<td>
- <a onclick="return onDownload(this,false,true)"
+ <a onclick="return onDownload(this,false,true)" id="win-bundle-notools"
href="https://dl.google.com/dl/android/studio/install/<?cs var:studio.version ?>/<?cs var:studio.win_notools_exe_download ?>"
><?cs var:studio.win_notools_exe_download ?></a><br>(No SDK tools included)
</td>
@@ -364,7 +364,7 @@
<tr>
<!-- blank TD from Windows rowspan -->
<td>
- <a onclick="return onDownload(this,false,true)"
+ <a onclick="return onDownload(this,false,true)" id="win-bundle-zip"
href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_download ?>"
><?cs var:studio.win_bundle_download ?></a>
</td>
diff --git a/tools/ijar/Android.mk b/tools/ijar/Android.mk
index 36f000c..8b2a02c 100644
--- a/tools/ijar/Android.mk
+++ b/tools/ijar/Android.mk
@@ -8,7 +8,7 @@
include $(CLEAR_VARS)
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := classfile.cc ijar.cc zip.cc
-LOCAL_CFLAGS += -Wall
+LOCAL_CFLAGS += -Wall -Werror
LOCAL_SHARED_LIBRARIES := libz-host
LOCAL_MODULE := ijar
# libc++ is not supported for TARGET_BUILD_APPS builds
diff --git a/tools/ijar/classfile.cc b/tools/ijar/classfile.cc
index 5d12cc2..e0cf42e 100644
--- a/tools/ijar/classfile.cc
+++ b/tools/ijar/classfile.cc
@@ -483,12 +483,12 @@
// We keep an entry if the constant referring to the inner class is already
// kept. Then we mark its outer class and its class name as kept, too, then
// iterate until a fixed point is reached.
- int entry_count;
+ size_t entry_count;
int iteration = 0;
do {
entry_count = kept_entries.size();
- for (int i_entry = 0; i_entry < entries_.size(); ++i_entry) {
+ for (size_t i_entry = 0; i_entry < entries_.size(); ++i_entry) {
Entry* entry = entries_[i_entry];
if (entry->inner_class_info->Kept() ||
used_class_names.find(entry->inner_class_info->Display())
@@ -632,7 +632,7 @@
}
virtual void ExtractClassNames() {
- for (int i = 0; i < values_.size(); i++) {
+ for (size_t i = 0; i < values_.size(); i++) {
values_[i]->ExtractClassNames();
}
}
@@ -800,8 +800,8 @@
};
struct EmptyInfo : TargetInfo {
- void Write(u1 *&p) {}
- static EmptyInfo *Read(const u1 *&p) {
+ void Write(u1 *&) {}
+ static EmptyInfo *Read(const u1 *&) {
return new EmptyInfo;
}
};
@@ -1007,7 +1007,7 @@
// compiler to generate warning messages.
struct DeprecatedAttribute : Attribute {
- static DeprecatedAttribute* Read(const u1 *&p, Constant *attribute_name) {
+ static DeprecatedAttribute* Read(const u1 *&, Constant *attribute_name) {
DeprecatedAttribute *attr = new DeprecatedAttribute;
attr->attribute_name_ = attribute_name;
return attr;
@@ -1041,7 +1041,7 @@
}
virtual void ExtractClassNames() {
- for (int i = 0; i < annotations_.size(); i++) {
+ for (size_t i = 0; i < annotations_.size(); i++) {
annotations_[i]->ExtractClassNames();
}
}
@@ -1112,7 +1112,7 @@
// and RuntimeInvisibleTypeAnnotations.
struct TypeAnnotationsAttribute : Attribute {
static TypeAnnotationsAttribute* Read(const u1 *&p, Constant *attribute_name,
- u4 attribute_length) {
+ u4) {
auto attr = new TypeAnnotationsAttribute;
attr->attribute_name_ = attribute_name;
u2 num_annotations = get_u2be(p);
@@ -1124,7 +1124,7 @@
}
virtual void ExtractClassNames() {
- for (int i = 0; i < type_annotations_.size(); i++) {
+ for (size_t i = 0; i < type_annotations_.size(); i++) {
type_annotations_[i]->ExtractClassNames();
}
}
@@ -1181,7 +1181,7 @@
}
void ExtractClassNames() {
- for (int i = 0; i < attributes.size(); i++) {
+ for (size_t i = 0; i < attributes.size(); i++) {
attributes[i]->ExtractClassNames();
}
}
@@ -1739,7 +1739,7 @@
members.insert(members.end(), fields.begin(), fields.end());
members.insert(members.end(), methods.begin(), methods.end());
ExtractClassNames();
- for (int i = 0; i < members.size(); i++) {
+ for (size_t i = 0; i < members.size(); i++) {
Member *member = members[i];
size_t idx = 0;
devtools_ijar::ExtractClassNames(member->descriptor->Display(), &idx);
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 2c8bbc6..ee0cdf9 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -44,6 +44,7 @@
self.search_path = platform_search_path.get(sys.platform, None)
self.signapk_path = "framework/signapk.jar" # Relative to search_path
+ self.signapk_shared_library_path = "lib64" # Relative to search_path
self.extra_signapk_args = []
self.java_path = "java" # Use the one on the path by default.
self.java_args = "-Xmx2048m" # JVM Args
@@ -588,37 +589,29 @@
return key_passwords
-def SignFile(input_name, output_name, key, password, align=None,
- whole_file=False):
+def SignFile(input_name, output_name, key, password, whole_file=False):
"""Sign the input_name zip/jar/apk, producing output_name. Use the
given key and password (the latter may be None if the key does not
have a password.
- If align is an integer > 1, zipalign is run to align stored files in
- the output zip on 'align'-byte boundaries.
-
If whole_file is true, use the "-w" option to SignApk to embed a
signature that covers the whole file in the archive comment of the
zip file.
"""
- if align == 0 or align == 1:
- align = None
+ java_library_path = os.path.join(
+ OPTIONS.search_path, OPTIONS.signapk_shared_library_path)
- if align:
- temp = tempfile.NamedTemporaryFile()
- sign_name = temp.name
- else:
- sign_name = output_name
-
- cmd = [OPTIONS.java_path, OPTIONS.java_args, "-jar",
+ cmd = [OPTIONS.java_path, OPTIONS.java_args,
+ "-Djava.library.path=" + java_library_path,
+ "-jar",
os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)]
cmd.extend(OPTIONS.extra_signapk_args)
if whole_file:
cmd.append("-w")
cmd.extend([key + OPTIONS.public_key_suffix,
key + OPTIONS.private_key_suffix,
- input_name, sign_name])
+ input_name, output_name])
p = Run(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
if password is not None:
@@ -627,13 +620,6 @@
if p.returncode != 0:
raise ExternalError("signapk.jar failed: return code %s" % (p.returncode,))
- if align:
- p = Run(["zipalign", "-f", "-p", str(align), sign_name, output_name])
- p.communicate()
- if p.returncode != 0:
- raise ExternalError("zipalign failed: return code %s" % (p.returncode,))
- temp.close()
-
def CheckSize(data, target, info_dict):
"""Check the data string passed against the max size limit, if
@@ -738,7 +724,8 @@
try:
opts, args = getopt.getopt(
argv, "hvp:s:x:" + extra_opts,
- ["help", "verbose", "path=", "signapk_path=", "extra_signapk_args=",
+ ["help", "verbose", "path=", "signapk_path=",
+ "signapk_shared_library_path=", "extra_signapk_args=",
"java_path=", "java_args=", "public_key_suffix=",
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
"verity_signer_path=", "verity_signer_args=", "device_specific=",
@@ -759,6 +746,8 @@
OPTIONS.search_path = a
elif o in ("--signapk_path",):
OPTIONS.signapk_path = a
+ elif o in ("--signapk_shared_library_path",):
+ OPTIONS.signapk_shared_library_path = a
elif o in ("--extra_signapk_args",):
OPTIONS.extra_signapk_args = shlex.split(a)
elif o in ("--java_path",):
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index cbf78a1..baf60f5 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -134,7 +134,7 @@
signed = tempfile.NamedTemporaryFile()
- common.SignFile(unsigned.name, signed.name, keyname, pw, align=4)
+ common.SignFile(unsigned.name, signed.name, keyname, pw)
data = signed.read()
unsigned.close()
diff --git a/tools/signapk/Android.mk b/tools/signapk/Android.mk
index 620ccb1..da1501b 100644
--- a/tools/signapk/Android.mk
+++ b/tools/signapk/Android.mk
@@ -21,11 +21,16 @@
LOCAL_MODULE := signapk
LOCAL_SRC_FILES := SignApk.java
LOCAL_JAR_MANIFEST := SignApk.mf
-LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-host bouncycastle-bcpkix-host
+LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-host bouncycastle-bcpkix-host conscrypt-host
+LOCAL_REQUIRED_MODULES := libconscrypt_openjdk_jni
include $(BUILD_HOST_JAVA_LIBRARY)
ifeq ($(TARGET_BUILD_APPS),)
-# The post-build signing tools need signapk.jar, but we don't
-# need this if we're just doing unbundled apps.
-$(call dist-for-goals,droidcore,$(LOCAL_INSTALLED_MODULE))
+# The post-build signing tools need signapk.jar and its shared libraries,
+# but we don't need this if we're just doing unbundled apps.
+my_dist_files := $(LOCAL_INSTALLED_MODULE) \
+ $(HOST_OUT_SHARED_LIBRARIES)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX)
+
+$(call dist-for-goals,droidcore,$(my_dist_files))
+my_dist_files :=
endif
diff --git a/tools/signapk/SignApk.java b/tools/signapk/SignApk.java
index 740a343..5afb8d1 100644
--- a/tools/signapk/SignApk.java
+++ b/tools/signapk/SignApk.java
@@ -34,6 +34,7 @@
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder;
import org.bouncycastle.util.encoders.Base64;
+import org.conscrypt.OpenSSLProvider;
import java.io.Console;
import java.io.BufferedReader;
@@ -110,8 +111,6 @@
private static final String OTACERT_NAME = "META-INF/com/android/otacert";
- private static Provider sBouncyCastleProvider;
-
// bitmasks for which hash algorithms we need the manifest to include.
private static final int USE_SHA1 = 1;
private static final int USE_SHA256 = 2;
@@ -451,12 +450,10 @@
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
ContentSigner signer = new JcaContentSignerBuilder(getSignatureAlgorithm(publicKey))
- .setProvider(sBouncyCastleProvider)
.build(privateKey);
gen.addSignerInfoGenerator(
new JcaSignerInfoGeneratorBuilder(
new JcaDigestCalculatorProviderBuilder()
- .setProvider(sBouncyCastleProvider)
.build())
.setDirectSignature(true)
.build(signer, publicKey));
@@ -476,7 +473,7 @@
* more efficient.
*/
private static void copyFiles(Manifest manifest, JarFile in, JarOutputStream out,
- long timestamp, int alignment) throws IOException {
+ long timestamp, int defaultAlignment) throws IOException {
byte[] buffer = new byte[4096];
int num;
@@ -515,6 +512,7 @@
offset += 4;
firstEntry = false;
}
+ int alignment = getStoredEntryDataAlignment(name, defaultAlignment);
if (alignment > 0 && (offset % alignment != 0)) {
// Set the "extra data" of the entry to between 1 and
// alignment-1 bytes, to make the file data begin at
@@ -555,6 +553,24 @@
}
}
+ /**
+ * Returns the multiple (in bytes) at which the provided {@code STORED} entry's data must start
+ * relative to start of file or {@code 0} if alignment of this entry's data is not important.
+ */
+ private static int getStoredEntryDataAlignment(String entryName, int defaultAlignment) {
+ if (defaultAlignment <= 0) {
+ return 0;
+ }
+
+ if (entryName.endsWith(".so")) {
+ // Align .so contents to memory page boundary to enable memory-mapped
+ // execution.
+ return 4096;
+ } else {
+ return defaultAlignment;
+ }
+ }
+
private static class WholeFileSignerOutputStream extends FilterOutputStream {
private boolean closing = false;
private ByteArrayOutputStream footer = new ByteArrayOutputStream();
@@ -860,8 +876,13 @@
public static void main(String[] args) {
if (args.length < 4) usage();
- sBouncyCastleProvider = new BouncyCastleProvider();
- Security.addProvider(sBouncyCastleProvider);
+ // Install Conscrypt as the highest-priority provider. Its crypto primitives are faster than
+ // the standard or Bouncy Castle ones.
+ Security.insertProviderAt(new OpenSSLProvider(), 1);
+ // Install Bouncy Castle (as the lowest-priority provider) because Conscrypt does not offer
+ // DSA which may still be needed.
+ // TODO: Stop installing Bouncy Castle provider once DSA is no longer needed.
+ Security.addProvider(new BouncyCastleProvider());
boolean signWholeFile = false;
String providerClass = null;