Merge changes I1772a55a,Ibd398d4f,If5476048,Ied201aad
* changes:
Enable mainline checking for all GSI targets
Change aosp_$arch.mk to inherit from gsi_common.mk
Change Legacy GSI to inherit from gsi_common.mk
Whilelist system/product_services in gsi_common.mk
diff --git a/Changes.md b/Changes.md
index 1ed6bf8..165be01 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,20 @@
# Build System Changes for Android.mk Writers
+## `LOCAL_MODULE_TAGS := eng debug` deprecation {#LOCAL_MODULE_TAGS}
+
+`LOCAL_MODULE_TAGS` value `eng` and `debug` are being deprecated. They allowed
+modules to specify that they should always be installed on `-eng`, or `-eng`
+and `-userdebug` builds. This conflicted with the ability for products to
+specify which modules should be installed, effectively making it impossible to
+build a stripped down product configuration that did not include those modules.
+
+For the equivalent functionality, specify the modules in `PRODUCT_PACKAGES_ENG`
+or `PRODUCT_PACKAGES_DEBUG` in the appropriate product makefiles.
+
+Core android packages like `su` got added to the list in
+`build/make/target/product/base_system.mk`, but for device-specific modules
+there are often better base product makefiles to use instead.
+
## `USER` deprecation {#USER}
`USER` will soon be `nobody` in many cases due to the addition of a sandbox
diff --git a/core/Makefile b/core/Makefile
index ad9b452..fbf6d57 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1321,6 +1321,7 @@
define generate-image-prop-dictionary
$(if $(filter $(2),system),\
$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
@@ -2517,6 +2518,17 @@
$(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
$(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+# Determines partition size for system_other.img.
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
+INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
+endif
+endif
+
+ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
+INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
+endif
+
systemotherimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,system_other)
BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
@@ -2533,7 +2545,7 @@
$(systemotherimage_intermediates)/generated_system_other_image_info.txt
$(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
$(call read-image-prop-dictionary,\
- $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_size))
+ $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_other_size))
endef
# We just build this directly to the install location.
@@ -2574,10 +2586,71 @@
$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
+
+$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
+
+# -- Kernel version and configurations.
+ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
+
+# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
+# from INSTALLED_KERNEL_TARGET.
+ifdef BOARD_KERNEL_CONFIG_FILE
+ifdef BOARD_KERNEL_VERSION
+$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BOARD_KERNEL_CONFIG_FILE)
+$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $(BOARD_KERNEL_VERSION):$(BOARD_KERNEL_CONFIG_FILE)
+my_board_extracted_kernel := true
+endif # BOARD_KERNEL_VERSION
+endif # BOARD_KERNEL_CONFIG_FILE
+
+ifneq ($(my_board_extracted_kernel),true)
+ifndef INSTALLED_KERNEL_TARGET
+$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
+ is true. Information about the updated kernel cannot be built into OTA update package. \
+ You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
+ to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
+ or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
+ BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
+ manually.)
+else
+intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
+
+# Tools for decompression that is not in PATH.
+# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
+# Algorithms that are in the script but not in this list will be found in PATH.
+my_decompress_tools := \
+ lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
+
+my_kernel_configs := $(intermediates)/kernel_configs.txt
+my_kernel_version := $(intermediates)/kernel_version.txt
+$(my_kernel_configs): .KATI_IMPLICIT_OUTPUTS := $(my_kernel_version)
+$(my_kernel_configs): PRIVATE_KERNEL_VERSION_FILE := $(my_kernel_version)
+$(my_kernel_configs): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
+$(my_kernel_configs): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
+$(my_kernel_configs): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
+ $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
+ --output-configs $@ \
+ --output-version $(PRIVATE_KERNEL_VERSION_FILE)
+
+$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(my_kernel_configs) $(my_kernel_version)
+$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(my_kernel_version)):$(my_kernel_configs)
+
+intermediates :=
+my_kernel_configs :=
+my_kernel_version :=
+my_decompress_tools :=
+
+endif # my_board_extracted_kernel
+my_board_extracted_kernel :=
+
+endif # INSTALLED_KERNEL_TARGET
+endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
+
+$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
@echo "Verifying vendor VINTF manifest."
PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
$(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
$(HOST_OUT_EXECUTABLES)/assemble_vintf \
+ $(PRIVATE_FLAGS) \
-c $(BUILT_SYSTEM_MATRIX) \
-i $(BUILT_VENDOR_MANIFEST) \
$$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 64e1069..3d1f186 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -162,6 +162,19 @@
$(error user tag detected on module.)
endif
+my_bad_module_tags := $(filter eng debug,$(my_module_tags))
+ifdef my_bad_module_tags
+ ifeq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+ $(call pretty-warning,LOCAL_MODULE_TAGS := $(my_bad_module_tags) does not do anything for uninstallable modules)
+ endif
+ ifeq ($(BUILD_BROKEN_ENG_DEBUG_TAGS),false)
+ $(call pretty-error,LOCAL_MODULE_TAGS := $(my_bad_module_tags) is obsolete. See $(CHANGES_URL)#LOCAL_MODULE_TAGS)
+ else
+ $(call pretty-warning,LOCAL_MODULE_TAGS := $(my_bad_module_tags) is deprecated. See $(CHANGES_URL)#LOCAL_MODULE_TAGS)
+ endif
+ my_bad_module_tags :=
+endif
+
# Only the tags mentioned in this test are expected to be set by module
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
@@ -389,7 +402,7 @@
# We name both BUILT and INSTALLED in case
# LOCAL_UNINSTALLABLE_MODULE is set.
.PHONY: $(my_all_targets)
-$(my_all_targets): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
+$(my_all_targets): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE) $(LOCAL_ADDITIONAL_CHECKED_MODULE)
.PHONY: $(my_register_name)
$(my_register_name): $(my_all_targets)
@@ -485,6 +498,8 @@
my_checked_module := $(LOCAL_BUILT_MODULE)
endif
+my_checked_module += $(LOCAL_ADDITIONAL_CHECKED_MODULE)
+
# If they request that this module not be checked, then don't.
# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
# GOOD REASON WILL HAVE IT REMOVED.
diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk
index 6140d7c..f18747a 100644
--- a/core/clang/TARGET_arm.mk
+++ b/core/clang/TARGET_arm.mk
@@ -7,3 +7,4 @@
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan
diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk
index 9fe5530..42bed0a 100644
--- a/core/clang/TARGET_arm64.mk
+++ b/core/clang/TARGET_arm64.mk
@@ -7,3 +7,4 @@
# Address sanitizer clang config
ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
+ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan64
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
index dfd99b2..3e54a66 100644
--- a/core/clang/TARGET_mips.mk
+++ b/core/clang/TARGET_mips.mk
@@ -6,3 +6,4 @@
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan
diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk
index a3684cc..cb6a3cd 100644
--- a/core/clang/TARGET_mips64.mk
+++ b/core/clang/TARGET_mips64.mk
@@ -6,3 +6,4 @@
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan64
diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk
index 5e2d57e..5491a05 100644
--- a/core/clang/TARGET_x86.mk
+++ b/core/clang/TARGET_x86.mk
@@ -7,3 +7,4 @@
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
+$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan
diff --git a/core/clang/TARGET_x86_64.mk b/core/clang/TARGET_x86_64.mk
index 86b3798..167db72 100644
--- a/core/clang/TARGET_x86_64.mk
+++ b/core/clang/TARGET_x86_64.mk
@@ -7,3 +7,4 @@
# Address sanitizer clang config
ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
+ADDRESS_SANITIZER_LINKER_FILE := /system/bin/bootstrap/linker_asan64
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 76ca030..0f1a937 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -10,6 +10,7 @@
LOCAL_AAPT_INCLUDE_ALL_RESOURCES:=
LOCAL_AAPT_NAMESPACES:=
LOCAL_ADDITIONAL_CERTIFICATES:=
+LOCAL_ADDITIONAL_CHECKED_MODULE:=
LOCAL_ADDITIONAL_DEPENDENCIES:=
LOCAL_ADDITIONAL_HTML_DIR:=
LOCAL_ADDITIONAL_JAVA_DIR:=
diff --git a/core/config.mk b/core/config.mk
index ab0ec6d..e8cb1e5 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -34,6 +34,7 @@
# Mark variables deprecated/obsolete
CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
+.KATI_READONLY := CHANGES_URL
$(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH)
$(KATI_obsolete_var PYTHONPATH,Do not use PYTHONPATH directly. See $(CHANGES_URL)#PYTHONPATH)
$(KATI_obsolete_var OUT,Use OUT_DIR instead. See $(CHANGES_URL)#OUT)
@@ -95,8 +96,6 @@
# This is marked as obsolete in envsetup.mk after reading the BoardConfig.mk
$(KATI_deprecate_export It is a global setting. See $(CHANGES_URL)#export_keyword)
-CHANGES_URL :=
-
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
FORCE:
@@ -219,6 +218,7 @@
BUILD_BROKEN_DUP_COPY_HEADERS :=
BUILD_BROKEN_DUP_RULES :=
BUILD_BROKEN_PHONY_TARGETS :=
+BUILD_BROKEN_ENG_DEBUG_TAGS :=
# ###############################################################
# Include sub-configuration files
@@ -730,6 +730,8 @@
JETIFIER := prebuilts/sdk/tools/jetifier/jetifier-standalone/bin/jetifier-standalone
+EXTRACT_KERNEL := build/make/tools/extract_kernel.py
+
COLUMN:= column
USE_OPENJDK9 := true
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 6c9caa8..bbf3b7d 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -341,7 +341,7 @@
ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
# Make sure linker_asan get installed.
- $(LOCAL_INSTALLED_MODULE) : | $(PRODUCT_OUT)$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
+ $(LOCAL_INSTALLED_MODULE) : | $(PRODUCT_OUT)$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER_FILE)
endif
endif
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index aaa9ddf..fc766a5 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2694,6 +2694,7 @@
# Generate a greylist.txt from a classes.jar
define hiddenapi-generate-csv
+ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true)
ifneq (,$(wildcard frameworks/base))
# Only generate this target if we're in a tree with frameworks/base present.
$(2): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_STUB_FLAGS)
@@ -2712,6 +2713,7 @@
PRIVATE_METADATA_INPUTS := $$(PRIVATE_METADATA_INPUTS) $(3)
endif
+endif # UNSAFE_DISABLE_HIDDENAPI_FLAGS
endef
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index f102662..21bac87 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -31,6 +31,7 @@
include $(BUILD_SYSTEM)/dex_preopt_libart.mk
# === hiddenapi rules ===
+ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true)
hiddenapi_stubs_jar = $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
@@ -88,6 +89,7 @@
# Additional inputs are filled with `hiddenapi-generate-csv`
$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): $(SOONG_HIDDENAPI_GREYLIST_METADATA)
$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): PRIVATE_METADATA_INPUTS := $(SOONG_HIDDENAPI_GREYLIST_METADATA)
+endif # UNSAFE_DISABLE_HIDDENAPI_FLAGS
ifeq ($(PRODUCT_DIST_BOOT_AND_SYSTEM_JARS),true)
boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 17448f1..1426935 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -271,7 +271,8 @@
BUILD_BROKEN_ANDROIDMK_EXPORTS \
BUILD_BROKEN_DUP_COPY_HEADERS \
BUILD_BROKEN_DUP_RULES \
- BUILD_BROKEN_PHONY_TARGETS
+ BUILD_BROKEN_PHONY_TARGETS \
+ BUILD_BROKEN_ENG_DEBUG_TAGS
$(foreach var,$(vars),$(eval $(var) := $$(strip $$($(var)))))
@@ -281,14 +282,10 @@
.KATI_READONLY := $(vars)
-CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
-
ifneq ($(BUILD_BROKEN_ANDROIDMK_EXPORTS),true)
$(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword)
endif
-CHANGES_URL :=
-
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
diff --git a/core/generate_enforce_rro.mk b/core/generate_enforce_rro.mk
index c88c779..1bec6c3 100644
--- a/core/generate_enforce_rro.mk
+++ b/core/generate_enforce_rro.mk
@@ -27,10 +27,14 @@
LOCAL_AAPT_FLAGS += --auto-add-overlay
LOCAL_RESOURCE_DIR := $(enforce_rro_source_overlays)
-ifeq (framework-res__auto_generated_rro,$(enforce_rro_module))
-LOCAL_PRIVATE_PLATFORM_APIS := true
+ifneq (,$(LOCAL_RES_LIBRARIES))
+ # Technically we are linking against the app (if only to grab its resources),
+ # and because it's potentially not building against the SDK, we can't either.
+ LOCAL_PRIVATE_PLATFORM_APIS := true
+else ifeq (framework-res__auto_generated_rro,$(enforce_rro_module))
+ LOCAL_PRIVATE_PLATFORM_APIS := true
else
-LOCAL_SDK_VERSION := current
+ LOCAL_SDK_VERSION := current
endif
include $(BUILD_RRO_PACKAGE)
diff --git a/core/local_systemsdk.mk b/core/local_systemsdk.mk
index 7acb57a..0f1271f 100644
--- a/core/local_systemsdk.mk
+++ b/core/local_systemsdk.mk
@@ -25,9 +25,8 @@
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION
ifeq ($(_is_vendor_app),true)
- ifeq (,$(filter framework-res__auto_generated_rro,$(LOCAL_MODULE)))
- # Runtime resource overlay for framework-res is exempted from building
- # against System SDK.
+ ifeq (,$(filter %__auto_generated_rro,$(LOCAL_MODULE)))
+ # Runtime resource overlays are exempted from building against System SDK.
# TODO(b/35859726): remove this exception
LOCAL_SDK_VERSION := system_current
endif
diff --git a/core/main.mk b/core/main.mk
index 712b2c5..67cd3ac 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1133,7 +1133,12 @@
static_whitelist_patterns += %__auto_generated_rro.apk
# Auto-included targets are not considered
static_whitelist_patterns += $(call module-installed-files,$(call auto-included-modules))
-
+ # $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
+ # The path can be considered as a fake path, as the shared libraries
+ # are installed there just to have symbols files for them under
+ # $(PRODUCT_OUT)/symbols/apex for debugging purpose. The /apex directory
+ # is never compiled into a filesystem image.
+ static_whitelist_patterns += $(PRODUCT_OUT)/apex/%
ifeq (true,$(BOARD_USES_SYSTEM_OTHER_ODEX))
# Allow system_other odex space optimization.
static_whitelist_patterns += \
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 9ddbd1b..06dc1b7 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -576,9 +576,11 @@
module_run_appcompat :=
ifeq (true,$(non_system_module))
ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) # ! unbundled app build
+ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true)
module_run_appcompat := true
endif
endif
+endif
ifeq ($(module_run_appcompat),true)
$(LOCAL_BUILT_MODULE) : $(appcompat-files)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 0b48a77..cd48025 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -74,9 +74,11 @@
module_run_appcompat :=
ifeq (true,$(non_system_module))
ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) # ! unbundled app build
+ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true)
module_run_appcompat := true
endif
endif
+endif
ifdef LOCAL_COMPRESSED_MODULE
ifneq (true,$(LOCAL_COMPRESSED_MODULE))
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 1fd6316..14d796c 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -19,14 +19,16 @@
LOCAL_MODULE_SUFFIX := .apk
LOCAL_BUILT_MODULE_STEM := package.apk
-#######################################
-include $(BUILD_SYSTEM)/base_rules.mk
-#######################################
+intermediates.COMMON := $(call local-intermediates-dir,COMMON)
full_classes_jar := $(intermediates.COMMON)/classes.jar
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
ifdef LOCAL_SOONG_CLASSES_JAR
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
@@ -46,9 +48,11 @@
module_run_appcompat :=
ifeq (true,$(non_system_module))
ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) # ! unbundled app build
+ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true)
module_run_appcompat := true
endif
endif
+endif
ifeq ($(module_run_appcompat),true)
$(LOCAL_BUILT_MODULE): $(appcompat-files)
@@ -160,7 +164,7 @@
$(my_register_name), \
false, \
$(LOCAL_FULL_MANIFEST_FILE), \
- $(LOCAL_EXPORT_PACKAGE_RESOURCES), \
+ $(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
$(LOCAL_SOONG_RRO_DIRS))
endif
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 66410e1..08d545d 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -13,9 +13,7 @@
LOCAL_MODULE_SUFFIX := .jar
LOCAL_BUILT_MODULE_STEM := javalib.jar
-#######################################
-include $(BUILD_SYSTEM)/base_rules.mk
-#######################################
+intermediates.COMMON := $(call local-intermediates-dir,COMMON)
full_classes_jar := $(intermediates.COMMON)/classes.jar
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
@@ -24,6 +22,14 @@
hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
+ifdef LOCAL_SOONG_AAR
+ LOCAL_ADDITIONAL_CHECKED_MODULE += $(LOCAL_SOONG_AAR)
+endif
+
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
ifdef LOCAL_SOONG_CLASSES_JAR
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
diff --git a/envsetup.sh b/envsetup.sh
index c4c4972..4947bf0 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -28,6 +28,7 @@
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
+- pathmod: Get the directory containing a module.
- refreshmod: Refresh list of modules for allmod/gomod.
Environment options:
@@ -1517,16 +1518,16 @@
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
+# Get the path of 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() {
+function pathmod() {
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
+ echo "usage: pathmod <module>" >&2
return 1
fi
@@ -1546,10 +1547,25 @@
echo "Could not find module '$1' (try 'refreshmod' if there have been build changes?)." >&2
return 1
else
- cd $ANDROID_BUILD_TOP/$relpath
+ echo "$ANDROID_BUILD_TOP/$relpath"
fi
}
+# 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 [[ $# -ne 1 ]]; then
+ echo "usage: gomod <module>" >&2
+ return 1
+ fi
+
+ local path="$(pathmod $@)"
+ if [ -z "$path" ]; then
+ return 1
+ fi
+ cd $path
+}
+
function _complete_android_module_names() {
local word=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(allmod | grep -E "^$word") )
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index 3ceeda1..c52a379 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -206,7 +206,6 @@
VNDK-core: libnetutils.so
VNDK-core: libnl.so
VNDK-core: libopus.so
-VNDK-core: libpagemap.so
VNDK-core: libpcre2.so
VNDK-core: libpiex.so
VNDK-core: libpng.so
diff --git a/target/product/profile_boot_common.mk b/target/product/profile_boot_common.mk
index f243902..4147dfa 100644
--- a/target/product/profile_boot_common.mk
+++ b/target/product/profile_boot_common.mk
@@ -41,5 +41,8 @@
# Use speed compiler filter since system server doesn't have JIT.
PRODUCT_DEX_PREOPT_BOOT_FLAGS += --compiler-filter=speed
+# System server is speed compiled and doesn't have a separate preopt flag,
+# so we enable hotness in compiled code for everything.
+PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --count-hotness-in-compiled-code
PRODUCT_DIST_BOOT_AND_SYSTEM_JARS := true
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 9057e32..4aad5f7 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -87,6 +87,10 @@
pm.dexopt.inactive=verify \
pm.dexopt.shared=speed
+# Enable resolution of startup const strings.
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ dalvik.vm.dex2oat-resolve-startup-strings=true
+
# Enable minidebuginfo generation unless overridden.
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
dalvik.vm.minidebuginfo=true \
diff --git a/tools/extract_kernel.py b/tools/extract_kernel.py
new file mode 100755
index 0000000..16ccb22
--- /dev/null
+++ b/tools/extract_kernel.py
@@ -0,0 +1,196 @@
+#!/usr/bin/env python
+#
+# 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.
+
+"""
+A tool to extract kernel information from a kernel image.
+"""
+
+import argparse
+import subprocess
+import sys
+import re
+
+CONFIG_PREFIX = b'IKCFG_ST'
+GZIP_HEADER = b'\037\213\010'
+COMPRESSION_ALGO = (
+ (["gzip", "-d"], GZIP_HEADER),
+ (["xz", "-d"], b'\3757zXZ\000'),
+ (["bzip2", "-d"], b'BZh'),
+ (["lz4", "-d", "-l"], b'\002\041\114\030'),
+
+ # These are not supported in the build system yet.
+ # (["unlzma"], b'\135\0\0\0'),
+ # (["lzop", "-d"], b'\211\114\132'),
+)
+
+# "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
+# LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+LINUX_BANNER_PREFIX = b'Linux version '
+LINUX_BANNER_REGEX = LINUX_BANNER_PREFIX + \
+ r'([0-9]+[.][0-9]+[.][0-9]+).* \(.*@.*\) \(.*\) .*\n'
+
+
+def get_version(input_bytes, start_idx):
+ null_idx = input_bytes.find('\x00', start_idx)
+ if null_idx < 0:
+ return None
+ linux_banner = input_bytes[start_idx:null_idx].decode()
+ mo = re.match(LINUX_BANNER_REGEX, linux_banner)
+ if mo:
+ return mo.group(1)
+ return None
+
+
+def dump_version(input_bytes):
+ idx = 0
+ while True:
+ idx = input_bytes.find(LINUX_BANNER_PREFIX, idx)
+ if idx < 0:
+ return None
+
+ version = get_version(input_bytes, idx)
+ if version:
+ return version
+
+ idx += len(LINUX_BANNER_PREFIX)
+
+
+def dump_configs(input_bytes):
+ """
+ Dump kernel configuration from input_bytes. This can be done when
+ CONFIG_IKCONFIG is enabled, which is a requirement on Treble devices.
+
+ The kernel configuration is archived in GZip format right after the magic
+ string 'IKCFG_ST' in the built kernel.
+ """
+
+ # Search for magic string + GZip header
+ idx = input_bytes.find(CONFIG_PREFIX + GZIP_HEADER)
+ if idx < 0:
+ return None
+
+ # Seek to the start of the archive
+ idx += len(CONFIG_PREFIX)
+
+ sp = subprocess.Popen(["gzip", "-d", "-c"], stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ o, _ = sp.communicate(input=input_bytes[idx:])
+ if sp.returncode == 1: # error
+ return None
+
+ # success or trailing garbage warning
+ assert sp.returncode in (0, 2), sp.returncode
+
+ return o
+
+
+def try_decompress(cmd, search_bytes, input_bytes):
+ idx = input_bytes.find(search_bytes)
+ if idx < 0:
+ return None
+
+ idx = 0
+ sp = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ o, _ = sp.communicate(input=input_bytes[idx:])
+ # ignore errors
+ return o
+
+
+def decompress_dump(func, input_bytes):
+ """
+ Run func(input_bytes) first; and if that fails (returns value evaluates to
+ False), then try different decompression algorithm before running func.
+ """
+ o = func(input_bytes)
+ if o:
+ return o
+ for cmd, search_bytes in COMPRESSION_ALGO:
+ decompressed = try_decompress(cmd, search_bytes, input_bytes)
+ if decompressed:
+ o = func(decompressed)
+ if o:
+ return o
+ # Force decompress the whole file even if header doesn't match
+ decompressed = try_decompress(cmd, b"", input_bytes)
+ if decompressed:
+ o = func(decompressed)
+ if o:
+ return o
+
+def main():
+ parser = argparse.ArgumentParser(
+ formatter_class=argparse.RawTextHelpFormatter,
+ description=__doc__ +
+ "\nThese algorithms are tried when decompressing the image:\n " +
+ " ".join(tup[0][0] for tup in COMPRESSION_ALGO))
+ parser.add_argument('--input',
+ help='Input kernel image. If not specified, use stdin',
+ metavar='FILE',
+ type=argparse.FileType('rb'),
+ default=sys.stdin)
+ parser.add_argument('--output-configs',
+ help='If specified, write configs. Use stdout if no file '
+ 'is specified.',
+ metavar='FILE',
+ nargs='?',
+ type=argparse.FileType('wb'),
+ const=sys.stdout)
+ parser.add_argument('--output-version',
+ help='If specified, write version. Use stdout if no file '
+ 'is specified.',
+ metavar='FILE',
+ nargs='?',
+ type=argparse.FileType('wb'),
+ const=sys.stdout)
+ parser.add_argument('--tools',
+ help='Decompression tools to use. If not specified, PATH '
+ 'is searched.',
+ metavar='ALGORITHM:EXECUTABLE',
+ nargs='*')
+ args = parser.parse_args()
+
+ tools = {pair[0]: pair[1]
+ for pair in (token.split(':') for token in args.tools or [])}
+ for cmd, _ in COMPRESSION_ALGO:
+ if cmd[0] in tools:
+ cmd[0] = tools[cmd[0]]
+
+ input_bytes = args.input.read()
+
+ ret = 0
+ if args.output_configs is not None:
+ o = decompress_dump(dump_configs, input_bytes)
+ if o:
+ args.output_configs.write(o)
+ else:
+ sys.stderr.write(
+ "Cannot extract kernel configs in {}".format(args.input.name))
+ ret = 1
+ if args.output_version is not None:
+ o = decompress_dump(dump_version, input_bytes)
+ if o:
+ args.output_version.write(o)
+ else:
+ sys.stderr.write(
+ "Cannot extract kernel versions in {}".format(args.input.name))
+ ret = 1
+
+ return ret
+
+
+if __name__ == '__main__':
+ exit(main())
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index ba1d60e..d2f4e25 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -576,7 +576,7 @@
copy_prop("avb_system_other_algorithm", "avb_algorithm")
copy_prop("fs_type", "fs_type")
copy_prop("system_fs_type", "fs_type")
- copy_prop("system_size", "partition_size")
+ copy_prop("system_other_size", "partition_size")
if not copy_prop("system_journal_size", "journal_size"):
d["journal_size"] = "0"
copy_prop("system_verity_block_device", "verity_block_device")
@@ -723,7 +723,7 @@
if mount_point == "system":
copy_prop("partition_size", "system_size")
elif mount_point == "system_other":
- copy_prop("partition_size", "system_size")
+ copy_prop("partition_size", "system_other_size")
elif mount_point == "vendor":
copy_prop("partition_size", "vendor_size")
elif mount_point == "odm":
diff --git a/tools/test_extract_kernel.py b/tools/test_extract_kernel.py
new file mode 100644
index 0000000..1a1cfcb
--- /dev/null
+++ b/tools/test_extract_kernel.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+#
+# 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.
+
+import unittest
+from extract_kernel import get_version, dump_version
+
+class ExtractKernelTest(unittest.TestCase):
+ def test_extract_version(self):
+ self.assertEqual("4.9.100", get_version(
+ b'Linux version 4.9.100-a123 (a@a) (a) a\n\x00', 0))
+ self.assertEqual("4.9.123", get_version(
+ b'Linux version 4.9.123 (@) () \n\x00', 0))
+
+ def test_dump_self(self):
+ self.assertEqual("4.9.1", dump_version(
+ b"trash\x00Linux version 4.8.8\x00trash\x00"
+ "other trash Linux version 4.9.1-g3 (2@s) (2) a\n\x00"))