Merge "Relax inode usage estimation slack for DAP right sizing"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 8058d86..91e6e66 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -522,6 +522,9 @@
# Clean up aidegen
$(call add-clean-step, rm -f $(HOST_OUT)/bin/aidegen)
+# Remove perfprofd
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/perfprofd)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 6226d6b..5adb239 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1537,11 +1537,110 @@
recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
endif
+
+# We will only generate the recovery background text images if the variable
+# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
+# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
+# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
+# BoardConfig in order to use this feature.
+ifeq ($(recovery_density),xxxhdpi)
+TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
+else ifeq ($(recovery_density),xxhdpi)
+TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
+endif
+
+ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
+# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
+ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
+ recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
+else
+ recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
+endif
+
+
+RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
+RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
+RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
+RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
+RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
+
+RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
+RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
+RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
+RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
+RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
+
+generated_recovery_text_files := \
+ $(RECOVERY_INSTALLING_TEXT_FILE) \
+ $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
+ $(RECOVERY_ERASING_TEXT_FILE) \
+ $(RECOVERY_ERROR_TEXT_FILE) \
+ $(RECOVERY_NO_COMMAND_TEXT_FILE) \
+ $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
+ $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
+ $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
+ $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
+ $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
+
+resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
+image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
+zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
+$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_TEXT_LIST := \
+ recovery_installing \
+ recovery_installing_security \
+ recovery_erasing \
+ recovery_error \
+ recovery_no_command \
+ recovery_cancel_wipe_data \
+ recovery_factory_data_reset \
+ recovery_try_again \
+ recovery_wipe_data_menu_header \
+ recovery_wipe_data_confirmation
+$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
+$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
+ # Prepares the font directory.
+ @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
+ @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
+ $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
+
+ @rm -rf $(dir $@)
+ @mkdir -p $(dir $@)
+ $(foreach text_name,$(PRIVATE_RECOVERY_TEXT_LIST), \
+ $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
+ java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
+ --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
+ --text_name $(text_name) \
+ --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
+ --resource_dir $(PRIVATE_RESOURCE_DIR) \
+ --output_file $(output_file) && \
+ $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
+else
+RECOVERY_INSTALLING_TEXT_FILE :=
+RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
+RECOVERY_ERASING_TEXT_FILE :=
+RECOVERY_ERROR_TEXT_FILE :=
+RECOVERY_NO_COMMAND_TEXT_FILE :=
+RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
+RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
+RECOVERY_TRY_AGAIN_TEXT_FILE :=
+RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
+RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
+endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
+
ifndef TARGET_PRIVATE_RES_DIRS
TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
endif
recovery_resource_deps := $(shell find $(recovery_resources_common) \
$(TARGET_PRIVATE_RES_DIRS) -type f)
+recovery_resource_deps += $(generated_recovery_text_files)
+
+
ifdef TARGET_RECOVERY_FSTAB
recovery_fstab := $(TARGET_RECOVERY_FSTAB)
else
@@ -1568,9 +1667,12 @@
# d) We include the recovery DTBO image within recovery - not needing the resource file as we
# do bsdiff because boot and recovery will contain different number of entries
# (BOARD_INCLUDE_RECOVERY_DTBO = true).
+# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
+# do bsdiff because boot and recovery will contain different number of entries
+# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
- $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
+ $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
# Named '.dat' so we don't attempt to use imgdiff for patching it.
RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
else
@@ -1644,6 +1746,9 @@
ifdef BOARD_INCLUDE_RECOVERY_DTBO
INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
endif
+ifdef BOARD_INCLUDE_RECOVERY_ACPIO
+ INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
+endif
# Keys authorized to sign OTA packages this build will accept. The
# build always uses dev-keys for this; release packaging tools will
@@ -1683,6 +1788,8 @@
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
$(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
$(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
+ $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
+ cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
$(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
$(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
@@ -1728,6 +1835,9 @@
ifdef BOARD_INCLUDE_RECOVERY_DTBO
$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
endif
+ifdef BOARD_INCLUDE_RECOVERY_ACPIO
+$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
+endif
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(INTERNAL_ROOT_FILES) \
@@ -1748,6 +1858,9 @@
ifdef BOARD_INCLUDE_RECOVERY_DTBO
$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
endif
+ifdef BOARD_INCLUDE_RECOVERY_ACPIO
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
+endif
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(INTERNAL_ROOT_FILES) \
@@ -1958,7 +2071,7 @@
ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
-ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
+ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
else
diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
@@ -3314,6 +3427,7 @@
$(INSTALLED_KERNEL_TARGET) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(BOARD_PREBUILT_DTBOIMAGE) \
+ $(BOARD_RECOVERY_ACPIO) \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
@@ -3354,6 +3468,9 @@
ifdef BOARD_INCLUDE_RECOVERY_DTBO
$(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
endif
+ifdef BOARD_INCLUDE_RECOVERY_ACPIO
+ $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
+endif
ifdef INTERNAL_KERNEL_CMDLINE
$(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
endif
@@ -3457,6 +3574,9 @@
ifdef BOARD_INCLUDE_RECOVERY_DTBO
$(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
endif
+ifdef BOARD_INCLUDE_RECOVERY_ACPIO
+ $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
+endif
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
diff --git a/core/build_rro_package.mk b/core/build_rro_package.mk
index ffefb9c..0b4a0c4 100644
--- a/core/build_rro_package.mk
+++ b/core/build_rro_package.mk
@@ -15,11 +15,23 @@
$(error runtime resource overlay package should not contain sources)
endif
-ifeq ($(LOCAL_RRO_THEME),)
- LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/overlay
+partition :=
+ifeq ($(LOCAL_ODM_MODULE),true)
+ partition := $(TARGET_OUT_ODM)
+else ifeq ($(LOCAL_PRODUCT_MODULE),true)
+ partition := $(TARGET_OUT_PRODUCT)
+else ifeq ($(LOCAL_PRODUCT_SERVICES_MODULE),true)
+ partition := $(TARGET_OUT_PRODUCT_SERVICES)
else
- LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/overlay/$(LOCAL_RRO_THEME)
+ partition := $(TARGET_OUT_VENDOR)
endif
-include $(BUILD_SYSTEM)/package.mk
+ifeq ($(LOCAL_RRO_THEME),)
+ LOCAL_MODULE_PATH := $(partition)/overlay
+else
+ LOCAL_MODULE_PATH := $(partition)/overlay/$(LOCAL_RRO_THEME)
+endif
+partition :=
+
+include $(BUILD_SYSTEM)/package.mk
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index fcf527e..7b4015e 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -176,6 +176,7 @@
ifneq ($(filter hwaddress,$(my_sanitize)),)
my_sanitize := $(filter-out address,$(my_sanitize))
my_sanitize := $(filter-out thread,$(my_sanitize))
+ my_sanitize := $(filter-out cfi,$(my_sanitize))
endif
ifneq ($(filter hwaddress,$(my_sanitize)),)
@@ -414,3 +415,14 @@
endif
endif
endif
+
+# http://b/119329758, Android core does not boot up with this sanitizer yet.
+# Previously sanitized modules might not pass new implicit-integer-sign-change check.
+# Disable this check unless it has been explicitly specified.
+ifneq ($(findstring fsanitize,$(my_cflags)),)
+ ifneq ($(findstring integer,$(my_cflags)),)
+ ifeq ($(findstring sanitize=implicit-integer-sign-change,$(my_cflags)),)
+ my_cflags += -fno-sanitize=implicit-integer-sign-change
+ endif
+ endif
+endif
diff --git a/core/definitions.mk b/core/definitions.mk
index e5e83b9..ab45d15 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2704,9 +2704,9 @@
$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): $(2)
$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): PRIVATE_FLAGS_INPUTS := $$(PRIVATE_FLAGS_INPUTS) $(2)
-$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): $(5)
+$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): $(3)
$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): \
- PRIVATE_METADATA_INPUTS := $$(PRIVATE_METADATA_INPUTS) $(5)
+ PRIVATE_METADATA_INPUTS := $$(PRIVATE_METADATA_INPUTS) $(3)
endif
endef
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 6a892e2..47a03e8 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -181,7 +181,7 @@
$(my_built_profile):
$(hide) mkdir -p $(dir $@)
touch $@
- ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
+ ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
--copy-and-update-profile-key \
--profile-file=$(PRIVATE_SOURCE_CLASSES) \
--apk=$(PRIVATE_BUILT_MODULE) \
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 837920f..1440806 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -67,8 +67,16 @@
endif
ifdef LOCAL_DEX_PREOPT
+ifdef LOCAL_STRIP_DEX
+ # If we have stripped the final APK, use the original jar generated by soong.
$(built_odex): $(LOCAL_SOONG_DEX_JAR)
$(call dexpreopt-one-file,$<,$@)
+else
+ # If we haven't stripped, use the final APK for dexpreopt, as this may affect how the dex
+ # code is compiled.
+ $(built_odex): $(LOCAL_PREBUILT_MODULE_FILE)
+ $(call dexpreopt-one-file,$<,$@)
+endif # LOCAL_STRIP_DEX
$(eval $(call dexpreopt-copy-jar,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
else
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 445618c..877ecaf 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -186,8 +186,11 @@
# SDK version the package was built for, otherwise it should fall back to
# assuming the device can only support APIs as of the previous official
# public release.
- # This value will always be 0 for release builds.
- PLATFORM_PREVIEW_SDK_VERSION := 0
+ # This value will always be forced to 0 for release builds by the logic
+ # in the "ifeq" block above, so the value below will be used on any
+ # non-release builds, and it should always be at least 1, to indicate that
+ # APIs may have changed since the claimed PLATFORM_SDK_VERSION.
+ PLATFORM_PREVIEW_SDK_VERSION := 1
endif
endif
.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
@@ -256,7 +259,7 @@
# It must be of the form "YYYY-MM-DD" on production devices.
# It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2018-12-05
+ PLATFORM_SECURITY_PATCH := 2019-02-05
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
diff --git a/envsetup.sh b/envsetup.sh
index 7e94748..561083d 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -4,28 +4,31 @@
Run "m help" for help with the build system itself.
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
-- lunch: lunch <product_name>-<build_variant>
- Selects <product_name> as the product to build, and <build_variant> as the variant to
- build, and stores those selections in the environment to be read by subsequent
- invocations of 'm' etc.
-- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
-- croot: Changes directory to the top of the tree.
-- m: Makes from the top of the tree.
-- mm: Builds all of the modules in the current directory, but not their dependencies.
-- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
- To limit the modules being built use the syntax: mmm dir/:target1,target2.
-- mma: Builds all of the modules in the current directory, and their dependencies.
-- mmma: Builds all of the modules in the supplied directories, and their dependencies.
-- provision: Flash device with all required partitions. Options will be passed on to fastboot.
-- cgrep: Greps on all local C/C++ files.
-- ggrep: Greps on all local Gradle files.
-- jgrep: Greps on all local Java files.
-- resgrep: Greps on all local res/*.xml files.
-- mangrep: Greps on all local AndroidManifest.xml files.
-- mgrep: Greps on all local Makefiles files.
-- sepgrep: Greps on all local sepolicy files.
-- sgrep: Greps on all local source files.
-- godir: Go to the directory containing a file.
+- lunch: lunch <product_name>-<build_variant>
+ Selects <product_name> as the product to build, and <build_variant> as the variant to
+ build, and stores those selections in the environment to be read by subsequent
+ invocations of 'm' etc.
+- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
+- croot: Changes directory to the top of the tree.
+- m: Makes from the top of the tree.
+- mm: Builds all of the modules in the current directory, but not their dependencies.
+- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
+ To limit the modules being built use the syntax: mmm dir/:target1,target2.
+- mma: Builds all of the modules in the current directory, and their dependencies.
+- mmma: Builds all of the modules in the supplied directories, and their dependencies.
+- provision: Flash device with all required partitions. Options will be passed on to fastboot.
+- cgrep: Greps on all local C/C++ files.
+- ggrep: Greps on all local Gradle files.
+- jgrep: Greps on all local Java files.
+- resgrep: Greps on all local res/*.xml files.
+- mangrep: Greps on all local AndroidManifest.xml files.
+- mgrep: Greps on all local Makefiles files.
+- sepgrep: Greps on all local sepolicy files.
+- sgrep: Greps on all local source files.
+- godir: Go to the directory containing a file.
+- allmod: List all modules.
+- gomod: Go to the directory containing a module.
+- refreshmod: Refresh list of modules for allmod/gomod.
Environment options:
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
@@ -359,6 +362,9 @@
complete -C "bit --tab" bit
fi
complete -F _lunch lunch
+
+ complete -F _complete_android_module_names gomod
+ complete -F _complete_android_module_names m
}
function choosetype()
@@ -1463,6 +1469,77 @@
\cd $T/$pathname
}
+# Update module-info.json in out.
+function refreshmod() {
+ if [ ! "$ANDROID_PRODUCT_OUT" ]; then
+ echo "No ANDROID_PRODUCT_OUT. Try running 'lunch' first." >&2
+ return 1
+ fi
+
+ echo "Refreshing modules (building module-info.json). Log at $ANDROID_PRODUCT_OUT/module-info.json.build.log." >&2
+
+ # for the output of the next command
+ mkdir -p $ANDROID_PRODUCT_OUT || return 1
+
+ # Note, can't use absolute path because of the way make works.
+ m out/target/product/$(get_build_var TARGET_DEVICE)/module-info.json \
+ > $ANDROID_PRODUCT_OUT/module-info.json.build.log 2>&1
+}
+
+# List all modules for the current device, as cached in module-info.json. If any build change is
+# made and it should be reflected in the output, you should run 'refreshmod' first.
+function allmod() {
+ if [ ! "$ANDROID_PRODUCT_OUT" ]; then
+ echo "No ANDROID_PRODUCT_OUT. Try running 'lunch' first." >&2
+ return 1
+ fi
+
+ if [ ! -f "$ANDROID_PRODUCT_OUT/module-info.json" ]; then
+ echo "Could not find module-info.json. It will only be built once, and it can be updated with 'refreshmod'" >&2
+ refreshmod || return 1
+ fi
+
+ python -c "import json; print '\n'.join(sorted(json.load(open('$ANDROID_PRODUCT_OUT/module-info.json')).keys()))"
+}
+
+# Go to a specific module in the android tree, as cached in module-info.json. If any build change
+# is made, and it should be reflected in the output, you should run 'refreshmod' first.
+function gomod() {
+ if [ ! "$ANDROID_PRODUCT_OUT" ]; then
+ echo "No ANDROID_PRODUCT_OUT. Try running 'lunch' first." >&2
+ return 1
+ fi
+
+ if [[ $# -ne 1 ]]; then
+ echo "usage: gomod <module>" >&2
+ return 1
+ fi
+
+ if [ ! -f "$ANDROID_PRODUCT_OUT/module-info.json" ]; then
+ echo "Could not find module-info.json. It will only be built once, and it can be updated with 'refreshmod'" >&2
+ refreshmod || return 1
+ fi
+
+ local relpath=$(python -c "import json, os
+module = '$1'
+module_info = json.load(open('$ANDROID_PRODUCT_OUT/module-info.json'))
+if module not in module_info:
+ exit(1)
+print module_info[module]['path'][0]" 2>/dev/null)
+
+ if [ -z "$relpath" ]; then
+ echo "Could not find module '$1' (try 'refreshmod' if there have been build changes?)." >&2
+ return 1
+ else
+ cd $ANDROID_BUILD_TOP/$relpath
+ fi
+}
+
+function _complete_android_module_names() {
+ local word=${COMP_WORDS[COMP_CWORD]}
+ COMPREPLY=( $(allmod | grep -E "^$word") )
+}
+
# Print colored exit condition
function pez {
"$@"
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index a127d05..55e32f4 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -19,6 +19,7 @@
adb \
adbd \
am \
+ android.frameworks.bufferhub@1.0-service \
android.hidl.allocator@1.0-service \
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java \
@@ -48,10 +49,10 @@
bu \
bugreport \
bugreportz \
- cameraserver \
charger \
cmd \
com.android.location.provider \
+ com.android.media \
com.android.resolv \
com.android.tzdata \
ContactsProvider \
@@ -61,6 +62,7 @@
CtsShimPrivPrebuilt \
debuggerd\
DefaultContainerService \
+ device_config \
dnsmasq \
DownloadProvider \
dpm \
@@ -114,10 +116,6 @@
libandroid_runtime \
libandroid_servers \
libaudioeffect_jni \
- libaudioflinger \
- libaudiopolicymanager \
- libaudiopolicyservice \
- libaudioutils \
libbinder \
libbinder_ndk \
libc \
@@ -172,8 +170,6 @@
libsonic \
libsonivox \
libsoundpool \
- libsoundtrigger \
- libsoundtriggerservice \
libspeexresampler \
libsqlite \
libstagefright \
@@ -320,10 +316,11 @@
adb_keys \
apex.test.key \
arping \
+ com.android.apex.test_package.key \
+ com.android.apex.test_package.preinstall.key \
iotop \
iw \
logpersist.start \
- perfprofd \
procrank \
showmap \
sqlite3 \
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index cad31be..161f176 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -41,6 +41,7 @@
Calendar \
CalendarProvider \
Camera2 \
+ cameraserver \
CaptivePortalLogin \
CertInstaller \
clatd \
diff --git a/target/product/handheld_vendor.mk b/target/product/handheld_vendor.mk
index 04bcbf9..8abd63a 100644
--- a/target/product/handheld_vendor.mk
+++ b/target/product/handheld_vendor.mk
@@ -20,15 +20,24 @@
# does, use base_vendor.mk).
$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk)
PRODUCT_PACKAGES += \
+ AccentColorBlackOverlay \
+ AccentColorGreenOverlay \
+ AccentColorPurpleOverlay \
audio.primary.default \
DisplayCutoutEmulationCornerOverlay \
DisplayCutoutEmulationDoubleOverlay \
DisplayCutoutEmulationTallOverlay \
+ IconShapeRoundedRectOverlay \
+ IconShapeSquircleOverlay \
+ IconShapeTeardropOverlay \
+ local_time.default \
+ power.default \
+ vibrator.default \
+
+PRODUCT_PACKAGES_DEBUG += \
ExperimentNavigationBarFloatingOverlay \
ExperimentNavigationBarDefaultOverlay \
ExperimentNavigationBarSlimOverlay24 \
ExperimentNavigationBarSlimOverlay32 \
ExperimentNavigationBarSlimOverlay40 \
- local_time.default \
- power.default \
- vibrator.default \
+ IconShapeSquareOverlay \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index c41e1d7..f6addb6 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -57,6 +57,13 @@
audio.a2dp.default \
audio.hearing_aid.default \
+# Media libraries
+# - These libraries are used by the new media code path that relies on new
+# plugins and HAL implementations that may not exist on older devices.
+PRODUCT_PACKAGES += \
+ libmedia_codecserviceregistrant \
+ libsfplugin_ccodec \
+
# For ringtones that rely on forward lock encryption
PRODUCT_PACKAGES += libfwdlockengine
diff --git a/target/product/vndk/current.txt b/target/product/vndk/current.txt
index 2759c8f..f3497e7 100644
--- a/target/product/vndk/current.txt
+++ b/target/product/vndk/current.txt
@@ -60,10 +60,13 @@
VNDK-core: android.hardware.atrace@1.0.so
VNDK-core: android.hardware.audio.common@2.0.so
VNDK-core: android.hardware.audio.common@4.0.so
+VNDK-core: android.hardware.audio.common@5.0.so
VNDK-core: android.hardware.audio.effect@2.0.so
VNDK-core: android.hardware.audio.effect@4.0.so
+VNDK-core: android.hardware.audio.effect@5.0.so
VNDK-core: android.hardware.audio@2.0.so
VNDK-core: android.hardware.audio@4.0.so
+VNDK-core: android.hardware.audio@5.0.so
VNDK-core: android.hardware.authsecret@1.0.so
VNDK-core: android.hardware.automotive.audiocontrol@1.0.so
VNDK-core: android.hardware.automotive.evs@1.0.so
diff --git a/tools/checkowners.py b/tools/checkowners.py
index 8568ccf..7f03968 100755
--- a/tools/checkowners.py
+++ b/tools/checkowners.py
@@ -56,7 +56,8 @@
glob = '[a-zA-Z0-9_\\.\\-\\*\\?]+'
globs = '(%s( *, *%s)*)' % (glob, glob)
perfile = 'per-file +' + globs + ' *= *' + directive
- pats = '(|%s|%s|%s)$' % (noparent, email, perfile)
+ include = 'include +([^ :]+ *: *)?[^ ]+'
+ pats = '(|%s|%s|%s|%s)$' % (noparent, email, perfile, include)
patterns = re.compile(pats)
address_pattern = re.compile('([^@ ]+@[^ @]+)')
perfile_pattern = re.compile('per-file +.*=(.*)')
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index bf5e171..5ade258 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -104,11 +104,14 @@
include $(BUILD_HOST_EXECUTABLE)
fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE)
-# List of all supported vendor, oem and odm Partitions
+# List of supported vendor, oem, odm, product and product_services Partitions
fs_config_generate_extra_partition_list := $(strip \
$(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),vendor) \
$(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),oem) \
- $(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm))
+ $(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm) \
+ $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),product) \
+ $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),product_services) \
+)
##################################
# Generate the <p>/etc/fs_config_dirs binary files for each partition.
@@ -286,6 +289,72 @@
endif
+ifneq ($(filter product,$(fs_config_generate_extra_partition_list)),)
+##################################
+# Generate the product/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_product to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs_product
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
+LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -D -P product -o $@
+
+##################################
+# Generate the product/etc/fs_config_files binary file for the target
+# Add fs_config_files of fs_config_files_product to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files_product
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_files
+LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -F -P product -o $@
+
+endif
+
+ifneq ($(filter product_services,$(fs_config_generate_extra_partition_list)),)
+##################################
+# Generate the product_services/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_product_services to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs_product_services
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
+LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_SERVICES)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -D -P product_services -o $@
+
+##################################
+# Generate the product_services/etc/fs_config_files binary file for the target
+# Add fs_config_files of fs_config_files_product_services to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files_product_services
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_files
+LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_SERVICES)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -F -P product_services -o $@
+
+endif
+
##################################
# Build the oemaid header library when fs config files are present.
# Intentionally break build if you require generated AIDs
diff --git a/tools/fs_config/android_filesystem_config_test_data.h b/tools/fs_config/android_filesystem_config_test_data.h
index 07bc8e5..c65d406 100644
--- a/tools/fs_config/android_filesystem_config_test_data.h
+++ b/tools/fs_config/android_filesystem_config_test_data.h
@@ -26,6 +26,8 @@
{00555, AID_ROOT, AID_SYSTEM, 0, "vendor/etc"},
{00555, AID_ROOT, AID_SYSTEM, 0, "oem/etc"},
{00555, AID_ROOT, AID_SYSTEM, 0, "odm/etc"},
+ {00555, AID_ROOT, AID_SYSTEM, 0, "product/etc"},
+ {00555, AID_ROOT, AID_SYSTEM, 0, "product_services/etc"},
{00755, AID_SYSTEM, AID_ROOT, 0, "system/oem/etc"},
{00755, AID_SYSTEM, AID_ROOT, 0, "system/odm/etc"},
{00755, AID_SYSTEM, AID_ROOT, 0, "system/vendor/etc"},
@@ -41,16 +43,22 @@
{00444, AID_ROOT, AID_SYSTEM, 0, "vendor/etc/fs_config_dirs"},
{00444, AID_ROOT, AID_SYSTEM, 0, "oem/etc/fs_config_dirs"},
{00444, AID_ROOT, AID_SYSTEM, 0, "odm/etc/fs_config_dirs"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "product/etc/fs_config_dirs"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "product_services/etc/fs_config_dirs"},
{00444, AID_ROOT, AID_SYSTEM, 0, "system/etc/fs_config_files"},
{00444, AID_ROOT, AID_SYSTEM, 0, "vendor/etc/fs_config_files"},
{00444, AID_ROOT, AID_SYSTEM, 0, "oem/etc/fs_config_files"},
{00444, AID_ROOT, AID_SYSTEM, 0, "odm/etc/fs_config_files"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "product/etc/fs_config_files"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "product_services/etc/fs_config_files"},
{00644, AID_SYSTEM, AID_ROOT, 0, "system/vendor/etc/fs_config_dirs"},
{00644, AID_SYSTEM, AID_ROOT, 0, "system/oem/etc/fs_config_dirs"},
{00644, AID_SYSTEM, AID_ROOT, 0, "system/odm/etc/fs_config_dirs"},
{00644, AID_SYSTEM, AID_ROOT, 0, "system/vendor/etc/fs_config_files"},
{00644, AID_SYSTEM, AID_ROOT, 0, "system/oem/etc/fs_config_files"},
{00644, AID_SYSTEM, AID_ROOT, 0, "system/odm/etc/fs_config_files"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/product/etc/fs_config_files"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/product_services/etc/fs_config_files"},
{00644, AID_SYSTEM, AID_ROOT, 0, "etc/fs_config_files"},
{00666, AID_ROOT, AID_SYSTEM, 0, "data/misc/oem"},
};
diff --git a/tools/fs_config/fs_config_generate.c b/tools/fs_config/fs_config_generate.c
index cb7ff9d..dddd331 100644
--- a/tools/fs_config/fs_config_generate.c
+++ b/tools/fs_config/fs_config_generate.c
@@ -41,18 +41,7 @@
#endif
#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES
-static const struct fs_path_config android_device_files[] = {
-#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
- {0000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_dirs"},
- {0000, AID_ROOT, AID_ROOT, 0, "vendor/etc/fs_config_dirs"},
- {0000, AID_ROOT, AID_ROOT, 0, "oem/etc/fs_config_dirs"},
- {0000, AID_ROOT, AID_ROOT, 0, "odm/etc/fs_config_dirs"},
-#endif
- {0000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_files"},
- {0000, AID_ROOT, AID_ROOT, 0, "vendor/etc/fs_config_files"},
- {0000, AID_ROOT, AID_ROOT, 0, "oem/etc/fs_config_files"},
- {0000, AID_ROOT, AID_ROOT, 0, "odm/etc/fs_config_files"},
-};
+static const struct fs_path_config android_device_files[] = { };
#endif
static void usage() {
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index cd534ec..db484a0 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -909,22 +909,6 @@
'#warning No device-supplied android_filesystem_config.h,'
' using empty default.')
- # Long names.
- # pylint: disable=invalid-name
- _NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS_ENTRY = (
- '{ 00000, AID_ROOT, AID_ROOT, 0,'
- '"system/etc/fs_config_dirs" },')
-
- _NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES_ENTRY = (
- '{ 00000, AID_ROOT, AID_ROOT, 0,'
- '"system/etc/fs_config_files" },')
-
- _IFDEF_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS = (
- '#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS')
- # pylint: enable=invalid-name
-
- _ENDIF = '#endif'
-
_OPEN_FILE_STRUCT = (
'static const struct fs_path_config android_device_files[] = {')
@@ -1082,12 +1066,6 @@
for fs_config in files:
self._to_fs_entry(fs_config)
- if not are_dirs:
- print FSConfigGen._IFDEF_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
- print(
- ' ' +
- FSConfigGen._NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS_ENTRY)
- print FSConfigGen._ENDIF
print FSConfigGen._CLOSE_FILE_STRUCT
if are_dirs:
@@ -1108,9 +1086,14 @@
_INCLUDE = '#include <private/android_filesystem_config.h>'
+ # Note that the android_id name field is of type 'const char[]' instead of
+ # 'const char*'. While this seems less straightforward as we need to
+ # calculate the max length of all names, this allows the entire android_ids
+ # table to be placed in .rodata section instead of .data.rel.ro section,
+ # resulting in less memory pressure.
_STRUCT_FS_CONFIG = textwrap.dedent("""
struct android_id_info {
- const char *name;
+ const char name[%d];
unsigned aid;
};""")
@@ -1132,12 +1115,13 @@
def __call__(self, args):
hdr = AIDHeaderParser(args['hdrfile'])
+ max_name_length = max(len(aid.friendly) + 1 for aid in hdr.aids)
print AIDArrayGen._GENERATED
print
print AIDArrayGen._INCLUDE
print
- print AIDArrayGen._STRUCT_FS_CONFIG
+ print AIDArrayGen._STRUCT_FS_CONFIG % max_name_length
print
print AIDArrayGen._OPEN_ID_ARRAY
diff --git a/tools/fs_config/fs_config_test.cpp b/tools/fs_config/fs_config_test.cpp
index f95a4ca..916c615 100644
--- a/tools/fs_config/fs_config_test.cpp
+++ b/tools/fs_config/fs_config_test.cpp
@@ -23,7 +23,6 @@
#include <android-base/file.h>
#include <android-base/macros.h>
#include <android-base/strings.h>
-#include <android-base/stringprintf.h>
#include <gtest/gtest.h>
#include <private/android_filesystem_config.h>
#include <private/fs_config.h>
@@ -31,12 +30,12 @@
#include "android_filesystem_config_test_data.h"
// must run test in the test directory
-const static char fs_config_generate_command[] = "./fs_config_generate_test";
+static const std::string fs_config_generate_command = "./fs_config_generate_test";
-static std::string popenToString(std::string command) {
+static std::string popenToString(const std::string command) {
std::string ret;
- FILE* fp = popen(command.c_str(), "r");
+ auto fp = popen(command.c_str(), "r");
if (fp) {
if (!android::base::ReadFdToString(fileno(fp), &ret)) ret = "";
pclose(fp);
@@ -46,15 +45,14 @@
static void confirm(std::string&& data, const fs_path_config* config,
ssize_t num_config) {
- const struct fs_path_config_from_file* pc =
- reinterpret_cast<const fs_path_config_from_file*>(data.c_str());
- size_t len = data.size();
+ auto pc = reinterpret_cast<const fs_path_config_from_file*>(data.c_str());
+ auto len = data.size();
ASSERT_TRUE(config != NULL);
ASSERT_LT(0, num_config);
while (len > 0) {
- uint16_t host_len = pc->len;
+ auto host_len = pc->len;
if (host_len > len) break;
EXPECT_EQ(config->mode, pc->mode);
@@ -76,148 +74,114 @@
/* See local android_filesystem_config.h for test data */
TEST(fs_conf_test, dirs) {
- confirm(popenToString(
- android::base::StringPrintf("%s -D", fs_config_generate_command)),
+ confirm(popenToString(fs_config_generate_command + " -D"),
android_device_dirs, arraysize(android_device_dirs));
}
TEST(fs_conf_test, files) {
- confirm(popenToString(
- android::base::StringPrintf("%s -F", fs_config_generate_command)),
+ confirm(popenToString(fs_config_generate_command + " -F"),
android_device_files, arraysize(android_device_files));
}
-static const char vendor_str[] = "vendor/";
-static const char vendor_alt_str[] = "system/vendor/";
-static const char oem_str[] = "oem/";
-static const char oem_alt_str[] = "system/oem/";
-static const char odm_str[] = "odm/";
-static const char odm_alt_str[] = "system/odm/";
+static bool is_system(const char* prefix) {
+ return !android::base::StartsWith(prefix, "vendor/") &&
+ !android::base::StartsWith(prefix, "system/vendor/") &&
+ !android::base::StartsWith(prefix, "oem/") &&
+ !android::base::StartsWith(prefix, "system/oem/") &&
+ !android::base::StartsWith(prefix, "odm/") &&
+ !android::base::StartsWith(prefix, "system/odm/") &&
+ !android::base::StartsWith(prefix, "product/") &&
+ !android::base::StartsWith(prefix, "system/product/") &&
+ !android::base::StartsWith(prefix, "product_services/") &&
+ !android::base::StartsWith(prefix, "system/product_services/");
+}
TEST(fs_conf_test, system_dirs) {
std::vector<fs_path_config> dirs;
- const fs_path_config* config = android_device_dirs;
- for (size_t num = arraysize(android_device_dirs); num; --num) {
- if (!android::base::StartsWith(config->prefix, vendor_str) &&
- !android::base::StartsWith(config->prefix, vendor_alt_str) &&
- !android::base::StartsWith(config->prefix, oem_str) &&
- !android::base::StartsWith(config->prefix, oem_alt_str) &&
- !android::base::StartsWith(config->prefix, odm_str) &&
- !android::base::StartsWith(config->prefix, odm_alt_str)) {
+ auto config = android_device_dirs;
+ for (auto num = arraysize(android_device_dirs); num; --num) {
+ if (is_system(config->prefix)) {
dirs.emplace_back(*config);
}
++config;
}
- confirm(popenToString(android::base::StringPrintf(
- "%s -D -P -vendor,-oem,-odm", fs_config_generate_command)),
+ confirm(popenToString(fs_config_generate_command + " -D -P -vendor,-oem,-odm,-product,-product_services"),
+ &dirs[0], dirs.size());
+}
+
+static void fs_conf_test_dirs(const std::string& partition_name) {
+ std::vector<fs_path_config> dirs;
+ auto config = android_device_dirs;
+ const auto str = partition_name + "/";
+ const auto alt_str = "system/" + partition_name + "/";
+ for (auto num = arraysize(android_device_dirs); num; --num) {
+ if (android::base::StartsWith(config->prefix, str) ||
+ android::base::StartsWith(config->prefix, alt_str)) {
+ dirs.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(fs_config_generate_command + " -D -P " + partition_name),
&dirs[0], dirs.size());
}
TEST(fs_conf_test, vendor_dirs) {
- std::vector<fs_path_config> dirs;
- const fs_path_config* config = android_device_dirs;
- for (size_t num = arraysize(android_device_dirs); num; --num) {
- if (android::base::StartsWith(config->prefix, vendor_str) ||
- android::base::StartsWith(config->prefix, vendor_alt_str)) {
- dirs.emplace_back(*config);
- }
- ++config;
- }
- confirm(popenToString(android::base::StringPrintf(
- "%s -D -P vendor", fs_config_generate_command)),
- &dirs[0], dirs.size());
+ fs_conf_test_dirs("vendor");
}
TEST(fs_conf_test, oem_dirs) {
- std::vector<fs_path_config> dirs;
- const fs_path_config* config = android_device_dirs;
- for (size_t num = arraysize(android_device_dirs); num; --num) {
- if (android::base::StartsWith(config->prefix, oem_str) ||
- android::base::StartsWith(config->prefix, oem_alt_str)) {
- dirs.emplace_back(*config);
- }
- ++config;
- }
- confirm(popenToString(android::base::StringPrintf(
- "%s -D -P oem", fs_config_generate_command)),
- &dirs[0], dirs.size());
+ fs_conf_test_dirs("oem");
}
TEST(fs_conf_test, odm_dirs) {
- std::vector<fs_path_config> dirs;
- const fs_path_config* config = android_device_dirs;
- for (size_t num = arraysize(android_device_dirs); num; --num) {
- if (android::base::StartsWith(config->prefix, odm_str) ||
- android::base::StartsWith(config->prefix, odm_alt_str)) {
- dirs.emplace_back(*config);
- }
- ++config;
- }
- confirm(popenToString(android::base::StringPrintf(
- "%s -D -P odm", fs_config_generate_command)),
- &dirs[0], dirs.size());
+ fs_conf_test_dirs("odm");
}
TEST(fs_conf_test, system_files) {
std::vector<fs_path_config> files;
- const fs_path_config* config = android_device_files;
- for (size_t num = arraysize(android_device_files); num; --num) {
- if (!android::base::StartsWith(config->prefix, vendor_str) &&
- !android::base::StartsWith(config->prefix, vendor_alt_str) &&
- !android::base::StartsWith(config->prefix, oem_str) &&
- !android::base::StartsWith(config->prefix, oem_alt_str) &&
- !android::base::StartsWith(config->prefix, odm_str) &&
- !android::base::StartsWith(config->prefix, odm_alt_str)) {
+ auto config = android_device_files;
+ for (auto num = arraysize(android_device_files); num; --num) {
+ if (is_system(config->prefix)) {
files.emplace_back(*config);
}
++config;
}
- confirm(popenToString(android::base::StringPrintf(
- "%s -F -P -vendor,-oem,-odm", fs_config_generate_command)),
+ confirm(popenToString(fs_config_generate_command + " -F -P -vendor,-oem,-odm,-product,-product_services"),
+ &files[0], files.size());
+}
+
+static void fs_conf_test_files(const std::string& partition_name) {
+ std::vector<fs_path_config> files;
+ auto config = android_device_files;
+ const auto str = partition_name + "/";
+ const auto alt_str = "system/" + partition_name + "/";
+ for (auto num = arraysize(android_device_files); num; --num) {
+ if (android::base::StartsWith(config->prefix, str) ||
+ android::base::StartsWith(config->prefix, alt_str)) {
+ files.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(fs_config_generate_command + " -F -P " + partition_name),
&files[0], files.size());
}
TEST(fs_conf_test, vendor_files) {
- std::vector<fs_path_config> files;
- const fs_path_config* config = android_device_files;
- for (size_t num = arraysize(android_device_files); num; --num) {
- if (android::base::StartsWith(config->prefix, vendor_str) ||
- android::base::StartsWith(config->prefix, vendor_alt_str)) {
- files.emplace_back(*config);
- }
- ++config;
- }
- confirm(popenToString(android::base::StringPrintf(
- "%s -F -P vendor", fs_config_generate_command)),
- &files[0], files.size());
+ fs_conf_test_files("vendor");
}
TEST(fs_conf_test, oem_files) {
- std::vector<fs_path_config> files;
- const fs_path_config* config = android_device_files;
- for (size_t num = arraysize(android_device_files); num; --num) {
- if (android::base::StartsWith(config->prefix, oem_str) ||
- android::base::StartsWith(config->prefix, oem_alt_str)) {
- files.emplace_back(*config);
- }
- ++config;
- }
- confirm(popenToString(android::base::StringPrintf(
- "%s -F -P oem", fs_config_generate_command)),
- &files[0], files.size());
+ fs_conf_test_files("oem");
}
TEST(fs_conf_test, odm_files) {
- std::vector<fs_path_config> files;
- const fs_path_config* config = android_device_files;
- for (size_t num = arraysize(android_device_files); num; --num) {
- if (android::base::StartsWith(config->prefix, odm_str) ||
- android::base::StartsWith(config->prefix, odm_alt_str)) {
- files.emplace_back(*config);
- }
- ++config;
- }
- confirm(popenToString(android::base::StringPrintf(
- "%s -F -P odm", fs_config_generate_command)),
- &files[0], files.size());
+ fs_conf_test_files("odm");
+}
+
+TEST(fs_conf_test, product_files) {
+ fs_conf_test_files("product");
+}
+
+TEST(fs_conf_test, product_services_files) {
+ fs_conf_test_files("product_services");
}
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 669d87b..1872a58 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -657,12 +657,13 @@
"""Create split super_*.img and store it in output_zip."""
outdir = os.path.join(OPTIONS.input_tmp, "OTA")
- build_super_image.BuildSuperImage(OPTIONS.input_tmp, outdir)
+ built = build_super_image.BuildSuperImage(OPTIONS.input_tmp, outdir)
- for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
- img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
- "super_" + dev + ".img")
- img.Write()
+ if built:
+ for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
+ img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
+ "super_" + dev + ".img")
+ img.Write()
def ReplaceUpdatedFiles(zip_filename, files_list):
diff --git a/tools/releasetools/build_super_image.py b/tools/releasetools/build_super_image.py
index 6efd3f4..e8730ae 100755
--- a/tools/releasetools/build_super_image.py
+++ b/tools/releasetools/build_super_image.py
@@ -138,14 +138,25 @@
else:
logger.info("Done writing image %s", output)
+ return True
+
def BuildSuperImageFromExtractedTargetFiles(inp, out):
info_dict = common.LoadInfoDict(inp)
partition_list = shlex.split(
info_dict.get("dynamic_partition_list", "").strip())
+ missing_images = []
for partition in partition_list:
- info_dict["{}_image".format(partition)] = os.path.join(
- inp, "IMAGES", "{}.img".format(partition))
+ image_path = os.path.join(inp, "IMAGES", "{}.img".format(partition))
+ if not os.path.isfile(image_path):
+ missing_images.append(image_path)
+ else:
+ info_dict["{}_image".format(partition)] = image_path
+ if missing_images:
+ logger.warning("Skip building super image because the following "
+ "images are missing from target files:\n%s",
+ "\n".join(missing_images))
+ return False
return BuildSuperImageFromDict(info_dict, out)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index fe63458..dcc083c 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -623,10 +623,13 @@
# "boot" or "recovery", without extension.
partition_name = os.path.basename(sourcedir).lower()
- if (partition_name == "recovery" and
- info_dict.get("include_recovery_dtbo") == "true"):
- fn = os.path.join(sourcedir, "recovery_dtbo")
- cmd.extend(["--recovery_dtbo", fn])
+ if partition_name == "recovery":
+ if info_dict.get("include_recovery_dtbo") == "true":
+ fn = os.path.join(sourcedir, "recovery_dtbo")
+ cmd.extend(["--recovery_dtbo", fn])
+ if info_dict.get("include_recovery_acpio") == "true":
+ fn = os.path.join(sourcedir, "recovery_acpio")
+ cmd.extend(["--recovery_acpio", fn])
RunAndCheckOutput(cmd)
@@ -827,10 +830,10 @@
ranges = image.file_map[entry]
# If a RangeSet has been tagged as using shared blocks while loading the
- # image, its block list must be already incomplete due to that reason. Don't
- # give it 'incomplete' tag to avoid messing up the imgdiff stats.
+ # image, check the original block list to determine its completeness. Note
+ # that the 'incomplete' flag would be tagged to the original RangeSet only.
if ranges.extra.get('uses_shared_blocks'):
- continue
+ ranges = ranges.extra['uses_shared_blocks']
if RoundUpTo4K(info.file_size) > ranges.size() * 4096:
ranges.extra['incomplete'] = True
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index 5ebb1f0..7919ba4 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -248,15 +248,21 @@
ranges = rangelib.RangeSet.parse(ranges)
if allow_shared_blocks:
- # Find the shared blocks that have been claimed by others.
+ # Find the shared blocks that have been claimed by others. If so, tag
+ # the entry so that we can skip applying imgdiff on this file.
shared_blocks = ranges.subtract(remaining)
if shared_blocks:
- ranges = ranges.subtract(shared_blocks)
- if not ranges:
+ non_shared = ranges.subtract(shared_blocks)
+ if not non_shared:
continue
- # Tag the entry so that we can skip applying imgdiff on this file.
- ranges.extra['uses_shared_blocks'] = True
+ # There shouldn't anything in the extra dict yet.
+ assert not ranges.extra, "Non-empty RangeSet.extra"
+
+ # Put the non-shared RangeSet as the value in the block map, which
+ # has a copy of the original RangeSet.
+ non_shared.extra['uses_shared_blocks'] = ranges
+ ranges = non_shared
out[fn] = ranges
assert ranges.size() == ranges.intersect(remaining).size()
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index ae8253d..eeb802b 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -89,13 +89,20 @@
logging.warning('Skipping %s that has incomplete block list', entry)
continue
+ # Use the original RangeSet if applicable, which includes the shared
+ # blocks. And this needs to happen before checking the monotonicity flag.
+ if ranges.extra.get('uses_shared_blocks'):
+ file_ranges = ranges.extra['uses_shared_blocks']
+ else:
+ file_ranges = ranges
+
# TODO(b/79951650): Handle files with non-monotonic ranges.
- if not ranges.monotonic:
+ if not file_ranges.monotonic:
logging.warning(
- 'Skipping %s that has non-monotonic ranges: %s', entry, ranges)
+ 'Skipping %s that has non-monotonic ranges: %s', entry, file_ranges)
continue
- blocks_sha1 = image.RangeSha1(ranges)
+ blocks_sha1 = image.RangeSha1(file_ranges)
# The filename under unpacked directory, such as SYSTEM/bin/sh.
unpacked_name = os.path.join(
@@ -104,7 +111,7 @@
file_sha1 = unpacked_file.sha1
assert blocks_sha1 == file_sha1, \
'file: %s, range: %s, blocks_sha1: %s, file_sha1: %s' % (
- entry, ranges, blocks_sha1, file_sha1)
+ entry, file_ranges, blocks_sha1, file_sha1)
logging.info('Validating file consistency.')
@@ -311,9 +318,9 @@
if info_dict.get("avb_enable") == "true":
logging.info('Verifying Verified Boot 2.0 (AVB) images...')
- # Temporarily disable the verification for AVB-signed images, due to the
- # dependency on PyCrypto in `avbtool verify_image` (Bug: 119624011).
- logging.info('Temporarily disabled due to b/119624011')
+ # TODO(b/120517892): Temporarily disable the verification for AVB-signed
+ # images. Needing supporting changes in caller to pass in the desired keys.
+ logging.info('Temporarily disabled due to b/120517892')
def main():