emulator: get emulator booting am: d665b020f2
am: 0f4de2f8aa
Change-Id: I5fcbc47de2c46dbc468139e95a626ad071a2e0a2
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..89b446a
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,2 @@
+ccross@android.com
+dwillemsen@google.com
diff --git a/core/Makefile b/core/Makefile
index 317e6e8..33bb296 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -932,6 +932,10 @@
endif
endif
+ifeq ($(BOARD_AVB_ENABLE),true)
+INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
+endif
+
ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
endif
@@ -1159,7 +1163,7 @@
@echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
@rm -rf $@
@mkdir -p $(dir $@)
- java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
+ $(JAVA) -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
@@ -1322,7 +1326,6 @@
$(PDK_FUSION_SYSIMG_FILES) \
$(RECOVERY_RESOURCE_ZIP))
-
FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
# ASAN libraries in the system image - add dependency.
@@ -1444,6 +1447,9 @@
endif
endif
+.PHONY: sync
+sync: $(INTERNAL_SYSTEMIMAGE_FILES)
+
#######
## system tarball
define build-systemtarball-target
@@ -1826,6 +1832,8 @@
vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
$(build-vendorimage-target)
+sync: $(INTERNAL_VENDORIMAGE_FILES)
+
else ifdef BOARD_PREBUILT_VENDORIMAGE
INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
@@ -2000,9 +2008,6 @@
vbmetaimage-nodeps:
$(build-vbmetaimage-target)
-# We need $(AVBTOOL) for system.img generation.
-FULL_SYSTEMIMAGE_DEPS += $(AVBTOOL)
-
endif # BOARD_AVB_ENABLE
# -----------------------------------------------------------------
@@ -2484,6 +2489,11 @@
endif # BOARD_AVB_DTBO_KEY_PATH
endif # BOARD_AVB_ENABLE
endif # BOARD_PREBUILT_DTBOIMAGE
+ @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
+ @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
+ @# INSTALLED_RADIOIMAGE_TARGET.
+ $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
+ echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
@# Run fs_config on all the system, vendor, boot ramdisk,
@# and recovery ramdisk files in the zip, and save the output
$(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
diff --git a/core/base_rules.mk b/core/base_rules.mk
index c327d2c..07d1cd9 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -243,6 +243,18 @@
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
generated_sources_dir := $(call local-generated-sources-dir)
+ifneq ($(LOCAL_OVERRIDES_MODULES),)
+ ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+ ifndef LOCAL_IS_HOST_MODULE
+ EXECUTABLES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES))
+ else
+ $(call pretty-error,host modules cannot use LOCAL_OVERRIDES_MODULES)
+ endif
+ else
+ $(call pretty-error,LOCAL_MODULE_CLASS := $(LOCAL_MODULE_CLASS) cannot use LOCAL_OVERRIDES_MODULES)
+ endif
+endif
+
###########################################################
# Pick a name for the intermediate and final targets
###########################################################
diff --git a/core/binary.mk b/core/binary.mk
index 625d348..84e3cb9 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -24,9 +24,10 @@
endif
else
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
- my_system_shared_libraries := libc libm
+ my_system_shared_libraries := libc libm libdl
else
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
+ my_system_shared_libraries := $(patsubst libc,libc libdl,$(my_system_shared_libraries))
endif
endif
@@ -39,7 +40,7 @@
my_src_files_exclude := $(LOCAL_SRC_FILES_EXCLUDE)
my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
-my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
+my_shared_libraries := $(filter-out $(my_system_shared_libraries),$(LOCAL_SHARED_LIBRARIES))
my_header_libraries := $(LOCAL_HEADER_LIBRARIES)
my_cflags := $(LOCAL_CFLAGS)
my_conlyflags := $(LOCAL_CONLYFLAGS)
@@ -1362,7 +1363,7 @@
ifdef LOCAL_INSTALLED_MODULE
ifdef installed_shared_library_module_names
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
- $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(sort $(installed_shared_library_module_names)))
+ $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
endif
endif
diff --git a/core/clang/OWNERS b/core/clang/OWNERS
new file mode 100644
index 0000000..d41d3fc
--- /dev/null
+++ b/core/clang/OWNERS
@@ -0,0 +1,4 @@
+chh@google.com
+pirama@google.com
+srhines@google.com
+yikong@google.com
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index ac3593b..cd001b2 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -171,6 +171,7 @@
LOCAL_ODM_MODULE:=
LOCAL_OEM_MODULE:=
LOCAL_OVERRIDES_PACKAGES:=
+LOCAL_OVERRIDES_MODULES:=
LOCAL_PACKAGE_NAME:=
LOCAL_PACKAGE_SPLITS:=
LOCAL_PACK_MODULE_RELOCATIONS:=
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index d067ce7..5c2668c 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -23,6 +23,10 @@
JAVACC := $(ALTERNATE_JAVAC)
endif
+JAVA := java
+JAVADOC := javadoc
+JAR := jar
+
# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
ifdef JAVAC_WRAPPER
ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
diff --git a/core/config.mk b/core/config.mk
index 62f1337..5b77be6 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -308,6 +308,7 @@
export CC_WRAPPER
export CXX_WRAPPER
+export JAVAC_WRAPPER
endif
ifdef TARGET_PREFER_32_BIT
@@ -516,7 +517,7 @@
DX_COMMAND := $(DX) -JXms16M -JXmx2048M
else
DX := $(DX_ALT_JAR)
-DX_COMMAND := java -Xms16M -Xmx2048M -jar $(DX)
+DX_COMMAND := $(JAVA) -Xms16M -Xmx2048M -jar $(DX)
endif
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
@@ -675,7 +676,7 @@
EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)
# Tool to merge AndroidManifest.xmls
-ANDROID_MANIFEST_MERGER := java -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
+ANDROID_MANIFEST_MERGER := $(JAVA) -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
COLUMN:= column
@@ -699,7 +700,7 @@
# Is the host JDK 64-bit version?
HOST_JDK_IS_64BIT_VERSION :=
-ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
+ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),)
HOST_JDK_IS_64BIT_VERSION := true
endif
endif # CALLED_FROM_SETUP not true
@@ -795,11 +796,6 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
endif
-# allow overriding default Java libraries on a per-target basis
-ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
- TARGET_DEFAULT_JAVA_LIBRARIES := core-oj core-libart ext framework okhttp
-endif
-
# Flags for DEX2OAT
first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 04aedf4..967df2d 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -138,7 +138,7 @@
ifeq ($(filter address,$(my_sanitize)),)
$(error $(LOCAL_PATH): $(LOCAL_MODULE): Use of 'coverage' also requires 'address')
endif
- my_cflags += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
+ my_cflags += -fsanitize-coverage=trace-pc-guard
my_sanitize := $(filter-out coverage,$(my_sanitize))
endif
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk
index fd9c442..0baec26 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -99,8 +99,6 @@
ifeq ($(my_link_type),static)
my_static_libraries += libm libc libdl
- else
- my_shared_libraries += libdl
endif
endif
else ifeq ($(my_cxx_stl),ndk)
diff --git a/core/definitions.mk b/core/definitions.mk
index 1da169f..07e5b69 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2251,9 +2251,9 @@
$(if $(PRIVATE_JAR_MANIFEST), \
$(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf && \
- jar -cfm $@ $(dir $@)/manifest.mf \
+ $(JAR) -cfm $@ $(dir $@)/manifest.mf \
-C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
- $(hide) jar -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
+ $(hide) $(JAR) -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
endef
@@ -2524,7 +2524,7 @@
endef
define transform-classes.jar-to-emma
-$(hide) java -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
+$(hide) $(JAVA) -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
$(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR) \
$(addprefix -ix , $(PRIVATE_EMMA_COVERAGE_FILTER))
endef
@@ -2547,7 +2547,7 @@
$(hide) rm -f $@ $@.tmp
@rm -rf $(dir $@)/desugar_dumped_classes
@mkdir $(dir $@)/desugar_dumped_classes
-$(hide) java \
+$(hide) $(JAVA) \
$(if $(EXPERIMENTAL_USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
-Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
-jar $(DESUGAR) \
@@ -2585,7 +2585,7 @@
define create-empty-package-at
@mkdir -p $(dir $(1))
$(hide) touch $(dir $(1))zipdummy
-$(hide) (cd $(dir $(1)) && jar cf $(notdir $(1)) zipdummy)
+$(hide) $(JAR) cf $(1) -C $(dir $(1)) zipdummy
$(hide) zip -qd $(1) zipdummy
$(hide) rm $(dir $(1))zipdummy
endef
@@ -2679,7 +2679,7 @@
#
define add-java-resources-to
$(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(1).jar-arg-list)
-$(hide) jar uf $(1) @$(1).jar-arg-list
+$(hide) $(JAR) uf $(1) @$(1).jar-arg-list
@rm -f $(1).jar-arg-list
endef
@@ -2691,7 +2691,7 @@
| sed -e "s?^$(PRIVATE_JACK_INTERMEDIATES_DIR)/? -C \"$(PRIVATE_JACK_INTERMEDIATES_DIR)\" \"?" -e "s/$$/\"/" \
> $(dir $@)jack_res_jar_flags; \
if [ -s $(dir $@)jack_res_jar_flags ] ; then \
- jar uf $@ @$(dir $@)jack_res_jar_flags; \
+ $(JAR) uf $@ @$(dir $@)jack_res_jar_flags; \
fi; \
fi
endef
@@ -2706,7 +2706,7 @@
# $(1): the package file we are signing.
define sign-package-arg
$(hide) mv $(1) $(1).unsigned
-$(hide) java -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) \
+$(hide) $(JAVA) -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) \
$(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports java.base/sun.security.pkcs=ALL-UNNAMED,) \
$(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports java.base/sun.security.x509=ALL-UNNAMED,) \
-jar $(SIGNAPK_JAR) \
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 27e44a0..8e3ecff 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -130,7 +130,13 @@
##
droiddoc_templates := \
- $(sort $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f))
+ $(sort $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f $(if $(ALLOW_MISSING_DEPENDENCIES),2>/dev/null)))
+
+ifdef ALLOW_MISSING_DEPENDENCIES
+ ifndef droiddoc_templates
+ droiddoc_templates := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
+ endif
+endif
droiddoc := \
$(HOST_JDK_TOOLS_JAR) \
@@ -173,7 +179,7 @@
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
- javadoc \
+ $(JAVADOC) \
-encoding UTF-8 \
-source 1.8 \
\@$(PRIVATE_SRC_LIST_FILE) \
@@ -211,7 +217,7 @@
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
- javadoc \
+ $(JAVADOC) \
-encoding UTF-8 \
$(PRIVATE_DROIDDOC_OPTIONS) \
\@$(PRIVATE_SRC_LIST_FILE) \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 43593e6..27cfd7f 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -190,6 +190,13 @@
TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
###########################################
+#################################################################
+# Set up minimal BOOTCLASSPATH list of jars to build/execute
+# java code with dalvikvm/art.
+TARGET_CORE_JARS := core-oj core-libart conscrypt okhttp bouncycastle apache-xml
+HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
+#################################################################
+
# Read the product specs so we can get TARGET_DEVICE and other
# variables that we need in order to locate the output files.
include $(BUILD_SYSTEM)/product_config.mk
diff --git a/core/goma.mk b/core/goma.mk
index 4e8318a..2fb37a7 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -45,6 +45,7 @@
# use both ccache and gomacc.
CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC))
CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC))
+ JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC))
# gomacc can start goma client's daemon process automatically, but
# it is safer and faster to start up it beforehand. We run this as a
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 7101229..4f3069f 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -119,7 +119,7 @@
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
- $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+ $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
full_classes_jarjar_jar := $(full_classes_desugar_jar)
endif
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
index 1c9eed2..8622911 100644
--- a/core/host_fuzz_test.mk
+++ b/core/host_fuzz_test.mk
@@ -4,7 +4,7 @@
################################################
$(call record-module-type,HOST_FUZZ_TEST)
-LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
+LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard
LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index d30c90d..939ff37 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -90,7 +90,7 @@
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
- $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+ $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
full_classes_jarjar_jar := $(full_classes_compiled_jar)
endif
diff --git a/core/java.mk b/core/java.mk
index 98f6ca7..3ee2199 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -467,7 +467,7 @@
$(full_classes_processed_jar): $(full_classes_compiled_jar) $(LOCAL_JAR_PROCESSOR)
@echo Processing $@ with $(PRIVATE_JAR_PROCESSOR)
$(hide) rm -f $@ $(PRIVATE_TMP_OUT)
- $(hide) java -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
+ $(hide) $(JAVA) -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
$(hide) mv $(PRIVATE_TMP_OUT) $@
else
@@ -493,7 +493,7 @@
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
- $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+ $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
full_classes_jarjar_jar := $(full_classes_desugar_jar)
endif
@@ -646,7 +646,7 @@
ifndef LOCAL_JACK_ENABLED
ifdef LOCAL_SDK_VERSION
ifeq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-proguard_injar_filters := (!junit/framework/**,!junit/runner/**,!android/test/**,!com/android/internal/util/*)
+proguard_injar_filters := (!junit/framework/**,!junit/runner/**,!junit/textui/**,!android/test/**,!com/android/internal/util/*)
endif
endif
endif
diff --git a/core/main.mk b/core/main.mk
index 8461e62..a70274c 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -781,6 +781,9 @@
# Filter out the overridden packages before doing expansion
product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
$(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
+ # Filter out executables as well
+ product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \
+ $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES))
# Resolve the :32 :64 module name
modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 4003aaf..9dff862 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -354,7 +354,7 @@
@rm -rf $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) && \
mkdir -p $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) \
$(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_ANNO_SRC_DIR)
- $(hide) java -classpath $(DATA_BINDING_COMPILER) android.databinding.tool.MakeCopy \
+ $(hide) $(JAVA) -classpath $(DATA_BINDING_COMPILER) android.databinding.tool.MakeCopy \
$(PRIVATE_MANIFEST) $(PRIVATE_SRC_OUT) $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_RES_IN)
$(hide) touch $@
diff --git a/core/product.mk b/core/product.mk
index fd22532..3888313 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -131,6 +131,7 @@
VENDOR_PRODUCT_RESTRICT_VENDOR_FILES \
VENDOR_EXCEPTION_MODULES \
VENDOR_EXCEPTION_PATHS \
+ PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD \
PRODUCT_ART_USE_READ_BARRIER \
PRODUCT_IOT \
PRODUCT_SYSTEM_HEADROOM \
diff --git a/core/product_config.mk b/core/product_config.mk
index 8b908da..7164aff 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -411,6 +411,10 @@
$(eval SANITIZER.$(TARGET_PRODUCT).$(m).CONFIG := $(cf))))
_psmc_modules :=
+# Whether the product wants to ship libartd. For rules and meaning, see art/Android.mk.
+PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD))
+
# Make this art variable visible to soong_config.mk.
PRODUCT_ART_USE_READ_BARRIER := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ART_USE_READ_BARRIER))
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 76584df..1373011 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -207,7 +207,7 @@
# Note: Use "cp -n" to honor the resource overlay rules, if multiple res dirs exist.
$(hide) $(foreach res,$(PRIVATE_RESOURCE_DIR),cp -Rfn $(res)/* $(dir $@)aar/res;)
$(hide) cp $(PRIVATE_R_TXT) $(dir $@)aar/R.txt
- $(hide) jar -cMf $@ \
+ $(hide) $(JAR) -cMf $@ \
-C $(dir $@)aar .
# Register the aar file.
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 362b229..610e0ce 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -35,7 +35,7 @@
define stub-addon-jar
$(call stub-addon-jar-file,$(1)): $(1) | mkstubs
$(info Stubbing addon jar using $(PRODUCT_SDK_ADDON_STUB_DEFS))
- $(hide) java -jar $(call module-installed-files,mkstubs) $(if $(hide),,--v) \
+ $(hide) $(JAVA) -jar $(call module-installed-files,mkstubs) $(if $(hide),,--v) \
"$$<" "$$@" @$(PRODUCT_SDK_ADDON_STUB_DEFS)
endef
diff --git a/core/tasks/tools/build_custom_image.mk b/core/tasks/tools/build_custom_image.mk
index 8c098d6..702d8b3 100644
--- a/core/tasks/tools/build_custom_image.mk
+++ b/core/tasks/tools/build_custom_image.mk
@@ -144,3 +144,9 @@
# Archive the built image.
$(call dist-for-goals, $(my_custom_image_name) custom_images,$(my_installed_custom_image))
+
+my_staging_dir :=
+my_built_modules :=
+my_copy_dest :=
+my_copy_pairs :=
+my_pickup_files :=
diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk
index 63fab63..629a9b2 100644
--- a/core/tasks/tools/package-modules.mk
+++ b/core/tasks/tools/package-modules.mk
@@ -4,6 +4,7 @@
# Input variables:
# my_modules: a list of module names
# my_package_name: the name of the output zip file.
+# my_copy_pairs: a list of extra files to install (in src:dest format)
# Output variables:
# my_package_zip: the path to the output zip file.
#
@@ -11,8 +12,8 @@
my_makefile := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
my_staging_dir := $(call intermediates-dir-for,PACKAGING,$(my_package_name))
-my_built_modules :=
-my_copy_pairs :=
+my_built_modules := $(foreach p,$(my_copy_pairs),$(call word-colon,1,$(p)))
+my_copy_pairs := $(foreach p,$(my_copy_pairs),$(call word-colon,1,$(p)):$(my_staging_dir)/$(call word-colon,2,$(p)))
my_pickup_files :=
# Iterate over the modules and include their direct dependencies stated in the
@@ -67,3 +68,12 @@
$(hide) $(foreach f, $(PRIVATE_PICKUP_FILES),\
cp -RfL $(f) $(dir $@) && ) true
$(hide) cd $(dir $@) && zip -rqX $(notdir $@) *
+
+my_makefile :=
+my_staging_dir :=
+my_built_modules :=
+my_copy_dest :=
+my_copy_pairs :=
+my_pickup_files :=
+my_missing_files :=
+my_modules_and_deps :=
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index e188bb4..af457f8 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -40,7 +40,7 @@
DEFAULT_PLATFORM_VERSION := OPD1
MIN_PLATFORM_VERSION := OPD1
-MAX_PLATFORM_VERSION := OPD1
+MAX_PLATFORM_VERSION := PPR1
ALLOWED_VERSIONS := $(call allowed-platform-versions,\
$(MIN_PLATFORM_VERSION),\
@@ -80,10 +80,14 @@
# please add that PLATFORM_VERSION to the following text file:
# cts/tests/tests/os/assets/platform_versions.txt
PLATFORM_VERSION.OPD1 := 8.0.1
+PLATFORM_VERSION.OPM1 := OMR1
+PLATFORM_VERSION.PPR1 := P
# These are the current development codenames, if the build is not a final
# release build. If this is a final release build, it is simply "REL".
PLATFORM_VERSION_CODENAME.OPD1 := REL
+PLATFORM_VERSION_CODENAME.OPM1 := OMR1
+PLATFORM_VERSION_CODENAME.PPR1 := P
ifndef PLATFORM_VERSION
PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
diff --git a/target/product/base.mk b/target/product/base.mk
index ad4c133..392f432 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -23,6 +23,7 @@
appops \
am \
android.policy \
+ android.test.mock \
android.test.runner \
app_process \
applypatch \
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 9ea9a5a..9fc792c 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -102,20 +102,19 @@
frameworks/native/data/etc/android.software.preview_sdk.xml:system/etc/permissions/android.software.preview_sdk.xml
endif
+ifeq ($(TARGET_CORE_JARS),)
+$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
+endif
+
# The order of PRODUCT_BOOT_JARS matters.
PRODUCT_BOOT_JARS := \
- core-oj \
- core-libart \
- conscrypt \
- okhttp \
+ $(TARGET_CORE_JARS) \
legacy-test \
- bouncycastle \
ext \
framework \
telephony-common \
voip-common \
ims-common \
- apache-xml \
org.apache.http.legacy.boot \
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index f19009c..e473413 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -89,20 +89,19 @@
wifi-service \
wificond \
+ifeq ($(TARGET_CORE_JARS),)
+$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
+endif
+
# The order matters
PRODUCT_BOOT_JARS := \
- core-oj \
- core-libart \
- conscrypt \
- okhttp \
+ $(TARGET_CORE_JARS) \
legacy-test \
- bouncycastle \
ext \
framework \
telephony-common \
voip-common \
ims-common \
- apache-xml \
nullwebview \
org.apache.http.legacy.boot \
android.hidl.base-V1.0-java \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 0755bf3..24eeff9 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -16,15 +16,14 @@
# Provides a functioning ART environment without Android frameworks
+ifeq ($(TARGET_CORE_JARS),)
+$(error TARGET_CORE_JARS is empty; cannot update PRODUCT_PACKAGES variable)
+endif
+
# Minimal boot classpath. This should be a subset of PRODUCT_BOOT_JARS, and equivalent to
# TARGET_CORE_JARS.
PRODUCT_PACKAGES += \
- apache-xml \
- bouncycastle \
- core-oj \
- core-libart \
- conscrypt \
- okhttp \
+ $(TARGET_CORE_JARS)
# Additional mixins to the boot classpath.
PRODUCT_PACKAGES += \
@@ -42,7 +41,6 @@
PRODUCT_PACKAGES += \
libjavacore \
libopenjdk \
- libopenjdkjvm \
# Libcore ICU. TODO: Try to figure out if/why we need them explicitly.
PRODUCT_PACKAGES += \
@@ -50,24 +48,9 @@
libicuuc \
# ART.
-PRODUCT_PACKAGES += \
- dalvikvm \
- dex2oat \
- dexoptanalyzer \
- libart \
- libart_fake \
- libopenjdkjvmti \
- patchoat \
- profman
-
+PRODUCT_PACKAGES += art-runtime
# ART/dex helpers.
-PRODUCT_PACKAGES += \
- ahat \
- dexdiag \
- dexdump \
- dexlist \
- hprof-conv \
- oatdump \
+PRODUCT_PACKAGES += art-tools
# Certificates.
PRODUCT_PACKAGES += \
diff --git a/tools/OWNERS b/tools/OWNERS
new file mode 100644
index 0000000..7a23adc
--- /dev/null
+++ b/tools/OWNERS
@@ -0,0 +1,2 @@
+per-file warn.py = chh@google.com
+per-file checkowners.py = chh@google.com
diff --git a/tools/releasetools/OWNERS b/tools/releasetools/OWNERS
new file mode 100644
index 0000000..39448cf
--- /dev/null
+++ b/tools/releasetools/OWNERS
@@ -0,0 +1 @@
+tbao@google.com
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index aab082b..23c179f 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -69,7 +69,7 @@
OPTIONS.add_missing = False
OPTIONS.rebuild_recovery = False
-OPTIONS.replace_recovery_patch_files_list = []
+OPTIONS.replace_updated_files_list = []
OPTIONS.replace_verity_public_key = False
OPTIONS.replace_verity_private_key = False
OPTIONS.is_signing = False
@@ -99,8 +99,7 @@
assert which in ("system", "vendor")
simg = sparse_img.SparseImage(imgname)
- care_map_list = []
- care_map_list.append(which)
+ care_map_list = [which]
care_map_ranges = simg.care_map
key = which + "_adjusted_partition_size"
@@ -130,7 +129,7 @@
arc_name = "SYSTEM/" + fn
if arc_name in output_zip.namelist():
- OPTIONS.replace_recovery_patch_files_list.append(arc_name)
+ OPTIONS.replace_updated_files_list.append(arc_name)
else:
common.ZipWrite(output_zip, ofile.name, arc_name)
@@ -453,17 +452,21 @@
img.Write()
-def ReplaceRecoveryPatchFiles(zip_filename):
- """Update the related files under SYSTEM/ after rebuilding recovery."""
+def ReplaceUpdatedFiles(zip_filename, files_list):
+ """Update all the zip entries listed in the files_list.
- cmd = ["zip", "-d", zip_filename] + OPTIONS.replace_recovery_patch_files_list
+ For now the list includes META/care_map.txt, and the related files under
+ SYSTEM/ after rebuilding recovery.
+ """
+
+ cmd = ["zip", "-d", zip_filename] + files_list
p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p.communicate()
output_zip = zipfile.ZipFile(zip_filename, "a",
compression=zipfile.ZIP_DEFLATED,
allowZip64=True)
- for item in OPTIONS.replace_recovery_patch_files_list:
+ for item in files_list:
file_path = os.path.join(OPTIONS.input_tmp, item)
assert os.path.exists(file_path)
common.ZipWrite(output_zip, file_path, arcname=item)
@@ -642,17 +645,45 @@
assert os.path.exists(img_path), "cannot find " + img_name
if care_map_list:
- file_path = "META/care_map.txt"
- if output_zip:
- common.ZipWriteStr(output_zip, file_path, '\n'.join(care_map_list))
+ care_map_path = "META/care_map.txt"
+ if output_zip and care_map_path not in output_zip.namelist():
+ common.ZipWriteStr(output_zip, care_map_path, '\n'.join(care_map_list))
else:
- with open(os.path.join(OPTIONS.input_tmp, file_path), 'w') as fp:
+ with open(os.path.join(OPTIONS.input_tmp, care_map_path), 'w') as fp:
fp.write('\n'.join(care_map_list))
+ if output_zip:
+ OPTIONS.replace_updated_files_list.append(care_map_path)
+
+ # Radio images that need to be packed into IMAGES/, and product-img.zip.
+ pack_radioimages = os.path.join(
+ OPTIONS.input_tmp, "META", "pack_radioimages.txt")
+ if os.path.exists(pack_radioimages):
+ with open(pack_radioimages, 'r') as f:
+ lines = f.readlines()
+ for line in lines:
+ img_name = line.strip()
+ _, ext = os.path.splitext(img_name)
+ if not ext:
+ img_name += ".img"
+ prebuilt_path = os.path.join(OPTIONS.input_tmp, "IMAGES", img_name)
+ if os.path.exists(prebuilt_path):
+ print("%s already exists, no need to overwrite..." % (img_name,))
+ continue
+
+ img_radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", img_name)
+ assert os.path.exists(img_radio_path), \
+ "Failed to find %s at %s" % (img_name, img_radio_path)
+ if output_zip:
+ common.ZipWrite(output_zip, img_radio_path,
+ os.path.join("IMAGES", img_name))
+ else:
+ shutil.copy(img_radio_path, prebuilt_path)
if output_zip:
common.ZipClose(output_zip)
- if OPTIONS.replace_recovery_patch_files_list:
- ReplaceRecoveryPatchFiles(output_zip.filename)
+ if OPTIONS.replace_updated_files_list:
+ ReplaceUpdatedFiles(output_zip.filename,
+ OPTIONS.replace_updated_files_list)
def main(argv):
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 2ad628b..c721a24 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1605,7 +1605,6 @@
info_dict = OPTIONS.info_dict
full_recovery_image = info_dict.get("full_recovery_image", None) == "true"
- system_root_image = info_dict.get("system_root_image", None) == "true"
if full_recovery_image:
output_sink("etc/recovery.img", recovery_img.data)
@@ -1661,30 +1660,8 @@
'bonus_args': bonus_args}
# The install script location moved from /system/etc to /system/bin
- # in the L release. Parse init.*.rc files to find out where the
- # target-files expects it to be, and put it there.
- sh_location = "etc/install-recovery.sh"
- found = False
- if system_root_image:
- init_rc_dir = os.path.join(input_dir, "ROOT")
- else:
- init_rc_dir = os.path.join(input_dir, "BOOT", "RAMDISK")
- init_rc_files = os.listdir(init_rc_dir)
- for init_rc_file in init_rc_files:
- if (not init_rc_file.startswith('init.') or
- not init_rc_file.endswith('.rc')):
- continue
-
- with open(os.path.join(init_rc_dir, init_rc_file)) as f:
- for line in f:
- m = re.match(r"^service flash_recovery /system/(\S+)\s*$", line)
- if m:
- sh_location = m.group(1)
- found = True
- break
-
- if found:
- break
+ # in the L release.
+ sh_location = "bin/install-recovery.sh"
print("putting script in", sh_location)
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 3cf8ce7..eff4ed2 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -739,7 +739,9 @@
sys.exit(1)
input_zip = zipfile.ZipFile(args[0], "r")
- output_zip = zipfile.ZipFile(args[1], "w")
+ output_zip = zipfile.ZipFile(args[1], "w",
+ compression=zipfile.ZIP_DEFLATED,
+ allowZip64=True)
misc_info = common.LoadInfoDict(input_zip)
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index a861346..36f256d 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -14,12 +14,14 @@
# limitations under the License.
#
import os
+import shutil
import tempfile
import time
import unittest
import zipfile
import common
+import validate_target_files
def random_string_with_holes(size, block_size, step_size):
@@ -295,3 +297,55 @@
expected_mode=0o400)
finally:
os.remove(zip_file_name)
+
+class InstallRecoveryScriptFormatTest(unittest.TestCase):
+ """Check the format of install-recovery.sh
+
+ Its format should match between common.py and validate_target_files.py."""
+
+ def setUp(self):
+ self._tempdir = tempfile.mkdtemp()
+ # Create a dummy dict that contains the fstab info for boot&recovery.
+ self._info = {"fstab" : {}}
+ 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)
+
+ def _out_tmp_sink(self, name, data, prefix="SYSTEM"):
+ loc = os.path.join(self._tempdir, prefix, name)
+ if not os.path.exists(os.path.dirname(loc)):
+ os.makedirs(os.path.dirname(loc))
+ with open(loc, "w+") as f:
+ f.write(data)
+
+ def test_full_recovery(self):
+ recovery_image = common.File("recovery.img", "recovery");
+ boot_image = common.File("boot.img", "boot");
+ self._info["full_recovery_image"] = "true"
+
+ common.MakeRecoveryPatch(self._tempdir, self._out_tmp_sink,
+ recovery_image, boot_image, self._info)
+ validate_target_files.ValidateInstallRecoveryScript(self._tempdir,
+ self._info)
+
+ def test_recovery_from_boot(self):
+ recovery_image = common.File("recovery.img", "recovery");
+ self._out_tmp_sink("recovery.img", recovery_image.data, "IMAGES")
+ boot_image = common.File("boot.img", "boot");
+ self._out_tmp_sink("boot.img", boot_image.data, "IMAGES")
+
+ common.MakeRecoveryPatch(self._tempdir, self._out_tmp_sink,
+ recovery_image, boot_image, self._info)
+ validate_target_files.ValidateInstallRecoveryScript(self._tempdir,
+ self._info)
+ # Validate 'recovery-from-boot' with bonus argument.
+ self._out_tmp_sink("etc/recovery-resource.dat", "bonus", "SYSTEM")
+ common.MakeRecoveryPatch(self._tempdir, self._out_tmp_sink,
+ recovery_image, boot_image, self._info)
+ validate_target_files.ValidateInstallRecoveryScript(self._tempdir,
+ self._info)
+
+ def tearDown(self):
+ shutil.rmtree(self._tempdir)
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 1dd3159..8ac3322 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -26,6 +26,7 @@
import common
import logging
import os.path
+import re
import sparse_img
import sys
@@ -43,13 +44,38 @@
return sparse_img.SparseImage(path, mappath, clobbered_blocks)
-def ValidateFileConsistency(input_zip, input_tmp):
- """Compare the files from image files and unpacked folders."""
+def _CalculateFileSha1(file_name, unpacked_name, round_up=False):
+ """Calculate the SHA-1 for a given file. Round up its size to 4K if needed."""
def RoundUpTo4K(value):
rounded_up = value + 4095
return rounded_up - (rounded_up % 4096)
+ assert os.path.exists(unpacked_name)
+ with open(unpacked_name, 'r') as f:
+ file_data = f.read()
+ file_size = len(file_data)
+ if round_up:
+ file_size_rounded_up = RoundUpTo4K(file_size)
+ file_data += '\0' * (file_size_rounded_up - file_size)
+ return common.File(file_name, file_data).sha1
+
+
+def ValidateFileAgainstSha1(input_tmp, file_name, file_path, expected_sha1):
+ """Check if the file has the expected SHA-1."""
+
+ logging.info('Validating the SHA-1 of {}'.format(file_name))
+ unpacked_name = os.path.join(input_tmp, file_path)
+ assert os.path.exists(unpacked_name)
+ actual_sha1 = _CalculateFileSha1(file_name, unpacked_name, False)
+ assert actual_sha1 == expected_sha1, \
+ 'SHA-1 mismatches for {}. actual {}, expected {}'.format(
+ file_name, actual_sha1, expected_sha1)
+
+
+def ValidateFileConsistency(input_zip, input_tmp):
+ """Compare the files from image files and unpacked folders."""
+
def CheckAllFiles(which):
logging.info('Checking %s image.', which)
image = _GetImage(which, input_tmp)
@@ -66,12 +92,7 @@
# The filename under unpacked directory, such as SYSTEM/bin/sh.
unpacked_name = os.path.join(
input_tmp, which.upper(), entry[(len(prefix) + 1):])
- with open(unpacked_name) as f:
- file_data = f.read()
- file_size = len(file_data)
- file_size_rounded_up = RoundUpTo4K(file_size)
- file_data += '\0' * (file_size_rounded_up - file_size)
- file_sha1 = common.File(entry, file_data).sha1
+ file_sha1 = _CalculateFileSha1(entry, unpacked_name, True)
assert blocks_sha1 == file_sha1, \
'file: %s, range: %s, blocks_sha1: %s, file_sha1: %s' % (
@@ -89,6 +110,78 @@
# Not checking IMAGES/system_other.img since it doesn't have the map file.
+def ValidateInstallRecoveryScript(input_tmp, info_dict):
+ """Validate the SHA-1 embedded in install-recovery.sh.
+
+ install-recovery.sh is written in common.py and has the following format:
+
+ 1. full recovery:
+ ...
+ if ! applypatch -c type:device:size:SHA-1; then
+ applypatch /system/etc/recovery.img type:device sha1 size && ...
+ ...
+
+ 2. recovery from boot:
+ ...
+ applypatch [-b bonus_args] boot_info recovery_info recovery_sha1 \
+ recovery_size patch_info && ...
+ ...
+
+ For full recovery, we want to calculate the SHA-1 of /system/etc/recovery.img
+ and compare it against the one embedded in the script. While for recovery
+ from boot, we want to check the SHA-1 for both recovery.img and boot.img
+ under IMAGES/.
+ """
+
+ script_path = 'SYSTEM/bin/install-recovery.sh'
+ if not os.path.exists(os.path.join(input_tmp, script_path)):
+ logging.info('{} does not exist in input_tmp'.format(script_path))
+ return
+
+ logging.info('Checking {}'.format(script_path))
+ with open(os.path.join(input_tmp, script_path), 'r') as script:
+ lines = script.read().strip().split('\n')
+ assert len(lines) >= 6
+ check_cmd = re.search(r'if ! applypatch -c \w+:.+:\w+:(\w+);',
+ lines[1].strip())
+ expected_recovery_check_sha1 = check_cmd.group(1)
+ patch_cmd = re.search(r'(applypatch.+)&&', lines[2].strip())
+ applypatch_argv = patch_cmd.group(1).strip().split()
+
+ full_recovery_image = info_dict.get("full_recovery_image") == "true"
+ if full_recovery_image:
+ assert len(applypatch_argv) == 5
+ # Check we have the same expected SHA-1 of recovery.img in both check mode
+ # and patch mode.
+ expected_recovery_sha1 = applypatch_argv[3].strip()
+ assert expected_recovery_check_sha1 == expected_recovery_sha1
+ ValidateFileAgainstSha1(input_tmp, 'recovery.img',
+ 'SYSTEM/etc/recovery.img', expected_recovery_sha1)
+ else:
+ # We're patching boot.img to get recovery.img where bonus_args is optional
+ if applypatch_argv[1] == "-b":
+ assert len(applypatch_argv) == 8
+ boot_info_index = 3
+ else:
+ assert len(applypatch_argv) == 6
+ boot_info_index = 1
+
+ # boot_info: boot_type:boot_device:boot_size:boot_sha1
+ boot_info = applypatch_argv[boot_info_index].strip().split(':')
+ assert len(boot_info) == 4
+ ValidateFileAgainstSha1(input_tmp, file_name='boot.img',
+ file_path='IMAGES/boot.img', expected_sha1=boot_info[3])
+
+ recovery_sha1_index = boot_info_index + 2
+ expected_recovery_sha1 = applypatch_argv[recovery_sha1_index]
+ assert expected_recovery_check_sha1 == expected_recovery_sha1
+ ValidateFileAgainstSha1(input_tmp, file_name='recovery.img',
+ file_path='IMAGES/recovery.img',
+ expected_sha1=expected_recovery_sha1)
+
+ logging.info('Done checking {}'.format(script_path))
+
+
def main(argv):
def option_handler():
return True
@@ -112,11 +205,12 @@
ValidateFileConsistency(input_zip, input_tmp)
+ info_dict = common.LoadInfoDict(input_tmp)
+ ValidateInstallRecoveryScript(input_tmp, info_dict)
+
# TODO: Check if the OTA keys have been properly updated (the ones on /system,
# in recovery image).
- # TODO(b/35411009): Verify the contents in /system/bin/install-recovery.sh.
-
logging.info("Done.")
diff --git a/tools/warn.py b/tools/warn.py
index be659b8..44ad368 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -2427,7 +2427,7 @@
if warning_pattern.match(line):
line = normalize_warning_line(line)
warning_lines.add(line)
- elif line_counter < 50:
+ elif line_counter < 100:
# save a little bit of time by only doing this for the first few lines
line_counter += 1
m = re.search('(?<=^PLATFORM_VERSION=).*', line)