Merge "Update binary name to "brotli"."
diff --git a/core/Makefile b/core/Makefile
index 8602a80..5bc6322 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2088,6 +2088,7 @@
ifeq ($(build_ota_package),true)
OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_EXECUTABLES)/aapt \
+ $(HOST_OUT_EXECUTABLES)/checkvintf \
$(HOST_OUT_EXECUTABLES)/mkbootfs \
$(HOST_OUT_EXECUTABLES)/mkbootimg \
$(HOST_OUT_EXECUTABLES)/fs_config \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index a5ba75b..b501fbd 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -138,7 +138,7 @@
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
-$(call pretty-warning,unusual tags $(my_module_tags))
+$(call pretty-error,unusual tags: $(filter-out debug eng tests optional samples,$(my_module_tags)))
endif
# Add implicit tags.
diff --git a/core/config.mk b/core/config.mk
index f9867ed..232f1d0 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -700,6 +700,25 @@
PRODUCT_FULL_TREBLE := true
endif
+requirements := \
+ PRODUCT_TREBLE_LINKER_NAMESPACES \
+ PRODUCT_SEPOLICY_SPLIT \
+ PRODUCT_ENFORCE_VINTF_MANIFEST \
+
+# If it is overriden, then the requirement override is taken, otherwise it's
+# PRODUCT_FULL_TREBLE
+$(foreach req,$(requirements),$(eval \
+ $(req) := $(if $($(req)_OVERRIDE),$($(req)_OVERRIDE),$(PRODUCT_FULL_TREBLE))))
+# If the requirement is false for any reason, then it's not PRODUCT_FULL_TREBLE
+$(foreach req,$(requirements),$(eval \
+ PRODUCT_FULL_TREBLE := $(if $(filter false,$($(req))),false,$(PRODUCT_FULL_TREBLE))))
+
+.KATI_READONLY := \
+ $(requirements) \
+ PRODUCT_FULL_TREBLE
+
+requirements :=
+
# The default key if not set as LOCAL_CERTIFICATE
ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE)
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 3509bd2..0aec275 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -76,4 +76,39 @@
$(PRIVATE_POST_LINK_CMD)
endif
+ifeq ($(my_native_coverage),true)
+gcno_suffix := .gcnodir
+
+built_whole_gcno_libraries := \
+ $(foreach lib,$(my_whole_static_libraries), \
+ $(call intermediates-dir-for, \
+ STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \
+ $(my_host_cross))/$(lib)$(gcno_suffix))
+
+built_static_gcno_libraries := \
+ $(foreach lib,$(my_static_libraries), \
+ $(call intermediates-dir-for, \
+ STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \
+ $(my_host_cross))/$(lib)$(gcno_suffix))
+
+ifdef LOCAL_IS_HOST_MODULE
+my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
+else
+my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+endif
+
+GCNO_ARCHIVE := $(my_installed_module_stem)$(gcno_suffix)
+
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
+$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
+ $(transform-o-to-static-lib)
+
+$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
+ $(copy-file-to-target)
+
+$(LOCAL_BUILT_MODULE): $(my_coverage_path)/$(GCNO_ARCHIVE)
+endif
+
endif # skip_build_from_source
diff --git a/core/main.mk b/core/main.mk
index e7ecd5e..6f7366d 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -750,8 +750,7 @@
endef
# TODO: Verify all branches/configs have reasonable warnings/errors, and remove
-# these overrides
-link-type-missing = $(eval $$(1).MISSING := true)
+# this override
verify-link-type = $(eval $$(1).MISSING := true)
$(foreach lt,$(ALL_LINK_TYPES),\
diff --git a/target/board/Android.mk b/target/board/Android.mk
index c5678d1..4b5af3c 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -78,9 +78,7 @@
$(GEN): PRIVATE_FLAGS :=
-# TODO(b/37954458), (b/37321309) remove check of PRODUCT_FULL_TREBLE after
-# putting device compatibility matrices for non-treble devices.
-ifeq ($(PRODUCT_FULL_TREBLE),true)
+ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
ifdef BUILT_VENDOR_MATRIX
$(GEN): $(BUILT_VENDOR_MATRIX)
$(GEN): PRIVATE_FLAGS += -c "$(BUILT_VENDOR_MATRIX)"
@@ -105,9 +103,7 @@
$(GEN): PRIVATE_FLAGS :=
-# TODO(b/37954458), (b/37321309) remove check of PRODUCT_FULL_TREBLE after
-# putting complete HAL manifests on non-treble devices.
-ifeq ($(PRODUCT_FULL_TREBLE),true)
+ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
ifdef BUILT_VENDOR_MANIFEST
$(GEN): $(BUILT_VENDOR_MANIFEST)
$(GEN): PRIVATE_FLAGS += -c "$(BUILT_VENDOR_MANIFEST)"
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 3dac589..10ec0d3 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -20,32 +20,27 @@
import unittest
import zipfile
+from hashlib import sha1
+
import common
import validate_target_files
-
-def random_string_with_holes(size, block_size, step_size):
- data = ["\0"] * size
- for begin in range(0, size, step_size):
- end = begin + block_size
- data[begin:end] = os.urandom(block_size)
- return "".join(data)
+KiB = 1024
+MiB = 1024 * KiB
+GiB = 1024 * MiB
def get_2gb_string():
- kilobytes = 1024
- megabytes = 1024 * kilobytes
- gigabytes = 1024 * megabytes
-
- size = int(2 * gigabytes + 1)
- block_size = 4 * kilobytes
- step_size = 4 * megabytes
- two_gb_string = random_string_with_holes(
- size, block_size, step_size)
- return two_gb_string
+ size = int(2 * GiB + 1)
+ block_size = 4 * KiB
+ step_size = 4 * MiB
+ # Generate a long string with holes, e.g. 'xyz\x00abc\x00...'.
+ for _ in range(0, size, step_size):
+ yield os.urandom(block_size)
+ yield '\0' * (step_size - block_size)
class CommonZipTest(unittest.TestCase):
- def _verify(self, zip_file, zip_file_name, arcname, contents,
+ def _verify(self, zip_file, zip_file_name, arcname, expected_hash,
test_file_name=None, expected_stat=None, expected_mode=0o644,
expected_compress_type=zipfile.ZIP_STORED):
# Verify the stat if present.
@@ -69,7 +64,11 @@
self.assertEqual(info.compress_type, expected_compress_type)
# Verify the zip contents.
- self.assertEqual(zip_file.read(arcname), contents)
+ entry = zip_file.open(arcname)
+ sha1_hash = sha1()
+ for chunk in iter(lambda: entry.read(4 * MiB), ''):
+ sha1_hash.update(chunk)
+ self.assertEqual(expected_hash, sha1_hash.hexdigest())
self.assertIsNone(zip_file.testzip())
def _test_ZipWrite(self, contents, extra_zipwrite_args=None):
@@ -90,7 +89,10 @@
zip_file = zipfile.ZipFile(zip_file_name, "w")
try:
- test_file.write(contents)
+ sha1_hash = sha1()
+ for data in contents:
+ sha1_hash.update(data)
+ test_file.write(data)
test_file.close()
expected_stat = os.stat(test_file_name)
@@ -102,8 +104,9 @@
common.ZipWrite(zip_file, test_file_name, **extra_zipwrite_args)
common.ZipClose(zip_file)
- self._verify(zip_file, zip_file_name, arcname, contents, test_file_name,
- expected_stat, expected_mode, expected_compress_type)
+ self._verify(zip_file, zip_file_name, arcname, sha1_hash.hexdigest(),
+ test_file_name, expected_stat, expected_mode,
+ expected_compress_type)
finally:
os.remove(test_file_name)
os.remove(zip_file_name)
@@ -133,7 +136,7 @@
common.ZipWriteStr(zip_file, zinfo_or_arcname, contents, **extra_args)
common.ZipClose(zip_file)
- self._verify(zip_file, zip_file_name, arcname, contents,
+ self._verify(zip_file, zip_file_name, arcname, sha1(contents).hexdigest(),
expected_mode=expected_mode,
expected_compress_type=expected_compress_type)
finally:
@@ -159,7 +162,10 @@
zip_file = zipfile.ZipFile(zip_file_name, "w")
try:
- test_file.write(large)
+ sha1_hash = sha1()
+ for data in large:
+ sha1_hash.update(data)
+ test_file.write(data)
test_file.close()
expected_stat = os.stat(test_file_name)
@@ -173,12 +179,13 @@
common.ZipClose(zip_file)
# Verify the contents written by ZipWrite().
- self._verify(zip_file, zip_file_name, arcname_large, large,
- test_file_name, expected_stat, expected_mode,
- expected_compress_type)
+ self._verify(zip_file, zip_file_name, arcname_large,
+ sha1_hash.hexdigest(), test_file_name, expected_stat,
+ expected_mode, expected_compress_type)
# Verify the contents written by ZipWriteStr().
- self._verify(zip_file, zip_file_name, arcname_small, small,
+ self._verify(zip_file, zip_file_name, arcname_small,
+ sha1(small).hexdigest(),
expected_compress_type=expected_compress_type)
finally:
os.remove(zip_file_name)
@@ -287,13 +294,17 @@
common.ZipWriteStr(zip_file, zinfo, random_string, perms=0o400)
common.ZipClose(zip_file)
- self._verify(zip_file, zip_file_name, "foo", random_string,
+ self._verify(zip_file, zip_file_name, "foo",
+ sha1(random_string).hexdigest(),
expected_mode=0o644)
- self._verify(zip_file, zip_file_name, "bar", random_string,
+ self._verify(zip_file, zip_file_name, "bar",
+ sha1(random_string).hexdigest(),
expected_mode=0o755)
- self._verify(zip_file, zip_file_name, "baz", random_string,
+ self._verify(zip_file, zip_file_name, "baz",
+ sha1(random_string).hexdigest(),
expected_mode=0o740)
- self._verify(zip_file, zip_file_name, "qux", random_string,
+ self._verify(zip_file, zip_file_name, "qux",
+ sha1(random_string).hexdigest(),
expected_mode=0o400)
finally:
os.remove(zip_file_name)
@@ -310,8 +321,7 @@
dummy_fstab = \
["/dev/soc.0/by-name/boot /boot emmc defaults defaults",
"/dev/soc.0/by-name/recovery /recovery emmc defaults defaults"]
- self._info["fstab"] = common.LoadRecoveryFSTab(lambda x : "\n".join(x),
- 2, dummy_fstab)
+ self._info["fstab"] = common.LoadRecoveryFSTab("\n".join, 2, dummy_fstab)
# Construct the gzipped recovery.img and boot.img
self.recovery_data = bytearray([
0x1f, 0x8b, 0x08, 0x00, 0x81, 0x11, 0x02, 0x5a, 0x00, 0x03, 0x2b, 0x4a,
@@ -332,8 +342,8 @@
f.write(data)
def test_full_recovery(self):
- recovery_image = common.File("recovery.img", self.recovery_data);
- boot_image = common.File("boot.img", self.boot_data);
+ recovery_image = common.File("recovery.img", self.recovery_data)
+ boot_image = common.File("boot.img", self.boot_data)
self._info["full_recovery_image"] = "true"
common.MakeRecoveryPatch(self._tempdir, self._out_tmp_sink,
@@ -342,9 +352,9 @@
self._info)
def test_recovery_from_boot(self):
- recovery_image = common.File("recovery.img", self.recovery_data);
+ recovery_image = common.File("recovery.img", self.recovery_data)
self._out_tmp_sink("recovery.img", recovery_image.data, "IMAGES")
- boot_image = common.File("boot.img", self.boot_data);
+ boot_image = common.File("boot.img", self.boot_data)
self._out_tmp_sink("boot.img", boot_image.data, "IMAGES")
common.MakeRecoveryPatch(self._tempdir, self._out_tmp_sink,
diff --git a/tools/signapk/Android.bp b/tools/signapk/Android.bp
new file mode 100644
index 0000000..4954cf5
--- /dev/null
+++ b/tools/signapk/Android.bp
@@ -0,0 +1,31 @@
+//
+// Copyright (C) 2008 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.
+//
+
+// the signapk tool (a .jar application used to sign packages)
+// ============================================================
+java_library_host {
+ name: "signapk",
+ srcs: ["src/**/*.java"],
+ manifest: "SignApk.mf",
+ static_libs: [
+ "apksig",
+ "bouncycastle",
+ "bouncycastle-bcpkix",
+ "conscrypt",
+ ],
+
+ required: ["libconscrypt_openjdk_jni"],
+}
diff --git a/tools/signapk/Android.mk b/tools/signapk/Android.mk
index 8082842..ff54d6d 100644
--- a/tools/signapk/Android.mk
+++ b/tools/signapk/Android.mk
@@ -15,24 +15,10 @@
#
LOCAL_PATH := $(call my-dir)
-# the signapk tool (a .jar application used to sign packages)
-# ============================================================
-include $(CLEAR_VARS)
-LOCAL_MODULE := signapk
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAR_MANIFEST := SignApk.mf
-LOCAL_STATIC_JAVA_LIBRARIES := \
- apksig \
- bouncycastle \
- bouncycastle-bcpkix \
- conscrypt
-LOCAL_REQUIRED_MODULES := libconscrypt_openjdk_jni
-include $(BUILD_HOST_JAVA_LIBRARY)
-
ifeq ($(TARGET_BUILD_APPS),)
# 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) \
+my_dist_files := $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
$(HOST_OUT_SHARED_LIBRARIES)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX)
$(call dist-for-goals,droidcore,$(my_dist_files))