Merge "Create extra symbolic links at root for arm64 GSI"
diff --git a/Usage.txt b/Usage.txt
index 004210b..558329b 100644
--- a/Usage.txt
+++ b/Usage.txt
@@ -29,7 +29,7 @@
An alternative to setting $TARGET_PRODUCT and $TARGET_BUILD_VARIANT,
which you may see in build servers, is to execute:
- make PRODUCT-<product>-<variant>
+ m PRODUCT-<product>-<variant>
A target may be a file path. For example, out/host/linux-x86/bin/adb .
@@ -46,6 +46,17 @@
files named Android.bp
these files are defined in Blueprint syntax
+ During a build, a few log files are generated in ${OUT} (or ${DIST_DIR}/logs
+ for dist builds):
+
+ verbose.log.gz
+ every command run, along with its outputs. This is similar to the
+ previous `m showcommands` option.
+ error.log
+ list of actions that failed during the build, and their outputs.
+ soong.log
+ verbose debug information from soong_ui
+
For now, the full (extremely large) compiled list of targets can be found
(after running the build once), split among these two files:
@@ -57,8 +68,6 @@
tool here.
Targets that adjust an existing build:
- showcommands Display the individual commands run to implement
- the build
dist Copy into ${DIST_DIR} the portion of the build
that must be distributed
@@ -71,7 +80,7 @@
Variables can either be set in the surrounding shell environment or can be
passed as command-line arguments. For example:
export I_AM_A_SHELL_VAR=1
- I_AM_ANOTHER_SHELL_VAR=2 make droid I_AM_A_MAKE_VAR=3
+ I_AM_ANOTHER_SHELL_VAR=2 m droid I_AM_A_MAKE_VAR=3
Here are some common variables and their meanings:
TARGET_PRODUCT The <product> to build # as described above
TARGET_BUILD_VARIANT The <variant> to build # as described above
diff --git a/core/Makefile b/core/Makefile
index 3eb4211..33b697c 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -682,11 +682,23 @@
$(ALL_GENERATED_SOURCES) \
$(ALL_DEFAULT_INSTALLED_MODULES))
+INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
+INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
+$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
+$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
+ @echo Installed file list: $@
+ @mkdir -p $(dir $@)
+ @rm -f $@
+ $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
+ $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+
+$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
+
BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
# We just build this directly to the install location.
INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
-$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
+$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_ROOT) | $(MINIGZIP)
$(call pretty,"Target ram disk: $@")
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
@@ -849,7 +861,7 @@
.PHONY: notice_files
# Create the rule to combine the files into text and html/xml forms
-# $(1) - xml_excluded_vendor|xml_vendor|html
+# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
# $(2) - Plain text output file
# $(3) - HTML/XML output file
# $(4) - File title
@@ -874,9 +886,10 @@
$(2) : $(3)
$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
build/make/tools/generate-notice-files.py --text-output $(2) \
- $(if $(filter $(1),xml_excluded_vendor),-e vendor --xml-output, \
+ $(if $(filter $(1),xml_excluded_vendor_product),-e vendor$(comma)product --xml-output, \
$(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
- --html-output)) $(3) \
+ $(if $(filter $(1),xml_product),-i product --xml-output, \
+ --html-output))) $(3) \
-t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
notice_files: $(2) $(3)
endef
@@ -902,6 +915,11 @@
target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
+
+target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
+target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
+target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
+installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
endif
ifndef TARGET_BUILD_APPS
@@ -910,7 +928,7 @@
pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
ifdef target_vendor_notice_file_xml_gz
-$(eval $(call combine-notice-files, xml_excluded_vendor, \
+$(eval $(call combine-notice-files, xml_excluded_vendor_product, \
$(target_notice_file_txt), \
$(target_notice_file_html_or_xml), \
"Notices for files contained in the filesystem images in this directory:", \
@@ -922,6 +940,14 @@
"Notices for files contained in the vendor filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
$(target_notice_file_html_or_xml)))
+ifdef target_product_notice_file_txt
+$(eval $(call combine-notice-files, xml_product, \
+ $(target_product_notice_file_txt), \
+ $(target_product_notice_file_xml), \
+ "Notices for files contained in the product filesystem image in this directory:", \
+ $(TARGET_OUT_NOTICE_FILES), \
+ $(target_notice_file_html_or_xml)))
+endif
else
$(eval $(call combine-notice-files, html, \
$(target_notice_file_txt), \
@@ -957,12 +983,23 @@
$(copy-file-to-target)
endif
+ifdef target_product_notice_file_xml_gz
+# Install the product html file at /product/etc/NOTICE.xml.gz.
+$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
+ $(copy-file-to-target)
+endif
+
# if we've been run my mm, mmm, etc, don't reinstall this every time
ifeq ($(ONE_SHOT_MAKEFILE),)
ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
ifdef target_vendor_notice_file_xml_gz
ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
endif
+ ifdef target_product_notice_file_xml_gz
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
+ endif
endif
endif # TARGET_BUILD_APPS
@@ -1101,8 +1138,6 @@
# $(2): a subset of "system vendor cache userdata product oem"
# $(3): additional "key=value" pairs to append to the dictionary file.
define generate-image-prop-dictionary
-$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
-$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
$(if $(filter $(2),system),\
$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
@@ -1117,13 +1152,10 @@
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
)
-$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
$(if $(filter $(2),userdata),\
$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
)
-$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
$(if $(filter $(2),cache),\
$(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
@@ -1159,8 +1191,13 @@
$(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
$(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
)
+$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
+$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
+$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
+$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
+$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
@@ -1530,6 +1567,12 @@
endif
endif
+# When building a system root image, also add the ramdisk image as a dependency
+# to ensure all files in it are built before it is created.
+ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_ROOT)
+endif
+
# -----------------------------------------------------------------
# Final System VINTF manifest including fragments. This is not assembled
# on the device because it depends on everything in a given device
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index 3af81ff..517379a 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -47,7 +47,7 @@
ifneq (,$(strip $(my_full_libs_manifest_files)))
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
-$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_CLASSPATH)
+$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_DEPS)
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
diff --git a/core/build-system.html b/core/build-system.html
index 3d86e24..3a11a47 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -147,12 +147,6 @@
.c, .cpp, .h, .java, java libraries, etc., should all work without intervention
in the Android.mk file.</p>
-<h3>Hiding command lines</h3>
-<p>The default of the build system will be to hide the command lines being
-executed for make steps. It will be possible to override this by specifying
-the showcommands pseudo-target, and possibly by setting an environment
-variable.</p>
-
<h3>Wildcard source files</h3>
<p>Wildcarding source file will be discouraged. It may be useful in some
scenarios. The default <code>$(wildcard *)</code> will not work due to the
@@ -326,19 +320,6 @@
directory inside the current combo directory. This is especially useful on the
simulator and emulator, where the persistent data remains present between
builds.</li>
-<li><b>showcommands</b> - <code>showcommands</code> is a modifier target
-which causes the build system to show the actual command lines for the build
-steps, instead of the brief descriptions. Most people don't like seeing the
-actual commands, because they're quite long and hard to read, but if you need
-to for debugging purposes, you can add <code>showcommands</code> to the list
-of targets you build. For example <code>make showcommands</code> will build
-the default android configuration, and <code>make runtime showcommands</code>
-will build just the runtime, and targets that it depends on, while displaying
-the full command lines. Please note that there are a couple places where the
-commands aren't shown here. These are considered bugs, and should be fixed,
-but they're often hard to track down. Please let
-<a href="mailto:android-build-team">android-build-team</a> know if you find
-any.</li>
<li><b>LOCAL_MODULE</b> - Anything you specify as a <code>LOCAL_MODULE</code>
in an Android.mk is made into a pseudotarget. For example, <code>make
runtime</code> might be shorthand for <code>make
diff --git a/core/config.mk b/core/config.mk
index 5562fe3..df73c56 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -368,10 +368,18 @@
TARGET_PREFER_32_BIT_EXECUTABLES := true
endif
-ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS))
+ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS)))
TARGET_SUPPORTS_32_BIT_APPS := true
endif
+# Sanity check to warn about likely cryptic errors later in the build.
+ifeq ($(TARGET_IS_64_BIT),true)
+ ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
+ $(warning Building a 32-bit-app-only product on a 64-bit device. \
+ If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false)
+ endif
+endif
+
# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
# comma separated lists of the 32 and 64 bit ABIs (in order of
# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT
@@ -572,11 +580,13 @@
# Work around for b/68406220
# This should match the soong version.
USE_D8 := true
+.KATI_READONLY := USE_D8
# Default R8 behavior when USE_R8 is not specified.
ifndef USE_R8
USE_R8 := true
endif
+.KATI_READONLY := USE_R8
#
# Tools that are prebuilts for TARGET_BUILD_APPS
@@ -713,19 +723,6 @@
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
FINDBUGS := $(FINDBUGS_DIR)/findbugs
-# Tool to merge AndroidManifest.xmls
-ANDROID_MANIFEST_MERGER_CLASSPATH := \
- prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.1.0/manifest-merger-26.1.0.jar \
- prebuilts/gradle-plugin/com/android/tools/common/26.1.0/common-26.1.0.jar \
- prebuilts/gradle-plugin/com/android/tools/sdk-common/26.1.0/sdk-common-26.1.0.jar \
- prebuilts/gradle-plugin/com/android/tools/sdklib/26.1.0/sdklib-26.1.0.jar \
- prebuilts/gradle-plugin/org/jetbrains/kotlin/kotlin-runtime/1.0.5/kotlin-runtime-1.0.5.jar \
- prebuilts/gradle-plugin/org/jetbrains/kotlin/kotlin-stdlib/1.1.3/kotlin-stdlib-1.1.3.jar \
- prebuilts/misc/common/guava/guava-21.0.jar
-ANDROID_MANIFEST_MERGER := $(JAVA) \
- -classpath $(subst $(space),:,$(strip $(ANDROID_MANIFEST_MERGER_CLASSPATH))) \
- com.android.manifmerger.Merger
-
COLUMN:= column
USE_OPENJDK9 := true
@@ -1039,6 +1036,8 @@
TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS))
+INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-public-list.txt
+INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-private-list.txt
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-light-greylist.txt
INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-dark-greylist.txt
INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-blacklist.txt
diff --git a/core/definitions.mk b/core/definitions.mk
index 857b73c..1bdbf10 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1124,7 +1124,7 @@
@mkdir -p $(dir $@)
@mkdir -p $(PRIVATE_HEADER_OUTPUT_DIR)
@echo "Generating C++ from AIDL: $(PRIVATE_MODULE) <= $<"
-$(hide) $(AIDL_CPP) -d$(basename $@).aidl.d -ninja $(PRIVATE_AIDL_FLAGS) \
+$(hide) $(AIDL_CPP) -d$(basename $@).aidl.d --ninja $(PRIVATE_AIDL_FLAGS) \
$< $(PRIVATE_HEADER_OUTPUT_DIR) $@
endef
@@ -2837,6 +2837,7 @@
endef
# Copy dex files, invoking $(HIDDENAPI) on them in the process.
+# Also make the source dex file an input of the hiddenapi singleton rule in dex_preopt.mk.
define hiddenapi-copy-dex-files
$(2): $(1) $(HIDDENAPI) $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
@@ -2848,6 +2849,10 @@
--light-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
--dark-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \
--blacklist=$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+
+$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): $(1)
+$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): \
+ PRIVATE_DEX_INPUTS := $$(PRIVATE_DEX_INPUTS) $(1)
endef
# File names for intermediate dex files of `hiddenapi-copy-soong-jar`.
@@ -3547,10 +3552,12 @@
###########################################################
## Verify module name meets character requirements:
## a-z A-Z 0-9
-## _.+-=,@~
+## _.+-,@~
##
## This is a subset of bazel's target name restrictions:
## https://docs.bazel.build/versions/master/build-ref.html#name
+##
+## Kati has problems with '=': https://github.com/google/kati/issues/138
###########################################################
define verify-module-name
$(if $(filter-out $(LOCAL_MODULE),$(subst /,,$(LOCAL_MODULE))), \
@@ -3559,14 +3566,14 @@
$(call pretty-error,Invalid characters in module name: $(call _invalid-name-chars,$(LOCAL_MODULE))))
endef
define _invalid-name-chars
-$(subst _,,$(subst .,,$(subst +,,$(subst -,,$(subst =,,$(subst $(comma),,$(subst @,,$(subst ~,,$(subst 0,,$(subst 1,,$(subst 2,,$(subst 3,,$(subst 4,,$(subst 5,,$(subst 6,,$(subst 7,,$(subst 8,,$(subst 9,,$(subst a,,$(subst b,,$(subst c,,$(subst d,,$(subst e,,$(subst f,,$(subst g,,$(subst h,,$(subst i,,$(subst j,,$(subst k,,$(subst l,,$(subst m,,$(subst n,,$(subst o,,$(subst p,,$(subst q,,$(subst r,,$(subst s,,$(subst t,,$(subst u,,$(subst v,,$(subst w,,$(subst x,,$(subst y,,$(subst z,,$(call to-lower,$(1))))))))))))))))))))))))))))))))))))))))))))))
+$(subst _,,$(subst .,,$(subst +,,$(subst -,,$(subst $(comma),,$(subst @,,$(subst ~,,$(subst 0,,$(subst 1,,$(subst 2,,$(subst 3,,$(subst 4,,$(subst 5,,$(subst 6,,$(subst 7,,$(subst 8,,$(subst 9,,$(subst a,,$(subst b,,$(subst c,,$(subst d,,$(subst e,,$(subst f,,$(subst g,,$(subst h,,$(subst i,,$(subst j,,$(subst k,,$(subst l,,$(subst m,,$(subst n,,$(subst o,,$(subst p,,$(subst q,,$(subst r,,$(subst s,,$(subst t,,$(subst u,,$(subst v,,$(subst w,,$(subst x,,$(subst y,,$(subst z,,$(call to-lower,$(1)))))))))))))))))))))))))))))))))))))))))))))
endef
.KATI_READONLY := verify-module-name _invalid-name-chars
###########################################################
## Verify module stem meets character requirements:
## a-z A-Z 0-9
-## _.+-=,@~
+## _.+-,@~
##
## This is a subset of bazel's target name restrictions:
## https://docs.bazel.build/versions/master/build-ref.html#name
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index de830d4..6be6c17 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -89,3 +89,36 @@
ifdef TARGET_2ND_ARCH
$(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
endif # TARGET_2ND_ARCH
+
+# === hiddenapi rules ===
+
+hiddenapi_stubs_jar = $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
+
+# Public API stubs
+HIDDENAPI_STUBS := \
+ $(call hiddenapi_stubs_jar,android_stubs_current) \
+ $(call hiddenapi_stubs_jar,android.test.base.stubs) \
+ $(call hiddenapi_stubs_jar,android.test.mock.stubs) \
+ $(call hiddenapi_stubs_jar,android.test.runner.stubs)
+
+# System API stubs
+HIDDENAPI_STUBS += \
+ $(call hiddenapi_stubs_jar,android_system_stubs_current)
+
+# Test API stubs
+HIDDENAPI_STUBS += \
+ $(call hiddenapi_stubs_jar,android_test_stubs_current)
+
+# Singleton rule which applies $(HIDDENAPI) on all boot class path dex files.
+# Inputs are filled with `hiddenapi-copy-dex-files` rules.
+$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): \
+ PRIVATE_HIDDENAPI_STUBS := $(HIDDENAPI_STUBS)
+$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): \
+ .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
+$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): $(HIDDENAPI) $(HIDDENAPI_STUBS)
+ for INPUT_DEX in $(PRIVATE_DEX_INPUTS); do \
+ find `dirname $${INPUT_DEX}` -maxdepth 1 -name "classes*.dex"; \
+ done | sort | sed 's/^/--boot-dex=/' | xargs $(HIDDENAPI) list \
+ $(addprefix --stub-dex=,$(PRIVATE_HIDDENAPI_STUBS)) \
+ --out-public=$(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) \
+ --out-private=$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST)
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index b64155c..ce060f2 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -106,13 +106,21 @@
ifeq (true,$(my_use_profile_for_boot_image))
-# Location of text based profile for the boot image.
-my_boot_image_profile_location := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
-ifeq (,$(my_boot_image_profile_location))
+boot_image_profiles := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
+
+ifeq (,$(boot_image_profiles))
# If not set, use the default.
-my_boot_image_profile_location := frameworks/base/config/boot-image-profile.txt
+boot_image_profiles := frameworks/base/config/boot-image-profile.txt
endif
+# Location of text based profile for the boot image.
+my_boot_image_profile_location := $(PRODUCT_OUT)/dex_bootjars/boot-image-profile.txt
+
+$(my_boot_image_profile_location): $(boot_image_profiles)
+ @echo 'Generating $@ for profman'
+ @rm -rf $@
+ $(hide) cat $^ > $@
+
# Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs.
my_out_boot_image_profile_location := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.prof
$(my_out_boot_image_profile_location): PRIVATE_PROFILE_INPUT_LOCATION := $(my_boot_image_profile_location)
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 089df6f..3585026 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -191,14 +191,19 @@
installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
else # boot jar
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
+
+my_module_multilib := $(LOCAL_MULTILIB)
+# If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
+my_filtered_lib_name := $(patsubst %.impl,%,$(LOCAL_MODULE))
+ifeq (,$(filter $(JAVA_SDK_LIBRARIES),$(my_filtered_lib_name)))
# For a Java library, by default we build odex for both 1st arch and 2nd arch.
# But it can be overridden with "LOCAL_MULTILIB := first".
ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
# For system server jars, we build for only "first".
my_module_multilib := first
-else
-my_module_multilib := $(LOCAL_MULTILIB)
endif
+endif
+
# #################################################
# Odex for the 1st arch
my_2nd_arch_prefix :=
diff --git a/core/main.mk b/core/main.mk
index 0d2cc34..b057465 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -26,6 +26,8 @@
else # KATI
+$(info [1/1] initializing build system ...)
+
# Absolute path of the present working direcotry.
# This overrides the shell variable $PWD, which does not necessarily points to
# the top of the source tree, for example when "make -C" is used in m/mm/mmm.
@@ -405,6 +407,8 @@
ENFORCE_RRO_SOURCES :=
endif
+subdir_makefiles_inc := .
+
ifneq ($(ONE_SHOT_MAKEFILE),)
# We've probably been invoked by the "mm" shell function
# with a subdirectory's makefile.
@@ -449,7 +453,7 @@
#
subdir_makefiles := $(SOONG_ANDROID_MK) $(file <$(OUT_DIR)/.module_paths/Android.mk.list)
-subdir_makefiles_total := $(words $(subdir_makefiles))
+subdir_makefiles_total := $(words int $(subdir_makefiles) post finish)
.KATI_READONLY := subdir_makefiles_total
$(foreach mk,$(subdir_makefiles),$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] including $(mk) ...)$(eval include $(mk)))
@@ -465,6 +469,12 @@
endif # ONE_SHOT_MAKEFILE
+ifndef subdir_makefiles_total
+subdir_makefiles_total := $(words init post finish)
+endif
+
+$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] finishing build rules ...)
+
# -------------------------------------------------------------------
# All module makefiles have been included at this point.
# -------------------------------------------------------------------
@@ -925,6 +935,32 @@
$(call module-installed-files, $(_pif_modules))
endef
+# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
+# $(1): list of files to print
+# $(2): heading to print on failure
+define maybe-print-list-and-error
+$(if $(strip $(1)), \
+ $(warning $(2)) \
+ $(info Offending entries:) \
+ $(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \
+ $(error Build failed) \
+)
+endef
+
+ifeq (true|,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_PACKAGES_EXIST)|$(filter true,$(ALLOW_MISSING_DEPENDENCIES)))
+ _whitelist := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST)
+ _modules := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
+ # Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
+ # existence if either <module> or the <module>_32 variant.
+ _nonexistant_modules := $(filter-out $(ALL_MODULES),$(_modules))
+ _nonexistant_modules := $(foreach m,$(_nonexistant_modules),\
+ $(if $(call get-32-bit-modules,$(m)),,$(m)))
+ $(call maybe-print-list-and-error,$(filter-out $(_whitelist),$(_nonexistant_modules)),\
+ $(INTERNAL_PRODUCT) includes non-existant modules in PRODUCT_PACKAGES)
+ $(call maybe-print-list-and-error,$(filter-out $(_nonexistant_modules),$(_whitelist)),\
+ $(INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistant PRODUCT_PACKAGES)
+endif
+
ifdef FULL_BUILD
product_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT))
else
@@ -944,18 +980,6 @@
$(foreach p,$(1),$(PRODUCT_OUT)/$(p)$(2))))
endef
-# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
-# $(1): list of files to print
-# $(2): heading to print on failure
-define maybe-print-list-and-error
-$(if $(strip $(1)), \
- $(warning $(2)) \
- $(info Offending entries:) \
- $(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \
- $(error Build failed) \
-)
-endef
-
# Verify the artifact path requirements made by included products.
$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
$(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
@@ -1273,6 +1297,13 @@
endif
endif
+ ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ $(call dist-for-goals, droidcore, \
+ $(INSTALLED_FILES_FILE_ROOT) \
+ $(INSTALLED_FILES_JSON_ROOT) \
+ )
+ endif
+
ifeq ($(EMMA_INSTRUMENT),true)
$(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE)
$(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
@@ -1384,4 +1415,6 @@
ndk: $(SOONG_OUT_DIR)/ndk.timestamp
.PHONY: ndk
+$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] writing build rules ...)
+
endif # KATI
diff --git a/core/package.mk b/core/package.mk
index f3713fc..854e009 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -8,7 +8,9 @@
include $(BUILD_SYSTEM)/multilib.mk
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
- ifneq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(my_module_multilib),|64)
+ ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
+ my_module_multilib := first
+ else ifneq ($(my_module_multilib),64)
my_module_multilib := first
endif
endif
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index c635ca5..94c2dcd 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -667,7 +667,7 @@
$(my_exported_sdk_libs_file):
@echo "Export SDK libs $@"
$(hide) mkdir -p $(dir $@) && rm -f $@
- $(if $(PRIATE_EXPORTED_SDK_LIBS),\
+ $(if $(PRIVATE_EXPORTED_SDK_LIBS),\
$(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
$(hide) touch $@)
diff --git a/core/product.mk b/core/product.mk
index 375fb72..51b376a 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -247,6 +247,16 @@
$(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
endef
+# Makes including non-existant modules in PRODUCT_PACKAGES an error.
+# $(1): whitelist of non-existant modules to allow.
+define enforce-product-packages-exist
+ $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
+ $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \
+ $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST := $(1)) \
+ $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST) \
+ $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST)
+endef
+
#
# Do inherit-product only if $(1) exists
#
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 0ba2c7a..ef71107 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -79,49 +79,55 @@
endif # TURBINE_ENABLED != false
ifdef LOCAL_SOONG_DEX_JAR
- ifndef LOCAL_IS_HOST_MODULE
- ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
- $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
- else # !is_boot_jar
- $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
- endif # is_boot_jar
- $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar)))
+ ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
+ ifndef LOCAL_IS_HOST_MODULE
+ ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
+ $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
+ else # !is_boot_jar
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
+ endif # is_boot_jar
+ $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar)))
- dex_preopt_profile_src_file := $(common_javalib.jar)
+ dex_preopt_profile_src_file := $(common_javalib.jar)
- # defines built_odex along with rule to install odex
- include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
+ # defines built_odex along with rule to install odex
+ include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
- dex_preopt_profile_src_file :=
+ dex_preopt_profile_src_file :=
- ifdef LOCAL_DEX_PREOPT
- ifneq ($(dexpreopt_boot_jar_module),) # boot jar
- # boot jar's rules are defined in dex_preopt.mk
- dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
- $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE)))
+ ifdef LOCAL_DEX_PREOPT
+ ifneq ($(dexpreopt_boot_jar_module),) # boot jar
+ # boot jar's rules are defined in dex_preopt.mk
+ dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
+ $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE)))
- # For libart boot jars, we don't have .odex files.
- else # ! boot jar
- $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
- # Use pattern rule - we may have multiple built odex files.
+ # For libart boot jars, we don't have .odex files.
+ else # ! boot jar
+ $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
+ # Use pattern rule - we may have multiple built odex files.
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
- $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
- endif # ! boot jar
- else # LOCAL_DEX_PREOPT
- $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
- endif # LOCAL_DEX_PREOPT
- else # LOCAL_IS_HOST_MODULE
- $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
- $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar)))
- endif
+ $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
+ endif # ! boot jar
+ else # LOCAL_DEX_PREOPT
+ $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
+ endif # LOCAL_DEX_PREOPT
+ else # LOCAL_IS_HOST_MODULE
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
+ $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar)))
+ endif
- java-dex : $(LOCAL_BUILT_MODULE)
-else
+ java-dex : $(LOCAL_BUILT_MODULE)
+ else # LOCAL_UNINSTALLABLE_MODULE
+ $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
+ $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
+ java-dex : $(common_javalib.jar)
+ endif # LOCAL_UNINSTALLABLE_MODULE
+else # LOCAL_SOONG_DEX_JAR
$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
-endif
+endif # LOCAL_SOONG_DEX_JAR
javac-check : $(full_classes_jar)
javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 86f5bf1..237cd28 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -23,3 +23,6 @@
# Pi GSI supports system-as-root
TARGET_NO_RECOVERY := true
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
+# Audio: must using XML format for Treblized devices
+USE_XML_AUDIO_POLICY_CONF := 1
diff --git a/target/board/go_defaults_common.prop b/target/board/go_defaults_common.prop
index c0c0ef6..5ebcb47 100644
--- a/target/board/go_defaults_common.prop
+++ b/target/board/go_defaults_common.prop
@@ -17,7 +17,6 @@
# Sets Android Go recommended default values for propreties.
# Set lowram options
-ro.config.low_ram=true
ro.lmk.critical_upgrade=true
ro.lmk.upgrade_pressure=40
ro.lmk.downgrade_pressure=60
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index c66f954..8c8f407 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -27,4 +27,7 @@
include $(SRC_TARGET_DIR)/product/full.mk
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
PRODUCT_NAME := aosp_arm
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index e7378d5..aeff3f0 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -43,6 +43,10 @@
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
include $(SRC_TARGET_DIR)/product/emulator.mk
+
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
PRODUCT_NAME := aosp_arm64
PRODUCT_DEVICE := generic_arm64
PRODUCT_BRAND := Android
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index 96c9e33..b044149 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -28,4 +28,7 @@
include $(SRC_TARGET_DIR)/product/full_x86.mk
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
PRODUCT_NAME := aosp_x86
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index b1ed44e..4d2589e 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -41,6 +41,9 @@
include $(SRC_TARGET_DIR)/product/emulator.mk
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
ifdef NET_ETH0_STARTONBOOT
PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
endif
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 5806309..8b3f857 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -112,7 +112,6 @@
libc_malloc_hooks \
libcutils \
libdl \
- libdrmclearkeyplugin \
libdrmframework \
libdrmframework_jni \
libEGL \
@@ -246,26 +245,40 @@
wifi-service \
wm \
-
-# VINTF data
+# VINTF data for system image
PRODUCT_PACKAGES += \
- device_manifest.xml \
framework_manifest.xml \
framework_compatibility_matrix.xml \
+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 := \
+ $(TARGET_CORE_JARS) \
+ legacy-test \
+ ext \
+ framework \
+ telephony-common \
+ voip-common \
+ ims-common \
+ org.apache.http.legacy.impl \
+ android.hidl.base-V1.0-java \
+ android.hidl.manager-V1.0-java
+
PRODUCT_COPY_FILES += \
system/core/rootdir/init.usb.rc:root/init.usb.rc \
system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
system/core/rootdir/ueventd.rc:root/ueventd.rc \
system/core/rootdir/etc/hosts:system/etc/hosts
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote32
PRODUCT_COPY_FILES += system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote32
# Ensure that this property is always defined so that bionic_systrace.cpp
# can rely on it being initially set by init.
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
- debug.atrace.tags.enableflags=0
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += debug.atrace.tags.enableflags=0
# Packages included only for eng or userdebug builds, previously debug tagged
PRODUCT_PACKAGES_DEBUG := \
@@ -279,6 +292,11 @@
sqlite3 \
strace
+# The set of packages whose code can be loaded by the system server.
+PRODUCT_SYSTEM_SERVER_APPS += \
+ SettingsProvider \
+ WallpaperBackup
+
# Packages included only for eng/userdebug builds, when building with SANITIZE_TARGET=address
PRODUCT_PACKAGES_DEBUG_ASAN :=
@@ -290,9 +308,4 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/config/dirty-image-objects:system/etc/dirty-image-objects)
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- ro.zygote=zygote32
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
-
$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index b6b2450..9542a0e 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -27,7 +27,6 @@
android.hardware.cas@1.0-service \
android.hardware.configstore@1.0-service \
android.hardware.media.omx@1.0-service \
- device_compatibility_matrix.xml \
fs_config_files_nonsystem \
fs_config_dirs_nonsystem \
gralloc.default \
@@ -35,6 +34,7 @@
libbundlewrapper \
libclearkeycasplugin \
libdownmix \
+ libdrmclearkeyplugin \
libeffectproxy \
libeffects \
libldnhncr \
@@ -47,3 +47,8 @@
shell_and_utilities_vendor \
vndservice \
vndservicemanager \
+
+# VINTF data for vendor image
+PRODUCT_PACKAGES += \
+ device_manifest.xml \
+ device_compatibility_matrix.xml \
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index a4e5fb2..b432a91 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -14,116 +14,16 @@
# limitations under the License.
#
-# Base configuration for most consumer android devices. Do not put
-# things that are specific to communication devices (phones, tables,
-# etc.) here -- for that, use generic_no_telephony.mk.
+# This product is the base of a generic media-capable device, which
+# means most android products, but excludes wearables.
+#
+# Note: Do not add any contents directly to this file. Choose either
+# media_system or media_vendor depending on partition (also consider
+# base_<x>.mk or handheld_<x>.mk.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/media_system.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk)
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := core
-
-PRODUCT_PACKAGES += \
- com.android.future.usb.accessory \
- com.android.mediadrm.signer \
- com.android.media.remotedisplay \
- com.android.media.remotedisplay.xml \
- CompanionDeviceManager \
- drmserver \
- ethernet-service \
- fsck.f2fs \
- HTMLViewer \
- libaudiopreprocessing \
- libfilterpack_imageproc \
- libstagefright_soft_aacdec \
- libstagefright_soft_aacenc \
- libstagefright_soft_amrdec \
- libstagefright_soft_amrnbenc \
- libstagefright_soft_amrwbenc \
- libstagefright_soft_avcdec \
- libstagefright_soft_avcenc \
- libstagefright_soft_flacdec \
- libstagefright_soft_flacenc \
- libstagefright_soft_g711dec \
- libstagefright_soft_gsmdec \
- libstagefright_soft_hevcdec \
- libstagefright_soft_mp3dec \
- libstagefright_soft_mpeg2dec \
- libstagefright_soft_mpeg4dec \
- libstagefright_soft_mpeg4enc \
- libstagefright_soft_opusdec \
- libstagefright_soft_rawdec \
- libstagefright_soft_vorbisdec \
- libstagefright_soft_vpxdec \
- libstagefright_soft_vpxenc \
- libwebrtc_audio_preprocessing \
- libwebviewchromium_loader \
- libwebviewchromium_plat_support \
- logd \
- make_f2fs \
- PackageInstaller \
- requestsync \
- StatementService \
- vndk_snapshot_package \
- webview \
-
-
-PRODUCT_COPY_FILES += \
- frameworks/native/data/etc/android.software.webview.xml:system/etc/permissions/android.software.webview.xml
-
-ifneq (REL,$(PLATFORM_VERSION_CODENAME))
-PRODUCT_COPY_FILES += \
- 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 := \
- $(TARGET_CORE_JARS) \
- legacy-test \
- ext \
- framework \
- telephony-common \
- voip-common \
- ims-common \
- org.apache.http.legacy.impl \
- android.hidl.base-V1.0-java \
- android.hidl.manager-V1.0-java
-
-# The order of PRODUCT_SYSTEM_SERVER_JARS matters.
-PRODUCT_SYSTEM_SERVER_JARS := \
- services \
- ethernet-service \
- wifi-service \
- com.android.location.provider \
-
-# The set of packages whose code can be loaded by the system server.
-PRODUCT_SYSTEM_SERVER_APPS += \
- SettingsProvider \
- WallpaperBackup
-
-PRODUCT_COPY_FILES += \
- system/core/rootdir/etc/public.libraries.android.txt:system/etc/public.libraries.txt
-
-# Enable boot.oat filtering of compiled classes to reduce boot.oat size. b/28026683
-PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
- frameworks/base/config/compiled-classes-phone:system/etc/compiled-classes)
-
-# Enable dirty image object binning to reduce dirty pages in the image.
-PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
- frameworks/base/dirty-image-objects-phone:system/etc/dirty-image-objects)
-
-# On userdebug builds, collect more tombstones by default.
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
- tombstoned.max_tombstone_count=50
-endif
-
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- ro.logd.size.stats=64K \
- log.tag.stats_log=I
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/base_system.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/base_vendor.mk)
diff --git a/target/product/generic.mk b/target/product/generic.mk
index dd0d663..cc856f4 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -24,3 +24,8 @@
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := generic
+
+_whitelist := \
+ device_manifest.xml \
+
+$(call enforce-product-packages-exist,$(_whitelist))
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 4e89f5e..5346476 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -14,100 +14,15 @@
# limitations under the License.
#
-# This is a generic phone product that isn't specialized for a specific device.
-# It includes the base Android platform.
+# This product is a generic phone or tablet, that doesn't have telephony.
+#
+# Note: Do not add any contents directly to this file. Choose either
+# handheld_system or handheld_vendor depending on partition (also consider
+# base_<x>.mk or media_<x>.mk.
-PRODUCT_PACKAGES := \
- audio.primary.default \
- BasicDreams \
- BlockedNumberProvider \
- Bluetooth \
- BluetoothMidiService \
- BookmarkProvider \
- Browser2 \
- BuiltInPrintService \
- Calendar \
- CalendarProvider \
- Camera2 \
- CaptivePortalLogin \
- CertInstaller \
- clatd \
- clatd.conf \
- Contacts \
- DeskClock \
- DocumentsUI \
- DownloadProviderUi \
- EasterEgg \
- Email \
- ExactCalculator \
- ExternalStorageProvider \
- FusedLocation \
- Gallery2 \
- Home \
- InputDevices \
- KeyChain \
- LatinIME \
- librs_jni \
- local_time.default \
- ManagedProvisioning \
- MmsService \
- MtpDocumentsProvider \
- Music \
- MusicFX \
- NfcNci \
- OneTimeInitializer \
- PacProcessor \
- power.default \
- PrintRecommendationService \
- PrintSpooler \
- Provision \
- ProxyHandler \
- QuickSearchBox \
- screenrecord \
- SecureElement \
- Settings \
- SharedStorageBackup \
- StorageManager \
- SystemUI \
- SysuiDarkThemeOverlay \
- Telecom \
- TelephonyProvider \
- TeleService \
- Traceur \
- vibrator.default \
- UserDictionaryProvider \
- VpnDialogs \
- vr \
- WallpaperCropper \
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
-
-PRODUCT_SYSTEM_SERVER_APPS += \
- FusedLocation \
- InputDevices \
- KeyChain \
- Telecom \
-
-PRODUCT_COPY_FILES := \
- frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf
-
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.carrier=unknown \
- ro.config.notification_sound=OnTheHunt.ogg \
- ro.config.alarm_alert=Alarm_Classic.ogg
-
-$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/dancing-script/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
-$(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
-$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
-$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
-$(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk)
-$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
-$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
-
-# Overrides
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := generic_no_telephony
diff --git a/target/product/go_defaults_common.mk b/target/product/go_defaults_common.mk
index 7e71e26..9cff21b 100644
--- a/target/product/go_defaults_common.mk
+++ b/target/product/go_defaults_common.mk
@@ -16,6 +16,11 @@
# Sets Android Go recommended default product options.
+
+# Set lowram options
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.config.low_ram=true \
+
# Speed profile services and wifi-service to reduce RAM and storage.
PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := speed-profile
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
new file mode 100644
index 0000000..b4dea35
--- /dev/null
+++ b/target/product/handheld_system.mk
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This makefile contains the system partition contents for
+# a generic phone or tablet device. Only add something here if
+# it definitely doesn't belong on other types of devices (if it
+# does, use base_vendor.mk).
+$(call inherit-product, $(SRC_TARGET_DIR)/product/media_system.mk)
+$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/dancing-script/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk)
+$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk)
+$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
+$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
+
+PRODUCT_PACKAGES += \
+ BasicDreams \
+ BlockedNumberProvider \
+ Bluetooth \
+ BluetoothMidiService \
+ BookmarkProvider \
+ Browser2 \
+ BuiltInPrintService \
+ Calendar \
+ CalendarProvider \
+ Camera2 \
+ CaptivePortalLogin \
+ CertInstaller \
+ clatd \
+ clatd.conf \
+ Contacts \
+ DeskClock \
+ DocumentsUI \
+ DownloadProviderUi \
+ EasterEgg \
+ Email \
+ ExactCalculator \
+ ExternalStorageProvider \
+ FusedLocation \
+ Gallery2 \
+ Home \
+ InputDevices \
+ KeyChain \
+ LatinIME \
+ librs_jni \
+ ManagedProvisioning \
+ MmsService \
+ MtpDocumentsProvider \
+ Music \
+ MusicFX \
+ NfcNci \
+ OneTimeInitializer \
+ PacProcessor \
+ PrintRecommendationService \
+ PrintSpooler \
+ Provision \
+ ProxyHandler \
+ QuickSearchBox \
+ screenrecord \
+ SecureElement \
+ Settings \
+ SharedStorageBackup \
+ StorageManager \
+ SystemUI \
+ Telecom \
+ TelephonyProvider \
+ TeleService \
+ Traceur \
+ UserDictionaryProvider \
+ VpnDialogs \
+ vr \
+ WallpaperCropper \
+
+
+PRODUCT_SYSTEM_SERVER_APPS += \
+ FusedLocation \
+ InputDevices \
+ KeyChain \
+ Telecom \
+
+PRODUCT_COPY_FILES += \
+ frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf
+
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.carrier=unknown \
+ ro.config.notification_sound=OnTheHunt.ogg \
+ ro.config.alarm_alert=Alarm_Classic.ogg
diff --git a/target/product/handheld_vendor.mk b/target/product/handheld_vendor.mk
new file mode 100644
index 0000000..ab4c76c
--- /dev/null
+++ b/target/product/handheld_vendor.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This makefile contains the non-system partition contents for
+# a generic phone or tablet device. Only add something here if
+# it definitely doesn't belong on other types of devices (if it
+# does, use base_vendor.mk).
+$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk)
+PRODUCT_PACKAGES += \
+ audio.primary.default \
+ local_time.default \
+ power.default \
+ SysuiDarkThemeOverlay \
+ vibrator.default \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index 2e161db..9c904fb 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -14,8 +14,8 @@
# limitations under the License.
#
-# TODO(hansson): change inheritance to core_minimal, then generic_no_telephony
-$(call inherit-product, $(SRC_TARGET_DIR)/product/base_system.mk)
+# TODO(hansson): change inheritance to generic_no_telephony
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system.mk)
PRODUCT_NAME := mainline_system
PRODUCT_BRAND := generic
@@ -23,8 +23,6 @@
_base_mk_whitelist := \
recovery/root/etc/mke2fs.conf \
- vendor/lib/mediadrm/libdrmclearkeyplugin.so \
- vendor/lib64/mediadrm/libdrmclearkeyplugin.so \
_my_whitelist := $(_base_mk_whitelist)
diff --git a/target/product/media_system.mk b/target/product/media_system.mk
new file mode 100644
index 0000000..f858aaf
--- /dev/null
+++ b/target/product/media_system.mk
@@ -0,0 +1,99 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This makefile contains the system partition contents for
+# media-capable devices (non-wearables). Only add something
+# here if it definitely doesn't belong on wearables. Otherwise,
+# choose base_system.mk.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/base_system.mk)
+
+PRODUCT_PACKAGES += \
+ com.android.future.usb.accessory \
+ com.android.mediadrm.signer \
+ com.android.media.remotedisplay \
+ com.android.media.remotedisplay.xml \
+ CompanionDeviceManager \
+ drmserver \
+ ethernet-service \
+ fsck.f2fs \
+ HTMLViewer \
+ libfilterpack_imageproc \
+ libstagefright_soft_aacdec \
+ libstagefright_soft_aacenc \
+ libstagefright_soft_amrdec \
+ libstagefright_soft_amrnbenc \
+ libstagefright_soft_amrwbenc \
+ libstagefright_soft_avcdec \
+ libstagefright_soft_avcenc \
+ libstagefright_soft_flacdec \
+ libstagefright_soft_flacenc \
+ libstagefright_soft_g711dec \
+ libstagefright_soft_gsmdec \
+ libstagefright_soft_hevcdec \
+ libstagefright_soft_mp3dec \
+ libstagefright_soft_mpeg2dec \
+ libstagefright_soft_mpeg4dec \
+ libstagefright_soft_mpeg4enc \
+ libstagefright_soft_opusdec \
+ libstagefright_soft_rawdec \
+ libstagefright_soft_vorbisdec \
+ libstagefright_soft_vpxdec \
+ libstagefright_soft_vpxenc \
+ libwebviewchromium_loader \
+ libwebviewchromium_plat_support \
+ make_f2fs \
+ PackageInstaller \
+ requestsync \
+ StatementService \
+ vndk_snapshot_package \
+ webview \
+
+
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.software.webview.xml:system/etc/permissions/android.software.webview.xml
+
+ifneq (REL,$(PLATFORM_VERSION_CODENAME))
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.software.preview_sdk.xml:system/etc/permissions/android.software.preview_sdk.xml
+endif
+
+# The order of PRODUCT_SYSTEM_SERVER_JARS matters.
+PRODUCT_SYSTEM_SERVER_JARS := \
+ services \
+ ethernet-service \
+ wifi-service \
+ com.android.location.provider.impl \
+
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/etc/public.libraries.android.txt:system/etc/public.libraries.txt
+
+# Enable boot.oat filtering of compiled classes to reduce boot.oat size. b/28026683
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
+ frameworks/base/config/compiled-classes-phone:system/etc/compiled-classes)
+
+# Enable dirty image object binning to reduce dirty pages in the image.
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
+ frameworks/base/dirty-image-objects-phone:system/etc/dirty-image-objects)
+
+# On userdebug builds, collect more tombstones by default.
+ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ tombstoned.max_tombstone_count=50
+endif
+
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+ ro.logd.size.stats=64K \
+ log.tag.stats_log=I
diff --git a/target/product/media_vendor.mk b/target/product/media_vendor.mk
new file mode 100644
index 0000000..1db0b58
--- /dev/null
+++ b/target/product/media_vendor.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This makefile contains the non-system partition contents for
+# media-capable devices (non-wearables). Only add something here
+# if it definitely doesn't belong on wearables. Otherwise, choose
+# base_vendor.mk.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/base_vendor.mk)
+
+PRODUCT_PACKAGES += \
+ libaudiopreprocessing \
+ libwebrtc_audio_preprocessing \
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 24c5b2d..e82e66a 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -270,7 +270,6 @@
USED_IMGDIFF_LARGE_APK = "Large APK files split and diff'd with imgdiff"
# Reasons for not applying imgdiff on APKs.
- SKIPPED_TRIMMED = "Not used imgdiff due to trimmed RangeSet"
SKIPPED_NONMONOTONIC = "Not used imgdiff due to having non-monotonic ranges"
SKIPPED_SHARED_BLOCKS = "Not used imgdiff due to using shared blocks"
SKIPPED_INCOMPLETE = "Not used imgdiff due to incomplete RangeSet"
@@ -279,7 +278,6 @@
REASONS = (
USED_IMGDIFF,
USED_IMGDIFF_LARGE_APK,
- SKIPPED_TRIMMED,
SKIPPED_NONMONOTONIC,
SKIPPED_SHARED_BLOCKS,
SKIPPED_INCOMPLETE,
@@ -449,10 +447,6 @@
self.imgdiff_stats.Log(name, ImgdiffStats.SKIPPED_INCOMPLETE)
return False
- if tgt_ranges.extra.get('trimmed') or src_ranges.extra.get('trimmed'):
- self.imgdiff_stats.Log(name, ImgdiffStats.SKIPPED_TRIMMED)
- return False
-
reason = (ImgdiffStats.USED_IMGDIFF_LARGE_APK if large_apk
else ImgdiffStats.USED_IMGDIFF)
self.imgdiff_stats.Log(name, reason)
@@ -836,14 +830,10 @@
str(xf.tgt_ranges), str(xf.src_ranges)))
else:
if xf.patch:
- # We have already generated the patch with imgdiff. Check if the
- # transfer is intact.
+ # We have already generated the patch with imgdiff, while
+ # splitting large APKs (i.e. in FindTransfers()).
assert not self.disable_imgdiff
imgdiff = True
- if (xf.src_ranges.extra.get('trimmed') or
- xf.tgt_ranges.extra.get('trimmed')):
- imgdiff = False
- xf.patch = None
else:
imgdiff = self.CanUseImgdiff(
xf.tgt_name, xf.tgt_ranges, xf.src_ranges)
@@ -1045,42 +1035,6 @@
for i, xf in enumerate(L):
xf.order = i
- def RemoveBackwardEdges(self):
- print("Removing backward edges...")
- in_order = 0
- out_of_order = 0
- lost_source = 0
-
- for xf in self.transfers:
- lost = 0
- size = xf.src_ranges.size()
- for u in xf.goes_before:
- # xf should go before u
- if xf.order < u.order:
- # it does, hurray!
- in_order += 1
- else:
- # it doesn't, boo. trim the blocks that u writes from xf's
- # source, so that xf can go after u.
- out_of_order += 1
- assert xf.src_ranges.overlaps(u.tgt_ranges)
- xf.src_ranges = xf.src_ranges.subtract(u.tgt_ranges)
- xf.src_ranges.extra['trimmed'] = True
-
- if xf.style == "diff" and not xf.src_ranges:
- # nothing left to diff from; treat as new data
- xf.style = "new"
-
- lost = size - xf.src_ranges.size()
- lost_source += lost
-
- print((" %d/%d dependencies (%.2f%%) were violated; "
- "%d source blocks removed.") %
- (out_of_order, in_order + out_of_order,
- (out_of_order * 100.0 / (in_order + out_of_order))
- if (in_order + out_of_order) else 0.0,
- lost_source))
-
def ReverseBackwardEdges(self):
"""Reverse unsatisfying edges and compute pairs of stashed blocks.
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 14d0ca4..364d6ac 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -654,12 +654,25 @@
# if they contain all zeros. We can't reconstruct such a file from its block
# list. Tag such entries accordingly. (Bug: 65213616)
for entry in image.file_map:
- # "/system/framework/am.jar" => "SYSTEM/framework/am.jar".
- arcname = string.replace(entry, which, which.upper(), 1)[1:]
# Skip artificial names, such as "__ZERO", "__NONZERO-1".
- if arcname not in input_zip.namelist():
+ if not entry.startswith('/'):
continue
+ # "/system/framework/am.jar" => "SYSTEM/framework/am.jar". Note that when
+ # using system_root_image, the filename listed in system.map may contain an
+ # additional leading slash (i.e. "//system/framework/am.jar"). Using lstrip
+ # to get consistent results.
+ arcname = string.replace(entry, which, which.upper(), 1).lstrip('/')
+
+ # Special handling another case with system_root_image, where files not
+ # under /system (e.g. "/sbin/charger") are packed under ROOT/ in a
+ # target_files.zip.
+ if which == 'system' and not arcname.startswith('SYSTEM'):
+ arcname = 'ROOT/' + arcname
+
+ assert arcname in input_zip.namelist(), \
+ "Failed to find the ZIP entry for {}".format(entry)
+
info = input_zip.getinfo(arcname)
ranges = image.file_map[entry]
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 7a81928..5c3533e 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -31,14 +31,6 @@
else:
self.fstab = fstab
- def MakeTemporary(self):
- """Make a temporary script object whose commands can latter be
- appended to the parent script with AppendScript(). Used when the
- caller wants to generate script commands out-of-order."""
- x = EdifyGenerator(self.version, self.info)
- x.mounts = self.mounts
- return x
-
@property
def required_cache(self):
"""Return the minimum cache size to apply the update."""
@@ -181,22 +173,6 @@
') || abort("E%d: \\"%s\\" has unexpected contents.");' % (
common.ErrorCode.BAD_PATCH_FILE, filename))
- def Verify(self, filename):
- """Check that the given file has one of the
- given hashes (encoded in the filename)."""
- self.script.append(
- 'apply_patch_check("{filename}") && '
- 'ui_print(" Verified.") || '
- 'ui_print("\\"{filename}\\" has unexpected contents.");'.format(
- filename=filename))
-
- def FileCheck(self, filename, *sha1):
- """Check that the given file has one of the
- given *sha1 hashes."""
- self.script.append('assert(sha1_check(read_file("%s")' % (filename,) +
- "".join([', "%s"' % (i,) for i in sha1]) +
- '));')
-
def CacheFreeSpaceCheck(self, amount):
"""Check that there's at least 'amount' space that can be made
available on /cache."""
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index a8c821f..26d4187 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -250,12 +250,14 @@
def __init__(self, info_dict, oem_dicts):
"""Initializes a BuildInfo instance with the given dicts.
+ Note that it only wraps up the given dicts, without making copies.
+
Arguments:
info_dict: The build-time info dict.
oem_dicts: A list of OEM dicts (which is parsed from --oem_settings). Note
that it always uses the first dict to calculate the fingerprint or the
device name. The rest would be used for asserting OEM properties only
- (e.g. one package can be installed on one of these devices).
+ (e.g. one package can be installed on one of these devices).
"""
self.info_dict = info_dict
self.oem_dicts = oem_dicts
@@ -289,9 +291,15 @@
def __getitem__(self, key):
return self.info_dict[key]
+ def __setitem__(self, key, value):
+ self.info_dict[key] = value
+
def get(self, key, default=None):
return self.info_dict.get(key, default)
+ def items(self):
+ return self.info_dict.items()
+
def GetBuildProp(self, prop):
"""Returns the inquired build property."""
try:
@@ -1649,9 +1657,15 @@
target_file = common.MakeTempFile(prefix="targetfiles-", suffix=".zip")
target_zip = zipfile.ZipFile(target_file, 'w', allowZip64=True)
- input_tmp = common.UnzipTemp(input_file, UNZIP_PATTERN)
with zipfile.ZipFile(input_file, 'r') as input_zip:
infolist = input_zip.infolist()
+ namelist = input_zip.namelist()
+
+ # Additionally unzip 'RADIO/*' if exists.
+ unzip_pattern = UNZIP_PATTERN[:]
+ if any([entry.startswith('RADIO/') for entry in namelist]):
+ unzip_pattern.append('RADIO/*')
+ input_tmp = common.UnzipTemp(input_file, unzip_pattern)
for info in infolist:
unzipped_file = os.path.join(input_tmp, *info.filename.split('/'))
@@ -1667,7 +1681,7 @@
elif skip_postinstall and info.filename == POSTINSTALL_CONFIG:
pass
- elif info.filename.startswith(('META/', 'IMAGES/')):
+ elif info.filename.startswith(('META/', 'IMAGES/', 'RADIO/')):
common.ZipWrite(target_zip, unzipped_file, arcname=info.filename)
common.ZipClose(target_zip)
diff --git a/tools/releasetools/test_blockimgdiff.py b/tools/releasetools/test_blockimgdiff.py
index ceada18..124b4d5 100644
--- a/tools/releasetools/test_blockimgdiff.py
+++ b/tools/releasetools/test_blockimgdiff.py
@@ -203,8 +203,8 @@
self.assertDictEqual(
{
- ImgdiffStats.USED_IMGDIFF : {"/system/app/app1.apk"},
- ImgdiffStats.USED_IMGDIFF_LARGE_APK : {"/vendor/app/app2.apk"},
+ ImgdiffStats.USED_IMGDIFF: {"/system/app/app1.apk"},
+ ImgdiffStats.USED_IMGDIFF_LARGE_APK: {"/vendor/app/app2.apk"},
},
block_image_diff.imgdiff_stats.stats)
@@ -229,13 +229,6 @@
"/system/app/app2.apk", RangeSet("10-15"),
RangeSet("15-20 30 10-14")))
- # At least one of the ranges has been modified.
- src_ranges = RangeSet("0-5")
- src_ranges.extra['trimmed'] = True
- self.assertFalse(
- block_image_diff.CanUseImgdiff(
- "/vendor/app/app3.apk", RangeSet("10-15"), src_ranges))
-
# At least one of the ranges is incomplete.
src_ranges = RangeSet("0-5")
src_ranges.extra['incomplete'] = True
@@ -246,8 +239,7 @@
# The stats are correctly logged.
self.assertDictEqual(
{
- ImgdiffStats.SKIPPED_NONMONOTONIC : {'/system/app/app2.apk'},
- ImgdiffStats.SKIPPED_TRIMMED : {'/vendor/app/app3.apk'},
+ ImgdiffStats.SKIPPED_NONMONOTONIC: {'/system/app/app2.apk'},
ImgdiffStats.SKIPPED_INCOMPLETE: {'/vendor/app/app4.apk'},
},
block_image_diff.imgdiff_stats.stats)
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index f211b03..1c75d19 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -662,6 +662,74 @@
self.assertFalse(sparse_image.file_map['/system/file1'].extra)
self.assertTrue(sparse_image.file_map['/system/file2'].extra['incomplete'])
+ def test_GetSparseImage_systemRootImage_filenameWithExtraLeadingSlash(self):
+ target_files = common.MakeTempFile(prefix='target_files-', suffix='.zip')
+ with zipfile.ZipFile(target_files, 'w') as target_files_zip:
+ target_files_zip.write(
+ test_utils.construct_sparse_image([(0xCAC2, 16)]),
+ arcname='IMAGES/system.img')
+ target_files_zip.writestr(
+ 'IMAGES/system.map',
+ '\n'.join([
+ '//system/file1 1-5 9-10',
+ '//system/file2 11-12',
+ '/system/app/file3 13-15']))
+ target_files_zip.writestr('SYSTEM/file1', os.urandom(4096 * 7))
+ # '/system/file2' has less blocks listed (2) than actual (3).
+ target_files_zip.writestr('SYSTEM/file2', os.urandom(4096 * 3))
+ # '/system/app/file3' has less blocks listed (3) than actual (4).
+ target_files_zip.writestr('SYSTEM/app/file3', os.urandom(4096 * 4))
+
+ tempdir = common.UnzipTemp(target_files)
+ with zipfile.ZipFile(target_files, 'r') as input_zip:
+ sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
+
+ self.assertFalse(sparse_image.file_map['//system/file1'].extra)
+ self.assertTrue(sparse_image.file_map['//system/file2'].extra['incomplete'])
+ self.assertTrue(
+ sparse_image.file_map['/system/app/file3'].extra['incomplete'])
+
+ def test_GetSparseImage_systemRootImage_nonSystemFiles(self):
+ target_files = common.MakeTempFile(prefix='target_files-', suffix='.zip')
+ with zipfile.ZipFile(target_files, 'w') as target_files_zip:
+ target_files_zip.write(
+ test_utils.construct_sparse_image([(0xCAC2, 16)]),
+ arcname='IMAGES/system.img')
+ target_files_zip.writestr(
+ 'IMAGES/system.map',
+ '\n'.join([
+ '//system/file1 1-5 9-10',
+ '//init.rc 13-15']))
+ target_files_zip.writestr('SYSTEM/file1', os.urandom(4096 * 7))
+ # '/init.rc' has less blocks listed (3) than actual (4).
+ target_files_zip.writestr('ROOT/init.rc', os.urandom(4096 * 4))
+
+ tempdir = common.UnzipTemp(target_files)
+ with zipfile.ZipFile(target_files, 'r') as input_zip:
+ sparse_image = common.GetSparseImage('system', tempdir, input_zip, False)
+
+ self.assertFalse(sparse_image.file_map['//system/file1'].extra)
+ self.assertTrue(sparse_image.file_map['//init.rc'].extra['incomplete'])
+
+ def test_GetSparseImage_fileNotFound(self):
+ target_files = common.MakeTempFile(prefix='target_files-', suffix='.zip')
+ with zipfile.ZipFile(target_files, 'w') as target_files_zip:
+ target_files_zip.write(
+ test_utils.construct_sparse_image([(0xCAC2, 16)]),
+ arcname='IMAGES/system.img')
+ target_files_zip.writestr(
+ 'IMAGES/system.map',
+ '\n'.join([
+ '//system/file1 1-5 9-10',
+ '//system/file2 11-12']))
+ target_files_zip.writestr('SYSTEM/file1', os.urandom(4096 * 7))
+
+ tempdir = common.UnzipTemp(target_files)
+ with zipfile.ZipFile(target_files, 'r') as input_zip:
+ self.assertRaises(
+ AssertionError, common.GetSparseImage, 'system', tempdir, input_zip,
+ False)
+
class InstallRecoveryScriptFormatTest(unittest.TestCase):
"""Checks the format of install-recovery.sh.
diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py
index e472363..c8e6750 100644
--- a/tools/releasetools/test_ota_from_target_files.py
+++ b/tools/releasetools/test_ota_from_target_files.py
@@ -190,6 +190,16 @@
self.assertRaises(KeyError,
lambda: target_info['build.prop']['ro.build.foo'])
+ def test___setitem__(self):
+ target_info = BuildInfo(copy.deepcopy(self.TEST_INFO_DICT), None)
+ self.assertEqual('value1', target_info['property1'])
+ target_info['property1'] = 'value2'
+ self.assertEqual('value2', target_info['property1'])
+
+ self.assertEqual('build-foo', target_info['build.prop']['ro.build.foo'])
+ target_info['build.prop']['ro.build.foo'] = 'build-bar'
+ self.assertEqual('build-bar', target_info['build.prop']['ro.build.foo'])
+
def test_get(self):
target_info = BuildInfo(self.TEST_INFO_DICT, None)
self.assertEqual('value1', target_info.get('property1'))
@@ -209,6 +219,12 @@
self.assertRaises(KeyError,
lambda: target_info.get('build.prop')['ro.build.foo'])
+ def test_items(self):
+ target_info = BuildInfo(self.TEST_INFO_DICT, None)
+ items = target_info.items()
+ self.assertIn(('property1', 'value1'), items)
+ self.assertIn(('property2', 4096), items)
+
def test_GetBuildProp(self):
target_info = BuildInfo(self.TEST_INFO_DICT, None)
self.assertEqual('build-foo', target_info.GetBuildProp('ro.build.foo'))
@@ -550,6 +566,8 @@
self.assertIn('IMAGES/boot.img', namelist)
self.assertIn('IMAGES/system.img', namelist)
self.assertIn('IMAGES/vendor.img', namelist)
+ self.assertIn('RADIO/bootloader.img', namelist)
+ self.assertIn('RADIO/modem.img', namelist)
self.assertIn(POSTINSTALL_CONFIG, namelist)
self.assertNotIn('IMAGES/system_other.img', namelist)
@@ -567,11 +585,33 @@
self.assertIn('IMAGES/boot.img', namelist)
self.assertIn('IMAGES/system.img', namelist)
self.assertIn('IMAGES/vendor.img', namelist)
+ self.assertIn('RADIO/bootloader.img', namelist)
+ self.assertIn('RADIO/modem.img', namelist)
self.assertNotIn('IMAGES/system_other.img', namelist)
self.assertNotIn('IMAGES/system.map', namelist)
self.assertNotIn(POSTINSTALL_CONFIG, namelist)
+ def test_GetTargetFilesZipForSecondaryImages_withoutRadioImages(self):
+ input_file = construct_target_files(secondary=True)
+ common.ZipDelete(input_file, 'RADIO/bootloader.img')
+ common.ZipDelete(input_file, 'RADIO/modem.img')
+ target_file = GetTargetFilesZipForSecondaryImages(input_file)
+
+ with zipfile.ZipFile(target_file) as verify_zip:
+ namelist = verify_zip.namelist()
+
+ self.assertIn('META/ab_partitions.txt', namelist)
+ self.assertIn('IMAGES/boot.img', namelist)
+ self.assertIn('IMAGES/system.img', namelist)
+ self.assertIn('IMAGES/vendor.img', namelist)
+ self.assertIn(POSTINSTALL_CONFIG, namelist)
+
+ self.assertNotIn('IMAGES/system_other.img', namelist)
+ self.assertNotIn('IMAGES/system.map', namelist)
+ self.assertNotIn('RADIO/bootloader.img', namelist)
+ self.assertNotIn('RADIO/modem.img', namelist)
+
def test_GetTargetFilesZipWithoutPostinstallConfig(self):
input_file = construct_target_files()
target_file = GetTargetFilesZipWithoutPostinstallConfig(input_file)