Merge "Removing --flag 2 when building GSI vbmeta.img"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 3f1721f..a82a0bd 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -625,6 +625,8 @@
# Clean up adb_debug.propr
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/adb_debug.prop)
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/libjavacrypto.so)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index e8e592a..603ad10 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -421,7 +421,6 @@
BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
- AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
PLATFORM_VERSION="$(PLATFORM_VERSION)" \
PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
@@ -498,6 +497,9 @@
ifdef TARGET_SCREEN_DENSITY
$(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@
endif
+ifeq ($(AB_OTA_UPDATER),true)
+ $(hide) echo ro.build.ab_update=true >> $@
+endif
$(hide) $(call generate-common-build-props,vendor,$@)
$(hide) echo "#" >> $@; \
echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
@@ -1980,14 +1982,19 @@
$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir)
$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
-# We should have just depended on ramdisk.img or ramdisk-recovery.img.
-# But ramdisk-recovery.img is not a make target, so let's depend on the boot.img directly.
+
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+# ramdisk-recovery.img isn't a make target, need to depend on boot.img if it's for recovery.
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_BOOTIMAGE_TARGET)
+else
+# Depends on ramdisk.img, note that some target has ramdisk.img but no boot.img, e.g., emulator.
+$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET)
+endif # BOARD_USES_RECOVERY_AS_BOOT
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(MINIGZIP)
$(call pretty,"Target debug ram disk: $@")
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
- rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/* $(DEBUG_RAMDISK_ROOT_DIR)
+ rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
$(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $@
.PHONY: ramdisk_debug-nodeps
@@ -1997,7 +2004,7 @@
echo "make $@: ignoring dependencies"
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
- rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/* $(DEBUG_RAMDISK_ROOT_DIR)
+ rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
$(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
my_debug_ramdisk_sync_dir :=
@@ -2063,29 +2070,6 @@
FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
# -----------------------------------------------------------------
-# Final System VINTF manifest including fragments. This is not assembled
-# on the device because it depends on everything in a given device
-# image which defines a vintf_fragment.
-
-ifdef BUILDING_SYSTEM_IMAGE
-
-BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
-$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
-$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
-$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
-$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
- @echo "Verifying system VINTF manifest."
- PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
- $(HOST_OUT_EXECUTABLES)/assemble_vintf \
- -c $(BUILT_VENDOR_MATRIX) \
- -i $(BUILT_SYSTEM_MANIFEST) \
- $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
- find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
- sed "s/^/-i /" | tr '\n' ' ') -o $@
-
-endif # BUILDING_SYSTEM_IMAGE
-
-# -----------------------------------------------------------------
ifdef BUILDING_SYSTEM_IMAGE
# installed file list
@@ -2191,9 +2175,10 @@
# libprofile.so
# libsigchain.so - cf_x86_phone-userdebug builds get this in system/lib/arm
# libtombstoned_client.so
-APEX_MODULE_LIBS= \
+APEX_MODULE_LIBS := \
libadbconnection.so \
libandroidicu.so \
+ libandroidio.so \
libdt_fd_forward.so \
libdt_socket.so \
libjavacore.so \
@@ -2206,6 +2191,10 @@
libopenjdkjvmti.so \
libpac.so \
+# Conscrypt APEX_MODULE_LIBS
+APEX_MODULE_LIBS += \
+ libjavacrypto.so \
+
# An option to disable the check below, for local use since some build targets
# still may create these libraries in /system (b/129006418).
DISABLE_APEX_LIBS_ABSENCE_CHECK ?=
@@ -2217,7 +2206,10 @@
# on the native architecture.
# TODO(b/130630776): Introduce a make variable for the appropriate directory
# when native bridge is active.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE=lib/arm lib/arm64
+APEX_LIBS_ABSENCE_CHECK_EXCLUDE := lib/arm lib/arm64
+
+# Exclude vndk-sp-* subdirectories which contain prebuilts from older releases.
+APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/vndk-% lib64/vndk-%
# If the check below fails, some library has ended up in system/lib or
# system/lib64 that is intended to only go into some APEX package. The likely
@@ -2245,7 +2237,7 @@
$(hide) ( \
cd $(TARGET_OUT) && \
findres=$$(find lib* \
- $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path $(dir) -prune -o) \
+ $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "$(subst %,*,$(dir))" -prune -o) \
-type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
-print) && \
if [ -n "$$findres" ]; then \
@@ -2277,7 +2269,6 @@
exit 1 )
endef
-$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
$(call build-systemimage-target,$@)
@@ -2911,6 +2902,52 @@
endif
# -----------------------------------------------------------------
+# Final Framework VINTF manifest including fragments. This is not assembled
+# on the device because it depends on everything in a given device
+# image which defines a vintf_fragment.
+
+ifdef BUILDING_SYSTEM_IMAGE
+
+ifndef BOARD_USES_PRODUCTIMAGE
+ # If no product image at all, check system manifest directly against device matrix.
+ check_framework_manifest := true
+else ifdef BUILDING_PRODUCT_IMAGE
+ # If device has a product image, only check if the product image is built.
+ check_framework_manifest := true
+endif
+
+# TODO (b/131425279): delete this line once build_mixed script can correctly merge system and
+# product manifests.
+check_framework_manifest := true
+
+ifeq ($(check_framework_manifest),true)
+
+BUILT_ASSEMBLED_FRAMEWORK_MANIFEST := $(PRODUCT_OUT)/verified_assembled_framework_manifest.xml
+$(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf \
+ $(BUILT_VENDOR_MATRIX) \
+ $(BUILT_SYSTEM_MANIFEST) \
+ $(FULL_SYSTEMIMAGE_DEPS) \
+ $(BUILT_PRODUCT_MANIFEST) \
+ $(BUILT_PRODUCTIMAGE_TARGET)
+ @echo "Verifying framework VINTF manifest."
+ PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
+ $(HOST_OUT_EXECUTABLES)/assemble_vintf \
+ -o $@ \
+ -c $(BUILT_VENDOR_MATRIX) \
+ -i $(BUILT_SYSTEM_MANIFEST) \
+ $(addprefix -i ,\
+ $(filter $(TARGET_OUT)/etc/vintf/manifest/%.xml,$(FULL_SYSTEMIMAGE_DEPS)) \
+ $(BUILT_PRODUCT_MANIFEST) \
+ $(filter $(TARGET_OUT_PRODUCT)/etc/vintf/manifest/%.xml,$(INTERNAL_PRODUCTIMAGE_FILES)))
+
+droidcore: $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST)
+
+endif # check_framework_manifest
+check_framework_manifest :=
+
+endif # BUILDING_SYSTEM_IMAGE
+
+# -----------------------------------------------------------------
# product_services partition image
ifdef BUILDING_PRODUCT_SERVICES_IMAGE
INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
@@ -3802,7 +3839,7 @@
$(HOST_OUT_EXECUTABLES)/bsdiff \
$(HOST_OUT_EXECUTABLES)/care_map_generator \
$(BUILD_IMAGE_SRCS) \
- $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
+ $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) \
$(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
$(BUILT_SYSTEM_MATRIX) \
$(BUILT_VENDOR_MATRIX) \
@@ -4149,8 +4186,8 @@
endif
@# Metadata for compatibility verification.
$(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
-ifdef BUILT_ASSEMBLED_SYSTEM_MANIFEST
- $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
+ifdef BUILT_ASSEMBLED_FRAMEWORK_MANIFEST
+ $(hide) cp $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) $(zip_root)/META/system_manifest.xml
endif
ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
$(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
@@ -4434,7 +4471,7 @@
endif # TARGET_BUILD_APPS
# -----------------------------------------------------------------
-# super partition image
+# super partition image (dist)
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
@@ -4449,31 +4486,83 @@
endef
ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
-INSTALLED_SUPERIMAGE_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img
-$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
-$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
- $(call pretty,"Target super fs image: $@")
+
+# For real devices and for dist builds, build super image from target files to an intermediate directory.
+INTERNAL_SUPERIMAGE_DIST_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img
+$(INTERNAL_SUPERIMAGE_DIST_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
+$(INTERNAL_SUPERIMAGE_DIST_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
+ $(call pretty,"Target super fs image from target files: $@")
PATH=$(dir $(LPMAKE)):$$PATH \
$(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
-# supernod uses images in the $(PRODUCT_OUT) directory instead of images from target files package.
-.PHONY: superimage-nodeps supernod
-superimage-nodeps supernod: intermediates := $(call intermediates-dir-for,PACKAGING,superimage-nodeps)
-superimage-nodeps supernod: | $(LPMAKE) $(BUILD_SUPER_IMAGE) \
- $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
- $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies")
- mkdir -p $(intermediates)
- rm -rf $(intermediates)/misc_info.txt
- $(call dump-super-image-info,$(intermediates)/misc_info.txt)
- $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
- echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(intermediates)/misc_info.txt;)
- mkdir -p $(dir $(INSTALLED_SUPERIMAGE_TARGET))
- PATH=$(dir $(LPMAKE)):$$PATH \
- $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $(INSTALLED_SUPERIMAGE_TARGET)
+$(call dist-for-goals,dist_files,$(INTERNAL_SUPERIMAGE_DIST_TARGET))
+
+.PHONY: superimage_dist
+superimage_dist: $(INTERNAL_SUPERIMAGE_DIST_TARGET)
endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
+endif # BOARD_SUPER_PARTITION_SIZE != ""
+endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
-$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
+# -----------------------------------------------------------------
+# super partition image for development
+
+ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
+ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
+ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
+
+# Build super.img by using $(INSTALLED_*IMAGE_TARGET) to $(1)
+# $(1): built image path
+# $(2): misc_info.txt path; its contents should match expectation of build_super_image.py
+define build-superimage-target
+ mkdir -p $(dir $(2))
+ rm -rf $(2)
+ $(call dump-super-image-info,$(2))
+ $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
+ echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(2);)
+ mkdir -p $(dir $(1))
+ PATH=$(dir $(LPMAKE)):$$PATH \
+ $(BUILD_SUPER_IMAGE) -v $(2) $(1)
+endef
+
+INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
+INSTALLED_SUPERIMAGE_DEPENDENCIES := $(LPMAKE) $(BUILD_SUPER_IMAGE) \
+ $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
+
+# If BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT is set, super.img is built from images in the
+# $(PRODUCT_OUT) directory, and is built to $(PRODUCT_OUT)/super.img. Also, it will
+# be built for non-dist builds. This is useful for devices that uses super.img directly, e.g.
+# virtual devices.
+ifeq (true,$(BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT))
+$(INSTALLED_SUPERIMAGE_TARGET): $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
+ $(call pretty,"Target super fs image for debug: $@")
+ $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
+ $(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt)
+
+droidcore: $(INSTALLED_SUPERIMAGE_TARGET)
+
+# For devices that uses super image directly, the superimage target points to the file in $(PRODUCT_OUT).
+.PHONY: superimage
+superimage: $(INSTALLED_SUPERIMAGE_TARGET)
+endif # BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT
+
+# Build $(PRODUCT_OUT)/super.img without dependencies.
+.PHONY: superimage-nodeps supernod
+superimage-nodeps supernod: intermediates :=
+superimage-nodeps supernod: | $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
+ $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies")
+ $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
+ $(call intermediates-dir-for,PACKAGING,superimage-nodeps)/misc_info.txt)
+
+endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
+endif # BOARD_SUPER_PARTITION_SIZE != ""
+endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
+
+# -----------------------------------------------------------------
+# super empty image
+
+ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
+ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
diff --git a/core/definitions.mk b/core/definitions.mk
index 1f5c5ce..aa2a2a9 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1997,26 +1997,6 @@
@$(call emit-line,$(wordlist 13001,13500,$(1)),$(2))
@$(if $(wordlist 13501,13502,$(1)),$(error Too many words ($(words $(1)))))
endef
-
-# For a list of jar files, unzip them to a specified directory,
-# but make sure that no META-INF files come along for the ride,
-# unless PRIVATE_DONT_DELETE_JAR_META_INF is set.
-#
-# $(1): files to unzip
-# $(2): destination directory
-define unzip-jar-files
- $(hide) for f in $(1); \
- do \
- if [ ! -f $$f ]; then \
- echo Missing file $$f; \
- exit 1; \
- fi; \
- unzip -qo $$f -d $(2); \
- rm -f $(2)/module-info.class; \
- done
- $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(2)/META-INF)
-endef
-
# Return jar arguments to compress files in a given directory
# $(1): directory
#
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 2a251e8..1545f63 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -104,7 +104,6 @@
ifneq ($(TURBINE_ENABLED),false)
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
-$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
$(full_classes_turbine_jar): \
$(java_source_list_file) \
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index c8d2ee7..f7bf337 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -95,13 +95,15 @@
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
.PHONY: javac-check-$(LOCAL_MODULE)
+$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_combined_jar): $(full_classes_compiled_jar) \
$(jar_manifest_file) \
$(full_static_java_libs) | $(MERGE_ZIPS)
$(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
$(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
- -stripDir META-INF -zipToNotStrip $< $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
+ $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
+ $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
# Run jarjar if necessary, otherwise just copy the file.
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
diff --git a/core/java.mk b/core/java.mk
index 40fa594..afc77d6 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -244,7 +244,6 @@
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
-$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_turbine_jar): \
$(java_source_list_file) \
$(java_sources_deps) \
@@ -278,7 +277,6 @@
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
-$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
$(full_classes_compiled_jar): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
diff --git a/core/main.mk b/core/main.mk
index af26705..7e1bdd5 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1469,9 +1469,6 @@
.PHONY: systemotherimage
systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
-.PHONY: superimage
-superimage: $(INSTALLED_SUPERIMAGE_TARGET)
-
.PHONY: superimage_empty
superimage_empty: $(INSTALLED_SUPERIMAGE_EMPTY_TARGET)
diff --git a/core/notice_files.mk b/core/notice_files.mk
index e687ab2..c314734 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -38,6 +38,8 @@
endif
endif
+installed_notice_file :=
+
ifdef notice_file
ifdef my_register_name
@@ -71,12 +73,17 @@
endif
module_installed_filename := \
$(patsubst $(PRODUCT_OUT)/%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)
+ else ifeq ($(LOCAL_MODULE_CLASS),ETC)
+ # ETC modules may be uninstallable, yet still have a NOTICE file. e.g. apex components
+ module_installed_filename :=
else
$(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
endif # JAVA_LIBRARIES
endif # STATIC_LIBRARIES
endif
+ifdef module_installed_filename
+
# In case it's actually a host file
module_installed_filename := $(patsubst $(HOST_OUT)/%,%,$(module_installed_filename))
module_installed_filename := $(patsubst $(HOST_CROSS_OUT)/%,%,$(module_installed_filename))
@@ -110,10 +117,8 @@
endif # JAVA_LIBRARIES
endif # TARGET_BUILD_APPS
-else
-# NOTICE file does not exist
-installed_notice_file :=
-endif
+endif # module_installed_filename
+endif # notice_file
# Create a predictable, phony target to build this notice file.
# Define it even if the notice file doesn't exist so that other
diff --git a/core/proguard_basic_keeps.flags b/core/proguard_basic_keeps.flags
index 256b2ec..a0f577d 100644
--- a/core/proguard_basic_keeps.flags
+++ b/core/proguard_basic_keeps.flags
@@ -1,6 +1,3 @@
-# To prevent name conflict in incremental obfuscation.
--useuniqueclassmembernames
-
# Some classes in the libraries extend package private classes to chare common functionality
# that isn't explicitly part of the API
-dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 46e026a..19326dd 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -149,6 +149,7 @@
$(call add_json_list, BoardOdmSepolicyDirs, $(BOARD_ODM_SEPOLICY_DIRS))
$(call add_json_list, BoardPlatPublicSepolicyDirs, $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
$(call add_json_list, BoardPlatPrivateSepolicyDirs, $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
+$(call add_json_list, BoardSepolicyM4Defs, $(BOARD_SEPOLICY_M4DEFS))
$(call add_json_bool, FlattenApex, $(filter true,$(TARGET_FLATTEN_APEX)))
@@ -165,6 +166,10 @@
$(call add_json_list, ProductHiddenAPIStubsSystem, $(PRODUCT_HIDDENAPI_STUBS_SYSTEM))
$(call add_json_list, ProductHiddenAPIStubsTest, $(PRODUCT_HIDDENAPI_STUBS_TEST))
+$(call add_json_list, ProductPublicSepolicyDirs, $(PRODUCT_PUBLIC_SEPOLICY_DIRS))
+$(call add_json_list, ProductPrivateSepolicyDirs, $(PRODUCT_PRIVATE_SEPOLICY_DIRS))
+$(call add_json_bool, ProductCompatibleProperty, $(PRODUCT_COMPATIBLE_PROPERTY))
+
$(call add_json_list, TargetFSConfigGen, $(TARGET_FS_CONFIG_GEN))
$(call add_json_map, VendorVars)
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 9692a99..6a76fc4 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -51,6 +51,13 @@
$(intermediates.COMMON)/jacoco-report-classes.jar)
endif
+ifdef LOCAL_SOONG_PROGUARD_DICT
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
+ $(intermediates.COMMON)/proguard_dictionary))
+ $(call add-dependency,$(LOCAL_BUILT_MODULE),\
+ $(intermediates.COMMON)/proguard_dictionary)
+endif
+
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
my_res_package := $(intermediates.COMMON)/package-res.apk
diff --git a/target/product/base_product.mk b/target/product/base_product.mk
index 1ed9e83..82557bf 100644
--- a/target/product/base_product.mk
+++ b/target/product/base_product.mk
@@ -19,3 +19,4 @@
healthd \
ModuleMetadata \
product_compatibility_matrix.xml \
+ product_manifest.xml \
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index e9e8b49..23289f5 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -268,7 +268,7 @@
# VINTF data for system image
PRODUCT_PACKAGES += \
- framework_manifest.xml \
+ system_manifest.xml \
system_compatibility_matrix.xml \
# Host tools to install
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index 24ac663..09d8f70 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -25,9 +25,6 @@
if [ -n "$BOARD_BUILD_SYSTEM_ROOT_IMAGE" ] ; then
echo "ro.build.system_root_image=$BOARD_BUILD_SYSTEM_ROOT_IMAGE"
fi
-if [ -n "$AB_OTA_UPDATER" ] ; then
- echo "ro.build.ab_update=$AB_OTA_UPDATER"
-fi
# These values are deprecated, use "ro.product.cpu.abilist"
# instead (see below).
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 10aecf9..4af10ca 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -113,22 +113,33 @@
Returns:
(which, care_map_ranges): care_map_ranges is the raw string of the care_map
- RangeSet.
+ RangeSet; or an empty list.
"""
assert which in common.PARTITIONS_WITH_CARE_MAP
- simg = sparse_img.SparseImage(imgname)
- care_map_ranges = simg.care_map
- size_key = which + "_image_size"
- image_size = OPTIONS.info_dict.get(size_key)
- if image_size:
- # excludes the verity metadata blocks of the given image. When AVB is enabled,
- # this size is the max image size returned by the AVB tool
- image_blocks = int(image_size) / 4096 - 1
- assert image_blocks > 0, "blocks for {} must be positive".format(which)
- care_map_ranges = care_map_ranges.intersect(
+ # which + "_image_size" contains the size that the actual filesystem image
+ # resides in, which is all that needs to be verified. The additional blocks in
+ # the image file contain verity metadata, by reading which would trigger
+ # invalid reads.
+ image_size = OPTIONS.info_dict.get(which + "_image_size")
+ if not image_size:
+ return []
+
+ image_blocks = int(image_size) / 4096 - 1
+ assert image_blocks > 0, "blocks for {} must be positive".format(which)
+
+ # For sparse images, we will only check the blocks that are listed in the care
+ # map, i.e. the ones with meaningful data.
+ if "extfs_sparse_flag" in OPTIONS.info_dict:
+ simg = sparse_img.SparseImage(imgname)
+ care_map_ranges = simg.care_map.intersect(
rangelib.RangeSet("0-{}".format(image_blocks)))
+ # Otherwise for non-sparse images, we read all the blocks in the filesystem
+ # image.
+ else:
+ care_map_ranges = rangelib.RangeSet("0-{}".format(image_blocks))
+
return [which, care_map_ranges.to_string_raw()]
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 941ef65..e1105bb 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -15,11 +15,18 @@
# limitations under the License.
"""
-Given a target-files zipfile, produces an image zipfile suitable for
-use with 'fastboot update'.
+Given target-files, produces an image zipfile suitable for use
+with 'fastboot update'.
Usage: img_from_target_files [flags] input_target_files output_image_zip
+input_target_files: one of the following:
+ - directory containing extracted target files. It will load info from
+ OTA/android-info.txt and build the image zipfile using images from IMAGES/.
+ - target files package. Same as above, but extracts the archive before
+ building the image zipfile.
+
+Flags:
-z (--bootable_zip)
Include only the bootable images (eg 'boot' and 'recovery') in
the output.
@@ -76,7 +83,16 @@
common.InitLogging()
- OPTIONS.input_tmp = common.UnzipTemp(args[0], ["IMAGES/*", "OTA/*"])
+ target_files = args[0]
+ if os.path.isdir(target_files):
+ logger.info("Building image zip from extracted target files.")
+ OPTIONS.input_tmp = target_files
+ elif zipfile.is_zipfile(target_files):
+ logger.info("Building image zip from target files zip.")
+ OPTIONS.input_tmp = common.UnzipTemp(args[0], ["IMAGES/*", "OTA/*"])
+ else:
+ raise ValueError("%s is not a valid path." % target_files)
+
output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
CopyInfo(output_zip)
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index 2e5cbca..689e095 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -80,6 +80,7 @@
import logging
import os
import shutil
+import subprocess
import sys
import zipfile
@@ -698,6 +699,16 @@
if output_super_empty:
shutil.copyfile(super_empty_img, output_super_empty)
+ # Create the IMG package from the merged target files (before zipping, in
+ # order to avoid an unnecessary unzip and copy).
+
+ if output_img:
+ img_from_target_files_args = [
+ output_target_files_temp_dir,
+ output_img,
+ ]
+ img_from_target_files.main(img_from_target_files_args)
+
# Finally, create the output target files zip archive and/or copy the
# output items to the output target files directory.
@@ -712,18 +723,21 @@
output_target_files_meta_dir = os.path.join(output_target_files_temp_dir,
'META')
- command = [
+ find_command = [
'find',
output_target_files_meta_dir,
]
- # TODO(bpeckham): sort this to be more like build.
- meta_content = common.RunAndCheckOutput(command, verbose=False)
- command = [
+ find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False)
+ meta_content = common.RunAndCheckOutput(['sort'], stdin=find_process.stdout,
+ verbose=False)
+
+ find_command = [
'find', output_target_files_temp_dir, '-path',
output_target_files_meta_dir, '-prune', '-o', '-print'
]
- # TODO(bpeckham): sort this to be more like build.
- other_content = common.RunAndCheckOutput(command, verbose=False)
+ find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False)
+ other_content = common.RunAndCheckOutput(['sort'], stdin=find_process.stdout,
+ verbose=False)
with open(output_target_files_list, 'wb') as f:
f.write(meta_content)
@@ -751,14 +765,6 @@
]
ota_from_target_files.main(ota_from_target_files_args)
- # Create the IMG package from the merged target files package.
-
- if output_img:
- img_from_target_files_args = [
- output_zip,
- output_img,
- ]
- img_from_target_files.main(img_from_target_files_args)
def call_func_with_temp_dir(func, keep_tmp):
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index dd3e190..f686ca0 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -318,13 +318,24 @@
@property
def vendor_fingerprint(self):
- if "vendor.build.prop" not in self.info_dict:
+ return self._fingerprint_of("vendor")
+
+ @property
+ def product_fingerprint(self):
+ return self._fingerprint_of("product")
+
+ @property
+ def odm_fingerprint(self):
+ return self._fingerprint_of("odm")
+
+ def _fingerprint_of(self, partition):
+ if partition + ".build.prop" not in self.info_dict:
return None
- vendor_build_prop = self.info_dict["vendor.build.prop"]
- if "ro.vendor.build.fingerprint" in vendor_build_prop:
- return vendor_build_prop["ro.vendor.build.fingerprint"]
- if "ro.vendor.build.thumbprint" in vendor_build_prop:
- return vendor_build_prop["ro.vendor.build.thumbprint"]
+ build_prop = self.info_dict[partition + ".build.prop"]
+ if "ro." + partition + ".build.fingerprint" in build_prop:
+ return build_prop["ro." + partition + ".build.fingerprint"]
+ if "ro." + partition + ".build.thumbprint" in build_prop:
+ return build_prop["ro." + partition + ".build.thumbprint"]
return None
@property
@@ -692,14 +703,26 @@
"SYSTEM/etc/recovery.img" in namelist)
-def HasVendorPartition(target_files_zip):
+def HasPartition(target_files_zip, partition):
try:
- target_files_zip.getinfo("VENDOR/")
+ target_files_zip.getinfo(partition.upper() + "/")
return True
except KeyError:
return False
+def HasVendorPartition(target_files_zip):
+ return HasPartition(target_files_zip, "vendor")
+
+
+def HasProductPartition(target_files_zip):
+ return HasPartition(target_files_zip, "product")
+
+
+def HasOdmPartition(target_files_zip):
+ return HasPartition(target_files_zip, "odm")
+
+
def HasTrebleEnabled(target_files_zip, target_info):
return (HasVendorPartition(target_files_zip) and
target_info.GetBuildProp("ro.treble.enabled") == "true")
@@ -745,23 +768,24 @@
generating an incremental OTA; None otherwise.
"""
- def AddCompatibilityArchive(system_updated, vendor_updated):
- """Adds compatibility info based on system/vendor update status.
+ def AddCompatibilityArchive(framework_updated, device_updated):
+ """Adds compatibility info based on update status of both sides of Treble
+ boundary.
Args:
- system_updated: If True, the system image will be updated and therefore
- its metadata should be included.
- vendor_updated: If True, the vendor image will be updated and therefore
- its metadata should be included.
+ framework_updated: If True, the system / product image will be updated
+ and therefore their metadata should be included.
+ device_updated: If True, the vendor / odm image will be updated and
+ therefore their metadata should be included.
"""
# Determine what metadata we need. Files are names relative to META/.
compatibility_files = []
- vendor_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
- system_metadata = ("system_manifest.xml", "system_matrix.xml")
- if vendor_updated:
- compatibility_files += vendor_metadata
- if system_updated:
- compatibility_files += system_metadata
+ device_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
+ framework_metadata = ("system_manifest.xml", "system_matrix.xml")
+ if device_updated:
+ compatibility_files += device_metadata
+ if framework_updated:
+ compatibility_files += framework_metadata
# Create new archive.
compatibility_archive = tempfile.NamedTemporaryFile()
@@ -785,6 +809,11 @@
arcname="compatibility.zip",
compress_type=zipfile.ZIP_STORED)
+ def FingerprintChanged(source_fp, target_fp):
+ if source_fp is None or target_fp is None:
+ return True
+ return source_fp != target_fp
+
# Will only proceed if the target has enabled the Treble support (as well as
# having a /vendor partition).
if not HasTrebleEnabled(target_zip, target_info):
@@ -795,7 +824,7 @@
if OPTIONS.skip_compatibility_check:
return
- # Full OTA carries the info for system/vendor both.
+ # Full OTA carries the info for system/vendor/product/odm
if source_info is None:
AddCompatibilityArchive(True, True)
return
@@ -804,16 +833,19 @@
target_fp = target_info.fingerprint
system_updated = source_fp != target_fp
- source_fp_vendor = source_info.vendor_fingerprint
- target_fp_vendor = target_info.vendor_fingerprint
- # vendor build fingerprints could be possibly blacklisted at build time. For
- # such a case, we consider the vendor images being changed.
- if source_fp_vendor is None or target_fp_vendor is None:
- vendor_updated = True
- else:
- vendor_updated = source_fp_vendor != target_fp_vendor
+ # other build fingerprints could be possibly blacklisted at build time. For
+ # such a case, we consider those images being changed.
+ vendor_updated = FingerprintChanged(source_info.vendor_fingerprint,
+ target_info.vendor_fingerprint)
+ product_updated = HasProductPartition(target_zip) and \
+ FingerprintChanged(source_info.product_fingerprint,
+ target_info.product_fingerprint)
+ odm_updated = HasOdmPartition(target_zip) and \
+ FingerprintChanged(source_info.odm_fingerprint,
+ target_info.odm_fingerprint)
- AddCompatibilityArchive(system_updated, vendor_updated)
+ AddCompatibilityArchive(system_updated or product_updated,
+ vendor_updated or odm_updated)
def WriteFullOTAPackage(input_zip, output_file):
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 9aa9499..7b5f000 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -176,6 +176,9 @@
Returns:
A dict that contains the updated APEX key mapping, which should be used for
the current signing.
+
+ Raises:
+ AssertionError: On invalid container / payload key overrides.
"""
# Apply all the --extra_apex_payload_key options to override the payload
# signing keys in the given keys_info.
@@ -197,6 +200,24 @@
key = 'PRESIGNED'
keys_info[apex] = (keys_info[apex][0], key_map.get(key, key))
+ # A PRESIGNED container entails a PRESIGNED payload. Apply this to all the
+ # APEX key pairs. However, a PRESIGNED container with non-PRESIGNED payload
+ # (overridden via commandline) indicates a config error, which should not be
+ # allowed.
+ for apex, (payload_key, container_key) in keys_info.items():
+ if container_key != 'PRESIGNED':
+ continue
+ if apex in OPTIONS.extra_apex_payload_keys:
+ payload_override = OPTIONS.extra_apex_payload_keys[apex]
+ assert payload_override == '', \
+ ("Invalid APEX key overrides: {} has PRESIGNED container but "
+ "non-PRESIGNED payload key {}").format(apex, payload_override)
+ if payload_key != 'PRESIGNED':
+ print(
+ "Setting {} payload as PRESIGNED due to PRESIGNED container".format(
+ apex))
+ keys_info[apex] = ('PRESIGNED', 'PRESIGNED')
+
return keys_info
@@ -289,7 +310,9 @@
"not sign this apk).".format("\n ".join(unknown_files)))
# For all the APEXes, double check that we won't have an APEX that has only
- # one of the payload / container keys set.
+ # one of the payload / container keys set. Note that non-PRESIGNED container
+ # with PRESIGNED payload could be allowed but currently unsupported. It would
+ # require changing SignApex implementation.
if not apex_keys:
return
@@ -1074,13 +1097,16 @@
# full names only.
container_cert = matches.group("CONTAINER_CERT")
container_private_key = matches.group("CONTAINER_PRIVATE_KEY")
- if not CompareKeys(
+ if container_cert == 'PRESIGNED' and container_private_key == 'PRESIGNED':
+ container_key = 'PRESIGNED'
+ elif CompareKeys(
container_cert, OPTIONS.public_key_suffix,
container_private_key, OPTIONS.private_key_suffix):
+ container_key = container_cert[:-len(OPTIONS.public_key_suffix)]
+ else:
raise ValueError("Failed to parse container keys: \n{}".format(line))
- keys[name] = (payload_private_key,
- container_cert[:-len(OPTIONS.public_key_suffix)])
+ keys[name] = (payload_private_key, container_key)
return keys
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index 013ade6..422262c 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -123,6 +123,9 @@
def _test_AddCareMapForAbOta():
"""Helper function to set up the test for test_AddCareMapForAbOta()."""
OPTIONS.info_dict = {
+ 'extfs_sparse_flag' : '-s',
+ 'system_image_size' : 65536,
+ 'vendor_image_size' : 40960,
'system_verity_block_device': '/dev/block/system',
'vendor_verity_block_device': '/dev/block/vendor',
'system.build.prop': {
@@ -131,7 +134,7 @@
},
'vendor.build.prop': {
'ro.vendor.build.fingerprint': 'google/sailfish/678:user/dev-keys',
- }
+ },
}
# Prepare the META/ folder.
@@ -142,9 +145,9 @@
system_image = test_utils.construct_sparse_image([
(0xCAC1, 6),
(0xCAC3, 4),
- (0xCAC1, 6)])
+ (0xCAC1, 8)])
vendor_image = test_utils.construct_sparse_image([
- (0xCAC2, 10)])
+ (0xCAC2, 12)])
image_paths = {
'system' : system_image,
@@ -203,6 +206,9 @@
"""Tests the case for device using AVB."""
image_paths = self._test_AddCareMapForAbOta()
OPTIONS.info_dict = {
+ 'extfs_sparse_flag' : '-s',
+ 'system_image_size' : 65536,
+ 'vendor_image_size' : 40960,
'avb_system_hashtree_enable' : 'true',
'avb_vendor_hashtree_enable' : 'true',
'system.build.prop': {
@@ -231,6 +237,9 @@
"""Tests the case for partitions without fingerprint."""
image_paths = self._test_AddCareMapForAbOta()
OPTIONS.info_dict = {
+ 'extfs_sparse_flag' : '-s',
+ 'system_image_size' : 65536,
+ 'vendor_image_size' : 40960,
'system_verity_block_device': '/dev/block/system',
'vendor_verity_block_device': '/dev/block/vendor',
}
@@ -249,6 +258,9 @@
"""Tests the case for partitions with thumbprint."""
image_paths = self._test_AddCareMapForAbOta()
OPTIONS.info_dict = {
+ 'extfs_sparse_flag' : '-s',
+ 'system_image_size' : 65536,
+ 'vendor_image_size' : 40960,
'system_verity_block_device': '/dev/block/system',
'vendor_verity_block_device': '/dev/block/vendor',
'system.build.prop': {
@@ -256,7 +268,7 @@
},
'vendor.build.prop' : {
'ro.vendor.build.thumbprint': 'google/sailfish/456:user/dev-keys',
- }
+ },
}
AddCareMapForAbOta(None, ['system', 'vendor'], image_paths)
@@ -370,6 +382,7 @@
(0xCAC3, 4),
(0xCAC1, 6)])
OPTIONS.info_dict = {
+ 'extfs_sparse_flag' : '-s',
'system_image_size' : 53248,
}
name, care_map = GetCareMap('system', sparse_image)
@@ -385,6 +398,17 @@
(0xCAC3, 4),
(0xCAC1, 6)])
OPTIONS.info_dict = {
+ 'extfs_sparse_flag' : '-s',
'system_image_size' : -45056,
}
self.assertRaises(AssertionError, GetCareMap, 'system', sparse_image)
+
+ def test_GetCareMap_nonSparseImage(self):
+ OPTIONS.info_dict = {
+ 'system_image_size' : 53248,
+ }
+ # 'foo' is the image filename, which is expected to be not used by
+ # GetCareMap().
+ name, care_map = GetCareMap('system', 'foo')
+ self.assertEqual('system', name)
+ self.assertEqual(RangeSet("0-12").to_string_raw(), care_map)
diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py
index d745200..a7bf977 100644
--- a/tools/releasetools/test_sign_target_files_apks.py
+++ b/tools/releasetools/test_sign_target_files_apks.py
@@ -461,3 +461,26 @@
'system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem',
'build/make/target/product/security/testkey'),
}, keys_info)
+
+ def test_ReadApexKeysInfo_presignedKeys(self):
+ apex_keys = self.APEX_KEYS_TXT + (
+ 'name="apex.apexd_test_different_app2.apex" '
+ 'private_key="PRESIGNED" '
+ 'public_key="PRESIGNED" '
+ 'container_certificate="PRESIGNED" '
+ 'container_private_key="PRESIGNED"')
+ target_files = common.MakeTempFile(suffix='.zip')
+ with zipfile.ZipFile(target_files, 'w') as target_files_zip:
+ target_files_zip.writestr('META/apexkeys.txt', apex_keys)
+
+ with zipfile.ZipFile(target_files) as target_files_zip:
+ keys_info = ReadApexKeysInfo(target_files_zip)
+
+ self.assertEqual({
+ 'apex.apexd_test.apex': (
+ 'system/apex/apexd/apexd_testdata/com.android.apex.test_package.pem',
+ 'build/make/target/product/security/testkey'),
+ 'apex.apexd_test_different_app.apex': (
+ 'system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem',
+ 'build/make/target/product/security/testkey'),
+ }, keys_info)