Merge "Pass PRODUCT_MINIMIZE_JAVA_DEBUG_INFO to soong"
diff --git a/core/Makefile b/core/Makefile
index 08188a5..7fed968 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -40,7 +40,9 @@
$(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
$(if $(filter %.xml,$(_dest)),\
$(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
- $(eval $(call copy-one-file,$(_src),$(_fulldest)))) \
+ $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
+ $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
+ $(eval $(call copy-one-file,$(_src),$(_fulldest))))) \
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
$(eval unique_product_copy_files_destinations += $(_dest))))
unique_product_copy_files_pairs :=
diff --git a/core/clang/versions.mk b/core/clang/versions.mk
index c2473cd..f3a206a 100644
--- a/core/clang/versions.mk
+++ b/core/clang/versions.mk
@@ -1,4 +1,4 @@
## Clang/LLVM release versions.
-LLVM_PREBUILTS_VERSION ?= clang-4053586
+LLVM_PREBUILTS_VERSION ?= clang-4393122
LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
diff --git a/core/config.mk b/core/config.mk
index 29861a0..d9c3ef0 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -3,6 +3,23 @@
# current configuration and platform, which
# are not specific to what is being built.
+ifndef KATI
+$(warning Directly using config.mk from make is no longer supported.)
+$(info )
+# Repeat the warning so that it's in both the stdout and stderr streams
+$(info Directly using config.mk from make is no longer supported.)
+$(info )
+$(info If you are just attempting to build, you probably need to re-source envsetup.sh:)
+$(info )
+$(info $$ source build/envsetup.sh)
+$(info )
+$(info If you are attempting to emulate get_build_var, use one of the following:)
+$(info $$ build/soong/soong_ui.bash --dumpvar-mode)
+$(info $$ build/soong/soong_ui.bash --dumpvars-mode)
+$(info )
+$(error done)
+endif
+
# Only use ANDROID_BUILD_SHELL to wrap around bash.
# DO NOT use other shells such as zsh.
ifdef ANDROID_BUILD_SHELL
@@ -44,18 +61,6 @@
# If a rule fails, delete $@.
.DELETE_ON_ERROR:
-# Check for broken versions of make.
-ifndef KATI
-ifneq (1,$(strip $(shell expr $(MAKE_VERSION) \>= 3.81)))
-$(warning ********************************************************************************)
-$(warning * You are using version $(MAKE_VERSION) of make.)
-$(warning * Android can only be built by versions 3.81 and higher.)
-$(warning * see https://source.android.com/source/download.html)
-$(warning ********************************************************************************)
-$(error stopping)
-endif
-endif
-
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
FORCE:
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index f5b45db..79604ac 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -235,6 +235,11 @@
# entire module.
LOCAL_ARM_MODE := thumb
my_cflags += $(CFI_EXTRA_CFLAGS)
+ # Only append the default visibility flag if -fvisibility has not already been
+ # set to hidden.
+ ifeq ($(filter -fvisibility=hidden,$(LOCAL_CFLAGS)),)
+ my_cflags += -fvisibility=default
+ endif
my_ldflags += $(CFI_EXTRA_LDFLAGS)
my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so
# Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when
@@ -242,6 +247,15 @@
ifneq ($(filter arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
my_ldflags += -march=armv7-a
endif
+
+ ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+ my_ldflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_ldflags))
+ my_cflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_cflags))
+ else
+ # Apply the version script to non-static executables
+ my_ldflags += -Wl,--version-script,build/soong/cc/config/cfi_exports.map
+ LOCAL_ADDITIONAL_DEPENDENCIES += build/soong/cc/config/cfi_exports.map
+ endif
endif
# If local or global modules need ASAN, add linker flags.
@@ -293,11 +307,16 @@
endif
ifneq ($(my_sanitize_diag),)
- notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
- my_cflags += -fno-sanitize-trap=$(notrap_arg)
- # Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
- ifeq ($(filter address thread,$(my_sanitize)),)
- # Does not have to be the first DT_NEEDED unlike ASan.
- my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
+ # TODO(vishwath): Add diagnostic support for static executables once
+ # we switch to clang-4393122 (which adds the static ubsan runtime
+ # that this depends on)
+ ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+ notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
+ my_cflags += -fno-sanitize-trap=$(notrap_arg)
+ # Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
+ ifeq ($(filter address thread,$(my_sanitize)),)
+ # Does not have to be the first DT_NEEDED unlike ASan.
+ my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
+ endif
endif
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index f0b7c99..7518917 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1556,7 +1556,7 @@
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
- $(2) $$filelist
+ $(PRIVATE_ARFLAGS) $(2) $$filelist
endef
@@ -2628,6 +2628,14 @@
$$(copy-file-to-target)
endef
+define copy-and-uncompress-dexs
+$(2): $(1) $(ZIPALIGN)
+ @echo "Uncompress dexs in: $$@"
+ $$(copy-file-to-target)
+ $$(uncompress-dexs)
+ $$(align-package)
+endef
+
# Copies many files.
# $(1): The files to copy. Each entry is a ':' separated src:dst pair
# Evaluates to the list of the dst files (ie suitable for a dependency list)
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index acae48e..59efb04 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -1,37 +1,3 @@
-
-# List of variables we want to print in the build banner.
-print_build_config_vars := \
- PLATFORM_VERSION_CODENAME \
- PLATFORM_VERSION \
- TARGET_PRODUCT \
- TARGET_BUILD_VARIANT \
- TARGET_BUILD_TYPE \
- TARGET_PLATFORM_VERSION \
- TARGET_BUILD_APPS \
- TARGET_ARCH \
- TARGET_ARCH_VARIANT \
- TARGET_CPU_VARIANT \
- TARGET_2ND_ARCH \
- TARGET_2ND_ARCH_VARIANT \
- TARGET_2ND_CPU_VARIANT \
- HOST_ARCH \
- HOST_2ND_ARCH \
- HOST_OS \
- HOST_OS_EXTRA \
- HOST_CROSS_OS \
- HOST_CROSS_ARCH \
- HOST_CROSS_2ND_ARCH \
- HOST_BUILD_TYPE \
- BUILD_ID \
- OUT_DIR \
- AUX_OS_VARIANT_LIST
-
-ifeq ($(TARGET_BUILD_PDK),true)
-print_build_config_vars += \
- TARGET_BUILD_PDK \
- PDK_FUSION_PLATFORM_ZIP
-endif
-
# ---------------------------------------------------------------
# the setpath shell function in envsetup.sh uses this to figure out
# what to add to the path given the config we have chosen.
@@ -52,79 +18,14 @@
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
-# The "dumpvar" stuff lets you say something like
-#
-# CALLED_FROM_SETUP=true \
-# make -f config/envsetup.make dumpvar-TARGET_OUT
-# or
-# CALLED_FROM_SETUP=true \
-# make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
-#
-# The plain (non-abs) version just dumps the value of the named variable.
-# The "abs" version will treat the variable as a path, and dumps an
-# absolute path to it.
-#
-dumpvar_goals := \
- $(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
-ifdef dumpvar_goals
-
- ifneq ($(words $(dumpvar_goals)),1)
- $(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
- endif
-
- # If the goal is of the form "dumpvar-abs-VARNAME", then
- # treat VARNAME as a path and return the absolute path to it.
- absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
- ifdef absolute_dumpvar
- dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
- DUMPVAR_VALUE := $(abspath $($(dumpvar_goals)))
- dumpvar_target := dumpvar-abs-$(dumpvar_goals)
- else
- DUMPVAR_VALUE := $($(dumpvar_goals))
- dumpvar_target := dumpvar-$(dumpvar_goals)
- endif
-
-.PHONY: $(dumpvar_target)
-$(dumpvar_target):
- @echo $(DUMPVAR_VALUE)
-
-endif # dumpvar_goals
-
-ifneq ($(dumpvar_goals),report_config)
-PRINT_BUILD_CONFIG:=
-endif
-
-ifneq ($(filter report_config,$(DUMP_MANY_VARS)),)
-# Construct the shell commands that print the config banner.
-report_config_sh := echo '============================================';
-report_config_sh += $(foreach v,$(print_build_config_vars),echo '$v=$($(v))';)
-report_config_sh += echo '============================================';
-endif
-
# Dump mulitple variables to "<var>=<value>" pairs, one per line.
# The output may be executed as bash script.
# Input variables:
# DUMP_MANY_VARS: the list of variable names.
# DUMP_VAR_PREFIX: an optional prefix of the variable name added to the output.
-# DUMP_MANY_ABS_VARS: the list of abs variable names.
-# DUMP_ABS_VAR_PREFIX: an optional prefix of the abs variable name added to the output.
.PHONY: dump-many-vars
dump-many-vars :
- @$(foreach v, $(filter-out report_config, $(DUMP_MANY_VARS)),\
+ @$(foreach v, $(DUMP_MANY_VARS),\
echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
-ifneq ($(filter report_config, $(DUMP_MANY_VARS)),)
- @# Construct a special variable for report_config.
- @# Escape \` to defer the execution of report_config_sh to preserve the line breaks.
- @echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
-endif
- @$(foreach v, $(sort $(DUMP_MANY_ABS_VARS)),\
- echo "$(DUMP_ABS_VAR_PREFIX)$(v)='$(abspath $($(v)))'";)
endif # CALLED_FROM_SETUP
-
-ifneq ($(PRINT_BUILD_CONFIG),)
-$(info ============================================)
-$(foreach v, $(print_build_config_vars),\
- $(info $v=$($(v))))
-$(info ============================================)
-endif
diff --git a/core/java_common.mk b/core/java_common.mk
index 15f7c1b..37de700 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -213,16 +213,6 @@
full_java_bootclasspath_libs := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
LOCAL_JAVA_LIBRARIES := $(filter-out $(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES),$(LOCAL_JAVA_LIBRARIES))
my_system_modules := $(DEFAULT_SYSTEM_MODULES)
- ifneq ($(LOCAL_MODULE),jacocoagent)
- ifeq ($(EMMA_INSTRUMENT),true)
- ifneq ($(EMMA_INSTRUMENT_STATIC),true)
- # For instrumented build, if Jacoco is not being included statically
- # in instrumented packages then include Jacoco classes into the
- # bootclasspath.
- full_java_bootclasspath_libs += $(call java-lib-header-files,jacocoagent)
- endif # EMMA_INSTRUMENT_STATIC
- endif # EMMA_INSTRUMENT
- endif # LOCAL_MODULE == jacocoagent
endif # LOCAL_NO_STANDARD_LIBRARIES
else
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
@@ -244,6 +234,19 @@
endif # current, system_current, or test_current
endif # LOCAL_SDK_VERSION
+ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ ifneq ($(LOCAL_MODULE),jacocoagent)
+ ifeq ($(EMMA_INSTRUMENT),true)
+ ifneq ($(EMMA_INSTRUMENT_STATIC),true)
+ # For instrumented build, if Jacoco is not being included statically
+ # in instrumented packages then include Jacoco classes into the
+ # bootclasspath.
+ full_java_bootclasspath_libs += $(call java-lib-header-files,jacocoagent)
+ endif # EMMA_INSTRUMENT_STATIC
+ endif # EMMA_INSTRUMENT
+ endif # LOCAL_MODULE == jacocoagent
+ endif # LOCAL_NO_STANDARD_LIBRARIES
+
# In order to compile lambda code javac requires various invokedynamic-
# related classes to be present. This change adds stubs needed for
# javac to compile lambdas.
diff --git a/core/java_library.mk b/core/java_library.mk
index d728c53..d7c08cc 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -63,12 +63,16 @@
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
-$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
+$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME) $(ZIPALIGN)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@.tmp)
$(call add-dex-to-package-arg,$@.tmp)
$(hide) $(ZIPTIME) $@.tmp
$(call commit-change-for-toc,$@)
+ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
+ $(uncompress-dexs)
+ $(align-package)
+endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
.KATI_RESTAT: $(common_javalib.jar)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 16563af..9bf173f 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -548,7 +548,7 @@
$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
else
$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_LIST := $(all_res_assets)
-$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT)
+$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT) $(ZIPALIGN)
endif
@echo "target Package: $(PRIVATE_MODULE) ($@)"
ifdef LOCAL_USE_AAPT2
@@ -586,6 +586,9 @@
$(call dexpreopt-remove-classes.dex,$@)
endif
endif
+ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
+ $(uncompress-dexs)
+endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
$(sign-package)
###############################
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 43875df..22f79fa 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -20,6 +20,7 @@
target/common/obj/JAVA_LIBRARIES/legacy-test_intermediates \
target/common/obj/JAVA_LIBRARIES/ext_intermediates \
target/common/obj/JAVA_LIBRARIES/framework_intermediates \
+ target/common/obj/JAVA_LIBRARIES/hwbinder_intermediates \
target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
target/common/obj/JAVA_LIBRARIES/okhttp_intermediates \
target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index ba10b37..48e410b 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -358,6 +358,10 @@
ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
$(uncompress-dexs)
+else
+ ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
+ $(uncompress-dexs)
+ endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
endif # LOCAL_PRIVILEGED_MODULE
endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
ifdef LOCAL_DEX_PREOPT
diff --git a/core/product.mk b/core/product.mk
index 4682dac..1819293 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -117,6 +117,7 @@
PRODUCT_SYSTEM_SERVER_JARS \
PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK \
PRODUCT_DEXPREOPT_SPEED_APPS \
+ PRODUCT_LOADED_BY_PRIVILEGED_MODULES \
PRODUCT_VBOOT_SIGNING_KEY \
PRODUCT_VBOOT_SIGNING_SUBKEY \
PRODUCT_VERITY_SIGNING_KEY \
diff --git a/core/product_config.mk b/core/product_config.mk
index d7881df..777c29d 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -151,6 +151,13 @@
endif # unbundled_goals
endif
+# Now that we've parsed APP-* and PRODUCT-*, mark these as readonly
+TARGET_BUILD_APPS ?=
+.KATI_READONLY := \
+ TARGET_PRODUCT \
+ TARGET_BUILD_VARIANT \
+ TARGET_BUILD_APPS
+
# Default to building dalvikvm on hosts that support it...
ifeq ($(HOST_OS),linux)
# ... or if the if the option is already set
@@ -259,6 +266,7 @@
PRODUCT_SYSTEM_SERVER_JARS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_JARS))
PRODUCT_SYSTEM_SERVER_APPS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_APPS))
PRODUCT_DEXPREOPT_SPEED_APPS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEXPREOPT_SPEED_APPS))
+PRODUCT_LOADED_BY_PRIVILEGED_MODULES := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
# All of the apps that we force preopt, this overrides WITH_DEXPREOPT.
PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK))
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index a9a5306..2fadfa6 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -107,32 +107,7 @@
# need this for gles libraries to load properly
# after moving to /vendor/lib/
PRODUCT_PACKAGES += \
- android.hardware.renderscript@1.0.vndk-sp\
- android.hardware.graphics.allocator@2.0.vndk-sp\
- android.hardware.graphics.mapper@2.0.vndk-sp\
- android.hardware.graphics.common@1.0.vndk-sp\
- libhwbinder.vndk-sp\
- libbase.vndk-sp\
- libcutils.vndk-sp\
- libhardware.vndk-sp\
- libhidlbase.vndk-sp\
- libhidltransport.vndk-sp\
- libutils.vndk-sp\
- libc++.vndk-sp\
- libRS_internal.vndk-sp\
- libRSDriver.vndk-sp\
- libRSCpuRef.vndk-sp\
- libbcinfo.vndk-sp\
- libblas.vndk-sp\
- libft2.vndk-sp\
- libpng.vndk-sp\
- libcompiler_rt.vndk-sp\
- libbacktrace.vndk-sp\
- libunwind.vndk-sp\
- libunwindstack.vndk-sp\
- liblzma.vndk-sp\
- libz.vndk-sp\
-
+ vndk-sp
PRODUCT_COPY_FILES += \
device/generic/goldfish/init.ranchu-core.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ranchu-core.sh \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 50b90ac..aaa1c78 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -84,4 +84,5 @@
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
pm.dexopt.install=quicken \
pm.dexopt.bg-dexopt=speed-profile \
- pm.dexopt.ab-ota=speed-profile
+ pm.dexopt.ab-ota=speed-profile \
+ pm.dexopt.inactive=verify
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index c95512d..c184c42 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -768,6 +768,7 @@
message.append(
"Fell back and generated with bsdiff instead for %s" % (
xf.tgt_name,))
+ xf.style = "bsdiff"
with lock:
warning_messages.extend(message)
del message[:]
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index a9e1606..60aa84e 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -21,9 +21,6 @@
Usage: ota_from_target_files [flags] input_target_files output_ota_package
- --board_config <file>
- Deprecated.
-
-k (--package_key) <key> Key to use to sign the package (default is
the value of default_system_dev_certificate from the input
target-files's META/misc_info.txt, or
@@ -46,9 +43,9 @@
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.
+ --verify
+ Remount and verify the checksums of the files written to the system and
+ vendor (if used) partitions. Non-A/B incremental OTAs only.
-o (--oem_settings) <main_file[,additional_files...]>
Comma seperated list of files used to specify the expected OEM-specific
@@ -1290,9 +1287,7 @@
def main(argv):
def option_handler(o, a):
- if o == "--board_config":
- pass # deprecated
- elif o in ("-k", "--package_key"):
+ if o in ("-k", "--package_key"):
OPTIONS.package_key = a
elif o in ("-i", "--incremental_from"):
OPTIONS.incremental_source = a
@@ -1354,7 +1349,6 @@
args = common.ParseOptions(argv, __doc__,
extra_opts="b:k:i:d:we:t:2o:",
extra_long_opts=[
- "board_config=",
"package_key=",
"incremental_from=",
"full_radio",
diff --git a/tools/signapk/OWNERS b/tools/signapk/OWNERS
new file mode 100644
index 0000000..0b8d398
--- /dev/null
+++ b/tools/signapk/OWNERS
@@ -0,0 +1,2 @@
+cbrubaker@google.com
+klyubin@google.com
diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
index 3b00599..fdf6283 100644
--- a/tools/signapk/src/com/android/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -1082,14 +1082,15 @@
ByteBuffer[] outputChunks = new ByteBuffer[] {v1SignedApk};
ZipSections zipSections = findMainZipSections(v1SignedApk);
- ApkSignerEngine.OutputApkSigningBlockRequest addV2SignatureRequest =
- apkSigner.outputZipSections(
+ ApkSignerEngine.OutputApkSigningBlockRequest2 addV2SignatureRequest =
+ apkSigner.outputZipSections2(
DataSources.asDataSource(zipSections.beforeCentralDir),
DataSources.asDataSource(zipSections.centralDir),
DataSources.asDataSource(zipSections.eocd));
if (addV2SignatureRequest != null) {
// Need to insert the returned APK Signing Block before ZIP Central
// Directory.
+ int padding = addV2SignatureRequest.getPaddingSizeBeforeApkSigningBlock();
byte[] apkSigningBlock = addV2SignatureRequest.getApkSigningBlock();
// Because the APK Signing Block is inserted before the Central Directory,
// we need to adjust accordingly the offset of Central Directory inside the
@@ -1100,10 +1101,12 @@
modifiedEocd.order(ByteOrder.LITTLE_ENDIAN);
ApkUtils.setZipEocdCentralDirectoryOffset(
modifiedEocd,
- zipSections.beforeCentralDir.remaining() + apkSigningBlock.length);
+ zipSections.beforeCentralDir.remaining() + padding +
+ apkSigningBlock.length);
outputChunks =
new ByteBuffer[] {
zipSections.beforeCentralDir,
+ ByteBuffer.allocate(padding),
ByteBuffer.wrap(apkSigningBlock),
zipSections.centralDir,
modifiedEocd};
diff --git a/tools/vendor_buildinfo.sh b/tools/vendor_buildinfo.sh
index 485ada3..c12f7cb 100755
--- a/tools/vendor_buildinfo.sh
+++ b/tools/vendor_buildinfo.sh
@@ -6,10 +6,10 @@
echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME"
echo "ro.board.platform=$TARGET_BOARD_PLATFORM"
-echo "ro.vendor.product.manufacturer=$PRODUCT_MANUFACTURER"
-echo "ro.vendor.product.model=$PRODUCT_MODEL"
-echo "ro.vendor.product.brand=$PRODUCT_BRAND"
-echo "ro.vendor.product.name=$PRODUCT_NAME"
-echo "ro.vendor.product.device=$TARGET_DEVICE"
+echo "ro.product.vendor.manufacturer=$PRODUCT_MANUFACTURER"
+echo "ro.product.vendor.model=$PRODUCT_MODEL"
+echo "ro.product.vendor.brand=$PRODUCT_BRAND"
+echo "ro.product.vendor.name=$PRODUCT_NAME"
+echo "ro.product.vendor.device=$TARGET_DEVICE"
echo "# end build properties"
diff --git a/tools/zipalign/Android.bp b/tools/zipalign/Android.bp
index 2aa6450..e80054a 100644
--- a/tools/zipalign/Android.bp
+++ b/tools/zipalign/Android.bp
@@ -16,12 +16,16 @@
cflags: ["-Wall", "-Werror"],
static_libs: [
- "libandroidfw",
"libutils",
"libcutils",
"liblog",
"libzopfli",
- "libz",
+ ],
+
+ shared_libs: [
+ "libbase",
+ "libz",
+ "libziparchive"
],
target: {
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 719c6b9..43bc9bf 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -20,13 +20,12 @@
#define LOG_TAG "zip"
-#include <androidfw/ZipUtils.h>
#include <utils/Log.h>
+#include <ziparchive/zip_archive.h>
#include "ZipFile.h"
#include <zlib.h>
-#define DEF_MEM_LEVEL 8 // normally in zutil.h?
#include "zopfli/deflate.h"
@@ -135,7 +134,7 @@
/*
* Return the Nth entry in the archive.
*/
-ZipEntry* ZipFile::getEntryByIndex(int idx) const
+android::ZipEntry* ZipFile::getEntryByIndex(int idx) const
{
if (idx < 0 || idx >= (int) mEntries.size())
return NULL;
@@ -146,7 +145,7 @@
/*
* Find an entry by name.
*/
-ZipEntry* ZipFile::getEntryByName(const char* fileName) const
+android::ZipEntry* ZipFile::getEntryByName(const char* fileName) const
{
/*
* Do a stupid linear string-compare search.
@@ -1196,6 +1195,58 @@
}
#endif
+class BufferWriter : public zip_archive::Writer {
+ public:
+ BufferWriter(void* buf, size_t size) : Writer(),
+ buf_(reinterpret_cast<uint8_t*>(buf)), size_(size), bytes_written_(0) {}
+
+ bool Append(uint8_t* buf, size_t buf_size) override {
+ if (bytes_written_ + buf_size > size_) {
+ return false;
+ }
+
+ memcpy(buf_ + bytes_written_, buf, buf_size);
+ bytes_written_ += buf_size;
+ return true;
+ }
+
+ private:
+ uint8_t* const buf_;
+ const size_t size_;
+ size_t bytes_written_;
+};
+
+class FileReader : public zip_archive::Reader {
+ public:
+ FileReader(FILE* fp) : Reader(), fp_(fp), current_offset_(0) {
+ }
+
+ bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
+ // Data is usually requested sequentially, so this helps avoid pointless
+ // fseeks every time we perform a read. There's an impedence mismatch
+ // here because the original API was designed around pread and pwrite.
+ if (offset != current_offset_) {
+ if (fseek(fp_, offset, SEEK_SET) != 0) {
+ return false;
+ }
+
+ current_offset_ = offset;
+ }
+
+ size_t read = fread(buf, 1, len, fp_);
+ if (read != len) {
+ return false;
+ }
+
+ current_offset_ += read;
+ return true;
+ }
+
+ private:
+ FILE* fp_;
+ mutable uint32_t current_offset_;
+};
+
// free the memory when you're done
void* ZipFile::uncompress(const ZipEntry* entry) const
{
@@ -1238,11 +1289,13 @@
}
break;
case ZipEntry::kCompressDeflated: {
- if (!ZipUtils::inflateToBuffer(mZipFp, buf, unlen, clen)) {
+ const FileReader reader(mZipFp);
+ BufferWriter writer(buf, unlen);
+ if (zip_archive::Inflate(reader, clen, unlen, &writer, nullptr) != 0) {
goto bail;
}
- }
break;
+ }
default:
goto bail;
}