Merge "Use repeatable timestamps"
diff --git a/core/Makefile b/core/Makefile
index 45ac5c2..2f75568 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -696,7 +696,7 @@
INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
endif
-SELINUX_FC := $(TARGET_ROOT_OUT)/file_contexts
+SELINUX_FC := $(TARGET_ROOT_OUT)/file_contexts.bin
INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
# $(1): the path of the output dictionary file
@@ -1484,7 +1484,7 @@
$(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
$(hide) if test -e $(tool_extensions)/releasetools.py; then $(ACP) $(tool_extensions)/releasetools.py $(zip_root)/META/; fi
$(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
- $(hide) $(ACP) $(SELINUX_FC) $(zip_root)/META/file_contexts
+ $(hide) $(ACP) $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
$(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
$(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
ifdef BOARD_FLASH_BLOCK_SIZE
diff --git a/core/binary.mk b/core/binary.mk
index c716b17..3a167f0 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -206,8 +206,6 @@
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
-my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
-
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
# Add static HAL libraries
@@ -461,6 +459,20 @@
RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
renderscript_intermediate := $(intermediates)/renderscript
+renderscript_target_api :=
+
+ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
+renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+else
+ifneq (,$(LOCAL_SDK_VERSION))
+# Set target-api for LOCAL_SDK_VERSIONs other than current.
+ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
+renderscript_target_api := $(LOCAL_SDK_VERSION)
+endif
+endif # LOCAL_SDK_VERSION is set
+endif # LOCAL_RENDERSCRIPT_TARGET_API is set
+
+
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
endif
@@ -489,6 +501,7 @@
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
+$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
$(transform-renderscripts-to-cpp-and-bc)
@@ -1125,6 +1138,15 @@
my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags))
endif
+# No one should ever use this flag. On GCC it's mere presence will disable all
+# warnings, even those that are specified after it (contrary to typical warning
+# flag behavior). This circumvents CFLAGS_NO_OVERRIDE from forcibly enabling the
+# warnings that are *always* bugs.
+my_illegal_flags := -w
+my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags))
+my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags))
+my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags))
+
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)
diff --git a/core/clang/arm.mk b/core/clang/arm.mk
index bf31f51..6b3d7c1 100644
--- a/core/clang/arm.mk
+++ b/core/clang/arm.mk
@@ -7,7 +7,7 @@
ifneq (,$(filter krait,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
# Android's clang support's krait as a CPU whereas GCC doesn't. Specify
# -mcpu here rather than the more normal core/combo/arch/arm/armv7-a-neon.mk.
- CLANG_CONFIG_arm_EXTRA_CFLAGS += -mcpu=krait
+ CLANG_CONFIG_arm_EXTRA_CFLAGS += -mcpu=krait -mfpu=neon-vfpv4
endif
ifeq ($(HOST_OS),darwin)
diff --git a/core/config.mk b/core/config.mk
index be2340c..8cd42ca 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -85,6 +85,8 @@
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk
BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
+BUILD_FUZZ_TEST := $(BUILD_SYSTEM)/fuzz_test.mk
+BUILD_HOST_FUZZ_TEST := $(BUILD_SYSTEM)/host_fuzz_test.mk
BUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mk
BUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mk
@@ -612,7 +614,7 @@
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
- TARGET_DEFAULT_JAVA_LIBRARIES := core-libart core-junit ext framework
+ TARGET_DEFAULT_JAVA_LIBRARIES := core-libart core-junit ext framework okhttp
endif
# Flags for DEX2OAT
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 41956cb..8d285b1 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -82,7 +82,7 @@
ifdef LOCAL_IS_HOST_MODULE
my_cflags += -fno-sanitize-recover=all
my_ldflags += -fsanitize=$(fsanitize_arg)
- my_ldlibs += -ldl
+ my_ldlibs += -lrt -ldl
else
my_cflags += -fsanitize-undefined-trap-on-error
my_cflags += -ftrap-function=abort
@@ -108,7 +108,10 @@
$(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
my_ldflags += -Wl,-rpath,$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RPATH)
+
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
+ # Make sure linker_asan get installed.
+ $(LOCAL_INSTALLED_MODULE) : | $(PRODUCT_OUT)$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
endif
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index f20b2b7..35e3a79 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -903,6 +903,7 @@
-d $(PRIVATE_RS_OUTPUT_DIR) \
-a $@ -MD \
-reflect-c++ \
+ $(addprefix -target-api , $(PRIVATE_RS_TARGET_API)) \
$(PRIVATE_RS_FLAGS) \
$(addprefix -I , $(PRIVATE_RS_INCLUDES)) \
$(PRIVATE_RS_SOURCE_FILES)
diff --git a/core/fuzz_test.mk b/core/fuzz_test.mk
new file mode 100644
index 0000000..065cc03
--- /dev/null
+++ b/core/fuzz_test.mk
@@ -0,0 +1,34 @@
+###########################################
+## A thin wrapper around BUILD_EXECUTABLE
+## Common flags for fuzz tests are added.
+###########################################
+
+ifdef LOCAL_SDK_VERSION
+ $(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.)
+endif
+
+LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters
+LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
+
+ifdef LOCAL_MODULE_PATH
+$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))
+endif
+
+ifdef LOCAL_MODULE_PATH_32
+$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE))
+endif
+
+ifdef LOCAL_MODULE_PATH_64
+$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE))
+endif
+
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+
+ifndef LOCAL_MULTILIB
+ifndef LOCAL_32_BIT_ONLY
+LOCAL_MULTILIB := both
+endif
+endif
+
+include $(BUILD_EXECUTABLE)
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
new file mode 100644
index 0000000..e917959
--- /dev/null
+++ b/core/host_fuzz_test.mk
@@ -0,0 +1,9 @@
+################################################
+## A thin wrapper around BUILD_HOST_EXECUTABLE
+## Common flags for host fuzz tests are added.
+################################################
+
+LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters
+LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
+
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c
index 855a565..dfa9426 100644
--- a/libs/host/CopyFile.c
+++ b/libs/host/CopyFile.c
@@ -24,11 +24,8 @@
#include <errno.h>
#include <assert.h>
-#ifdef HAVE_MS_C_RUNTIME
-# define mkdir(path,mode) _mkdir(path)
-#endif
-
#if defined(_WIN32)
+# define mkdir(path,mode) _mkdir(path)
# define S_ISLNK(s) 0
# define lstat stat
# ifndef EACCESS /* seems to be missing from the Mingw headers */
@@ -183,7 +180,7 @@
DBUG(("--- unable to set perms on '%s' to 0%o: %s\n",
dst, pSrcStat->st_mode & ~(S_IFMT), strerror(errno)));
}
-#ifndef HAVE_MS_C_RUNTIME
+#ifndef _WIN32
/*
* Set the owner.
*/
@@ -261,7 +258,7 @@
/* if "force" is set, try removing the destination file and retry */
if (options & COPY_FORCE) {
if (unlink(dst) != 0) {
-#ifdef HAVE_MS_C_RUNTIME
+#ifdef _WIN32
/* MSVCRT.DLL unlink will fail with EACCESS if the file is set read-only */
/* so try to change its mode, and unlink again */
if (errno == EACCESS) {
@@ -274,7 +271,7 @@
(void) close(srcFd);
return -1;
}
-#ifdef HAVE_MS_C_RUNTIME
+#ifdef _WIN32
Open_File:
#endif
dstFd = open(dst, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0644);
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index c40de4f..468fbe5 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -75,7 +75,7 @@
# SELinux packages
PRODUCT_PACKAGES += \
sepolicy \
- file_contexts \
+ file_contexts.bin \
seapp_contexts \
property_contexts \
mac_permissions.xml \
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index a32c6b1..e042e03 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -350,6 +350,12 @@
mapped_stashes.append(sr)
if self.version == 2:
src_str.append("%d:%s" % (sid, sr.to_string_raw()))
+ # A stash will be used only once. We need to free the stash
+ # immediately after the use, instead of waiting for the automatic
+ # clean-up at the end. Because otherwise it may take up extra space
+ # and lead to OTA failures.
+ # Bug: 23119955
+ free_string.append("free %d\n" % (sid,))
else:
assert sh in stashes
src_str.append("%s:%s" % (sh, sr.to_string_raw()))
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 051a22d..d56c0fd 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -154,16 +154,16 @@
# are doing repacking. Redirect those properties to the actual files in the
# unzipped directory.
if input_dir is not None:
- # We carry a copy of file_contexts under META/. If not available, search
- # BOOT/RAMDISK/. Note that sometimes we may need a different file_contexts
+ # We carry a copy of file_contexts.bin under META/. If not available,
+ # search BOOT/RAMDISK/. Note that sometimes we may need a different file
# to build images than the one running on device, such as when enabling
# system_root_image. In that case, we must have the one for image
# generation copied to META/.
- fc_config = os.path.join(input_dir, "META", "file_contexts")
+ fc_config = os.path.join(input_dir, "META", "file_contexts.bin")
if d.get("system_root_image") == "true":
assert os.path.exists(fc_config)
if not os.path.exists(fc_config):
- fc_config = os.path.join(input_dir, "BOOT", "RAMDISK", "file_contexts")
+ fc_config = os.path.join(input_dir, "BOOT", "RAMDISK", "file_contexts.bin")
if not os.path.exists(fc_config):
fc_config = None
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index e40d06a..c074f10 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -42,6 +42,10 @@
radio image. This option is only meaningful when -i is specified,
because a full radio is always included in a full OTA if applicable.
+ --full_bootloader
+ Similar to --full_radio. When generating an incremental OTA, always
+ include a full copy of bootloader image.
+
-v (--verify)
Remount and verify the checksums of the files written to the
system and vendor (if used) partitions. Incremental builds only.
@@ -125,6 +129,7 @@
OPTIONS.oem_source = None
OPTIONS.fallback_to_full = True
OPTIONS.full_radio = False
+OPTIONS.full_bootloader = False
def MostPopularKey(d, default):
@@ -585,8 +590,8 @@
if HasVendorPartition(input_zip):
system_progress -= 0.1
- # Place a copy of file_contexts into the OTA package which will be used by
- # the recovery program.
+ # Place a copy of file_contexts.bin into the OTA package which will be used
+ # by the recovery program.
if "selinux_fc" in OPTIONS.info_dict:
WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
@@ -1479,6 +1484,8 @@
OPTIONS.incremental_source = a
elif o == "--full_radio":
OPTIONS.full_radio = True
+ elif o == "--full_bootloader":
+ OPTIONS.full_bootloader = True
elif o in ("-w", "--wipe_user_data"):
OPTIONS.wipe_user_data = True
elif o in ("-n", "--no_prereq"):
@@ -1527,6 +1534,7 @@
"package_key=",
"incremental_from=",
"full_radio",
+ "full_bootloader",
"wipe_user_data",
"no_prereq",
"extra_script=",