Merge "Revert "Revert "Build System: Validate AndroidTest.xml Configs"""
diff --git a/Changes.md b/Changes.md
index 37bbad0..7440220 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,164 @@
# Build System Changes for Android.mk Writers
+### `export` and `unexport` deprecation {#export_keyword}
+
+The `export` and `unexport` keywords have been deprecated, and will throw
+warnings or errors depending on where they are used.
+
+Early in the make system, during product configuration and BoardConfig.mk
+reading: these will throw a warnings, and will be an error in the future.
+Device specific configuration should not be able to affect common core build
+steps -- we're looking at triggering build steps to be invalidated if the set
+of environment variables they can access changes. If device specific
+configuration is allowed to change those, switching devices with the same
+output directory could become significantly more expensive than it already can
+be.
+
+Later, during Android.mk files, and later tasks: these will throw errors, since
+it is increasingly likely that they are being used incorrectly, attempting to
+change the environment for a single build step, and instead setting it for
+hundreds of thousands.
+
+It is not recommended to just move the environment variable setting outside of
+the build (in vendorsetup.sh, or some other configuration script or wrapper).
+We expect to limit the environment variables that the build respects in the
+future, others will be cleared. (There will be methods to get custom variables
+into the build, just not to every build step)
+
+Instead, write the export commands into the rule command lines themselves:
+
+``` make
+$(intermediates)/generated_output.img:
+ rm -rf $@
+ export MY_ENV_A="$(MY_A)"; make ...
+```
+
+If you want to set many environment variables, and/or use them many times,
+write them out to a script and source the script:
+
+``` make
+envsh := $(intermediates)/env.sh
+$(envsh):
+ rm -rf $@
+ echo 'export MY_ENV_A="$(MY_A)"' >$@
+ echo 'export MY_ENV_B="$(MY_B)"' >>$@
+
+$(intermediates)/generated_output.img: PRIVATE_ENV := $(envsh)
+$(intermediates)/generated_output.img: $(envsh) a/b/c/package.sh
+ rm -rf $@
+ source $(PRIVATE_ENV); make ...
+ source $(PRIVATE_ENV); a/b/c/package.sh ...
+```
+
+## Implicit make rules are obsolete {#implicit_rules}
+
+Implicit rules look something like the following:
+
+``` make
+$(TARGET_OUT_SHARED_LIBRARIES)/%_vendor.so: $(TARGET_OUT_SHARED_LIBRARIES)/%.so
+ ...
+
+%.o : %.foo
+ ...
+```
+
+These can have wide ranging effects across unrelated modules, so they're now obsolete. Instead, use static pattern rules, which are similar, but explicitly match the specified outputs:
+
+``` make
+libs := $(foreach lib,libfoo libbar,$(TARGET_OUT_SHARED_LIBRARIES)/$(lib)_vendor.so)
+$(libs): %_vendor.so: %.so
+ ...
+
+files := $(wildcard $(LOCAL_PATH)/*.foo)
+gen := $(patsubst $(LOCAL_PATH)/%.foo,$(intermediates)/%.o,$(files))
+$(gen): %.o : %.foo
+ ...
+```
+
+## Removing '/' from Valid Module Names {#name_slash}
+
+The build system uses module names in path names in many places. Having an
+extra '/' or '../' being inserted can cause problems -- and not just build
+breaks, but stranger invalid behavior.
+
+In every case we've seen, the fix is relatively simple: move the directory into
+`LOCAL_MODULE_RELATIVE_PATH` (or `LOCAL_MODULE_PATH` if you're still using it).
+If this causes multiple modules to be named the same, use unique module names
+and `LOCAL_MODULE_STEM` to change the installed file name:
+
+``` make
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver1/code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/firmware
+...
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver2/code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/firmware
+...
+include $(BUILD_PREBUILT)
+```
+
+Can be rewritten as:
+
+```
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver1_code.bin
+LOCAL_MODULE_STEM := code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/firmware/ver1
+...
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ver2_code.bin
+LOCAL_MODULE_STEM := code.bin
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/firmware/ver2
+...
+include $(BUILD_PREBUILT)
+```
+
+You just need to make sure that any other references (`PRODUCT_PACKAGES`,
+`LOCAL_REQUIRED_MODULES`, etc) are converted to the new names.
+
+## Valid Module Names {#name}
+
+We've adopted lexical requirements very similar to [Bazel's
+requirements](https://docs.bazel.build/versions/master/build-ref.html#name) for
+target names. Valid characters are `a-z`, `A-Z`, `0-9`, and the special
+characters `_.+-=,@~`. This currently applies to `LOCAL_PACKAGE_NAME`,
+`LOCAL_MODULE`, and `LOCAL_MODULE_SUFFIX`, and `LOCAL_MODULE_STEM*`.
+
+Many other characters already caused problems if you used them, so we don't
+expect this to have a large effect.
+
+## PATH Tools {#PATH_Tools}
+
+The build has started restricting the external host tools usable inside the
+build. This will help ensure that build results are reproducible across
+different machines, and catch mistakes before they become larger issues.
+
+To start with, this includes replacing the $PATH with our own directory of
+tools, mirroring that of the host PATH. The only difference so far is the
+removal of the host GCC tools. Anything that is not explicitly in the
+configuration as allowed will continue functioning, but will generate a log
+message. This is expected to become more restrictive over time.
+
+The configuration is located in build/soong/ui/build/paths/config.go, and
+contains all the common tools in use in many builds. Anything not in that list
+will currently print a warning in the `$OUT_DIR/soong.log` file, including the
+command and arguments used, and the process tree in order to help locate the
+usage.
+
+In order to fix any issues brought up by these checks, the best way to fix them
+is to use tools checked into the tree -- either as prebuilts, or building them
+as host tools during the build.
+
+As a temporary measure, you can set `TEMPORARY_DISABLE_PATH_RESTRICTIONS=true`
+in your environment to temporarily turn off the error checks and allow any tool
+to be used (with logging). Beware that GCC didn't work well with the interposer
+used for logging, so this may not help in all cases.
+
## Deprecating / obsoleting envsetup.sh variables in Makefiles
It is not required to source envsetup.sh before running a build. Many scripts,
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 043aa60..cea1464 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -476,6 +476,12 @@
$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/APPS/*_intermediates/java-source-list)
$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/JAVA_LIBRARIES/*_intermediates/java-source-list)
+# Remove stale init.noenforce.rc
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/gsi/init.noenforce.rc)
+
+# Remove old merged AndroidManifest.xml location
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/*_intermediates/AndroidManifest.xml)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 002e955..3eb4211 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -36,7 +36,9 @@
$(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
$(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
$(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
- $(eval $(call copy-one-file,$(_src),$(_fulldest))))) \
+ $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
+ $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
+ $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
$(eval unique_product_copy_files_destinations += $(_dest))))
@@ -125,8 +127,12 @@
else
FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
endif
+ ifdef BOARD_VNDK_RUNTIME_DISABLE
+ FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
+ endif
else
- FINAL_VENDOR_DEFAULT_PROPERTIES :=
+ FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
+ FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
endif
FINAL_VENDOR_DEFAULT_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
@@ -1080,53 +1086,79 @@
INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
endif
+ifeq (true,$(USE_LOGICAL_PARTITIONS))
+
+ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
+ $(error vboot 1.0 doesn't support logical partition)
+endif
+
+# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
+# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
+
+endif # USE_LOGICAL_PARTITIONS
+
# $(1): the path of the output dictionary file
-# $(2): additional "key=value" pairs to append to the dictionary file.
-define generate-userimage-prop-dictionary
+# $(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 $(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))
-$(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))
-$(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(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))
+ $(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))
+ $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
+ $(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 $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM)" >> $(1))
-$(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 $(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 $(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))
-$(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
-$(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
-$(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
-$(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))
+$(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))
+)
+$(if $(filter $(2),vendor),\
+ $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+)
+$(if $(filter $(2),product),\
+ $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
+)
+$(if $(filter $(2),oem),\
+ $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(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))
+)
$(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))
$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
@@ -1169,9 +1201,22 @@
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
$(hide) echo "recovery_as_boot=true" >> $(1))
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
- $(hide) echo "system_root_image=true" >> $(1);\
- echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
-$(if $(2),$(hide) $(foreach kv,$(2),echo "$(kv)" >> $(1);))
+ $(hide) echo "system_root_image=true" >> $(1)
+ $(hide) echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
+$(if $(USE_LOGICAL_PARTITIONS),$(hide) echo "use_logical_partitions=true" >> $(1))
+$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
+endef
+
+# $(1): the path of the output dictionary file
+# $(2): additional "key=value" pairs to append to the dictionary file.
+define generate-userimage-prop-dictionary
+$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product oem,$(2))
+endef
+
+# $(1): the path of the input dictionary file, where each line has the format key=value
+# $(2): the key to look up
+define read-image-prop-dictionary
+$$(grep '$(2)=' $(1) | cut -f2- -d'=')
endef
# $(1): modules list
@@ -1346,8 +1391,6 @@
# Copying baseline ramdisk...
# Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
$(hide) rsync -a --exclude=etc --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
- # Copy adbd from system/bin to recovery/root/sbin
- $(hide) cp -f $(TARGET_OUT_EXECUTABLES)/adbd $(TARGET_RECOVERY_ROOT_OUT)/sbin/adbd
# Modifying ramdisk contents...
$(if $(BOARD_RECOVERY_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
@@ -1375,10 +1418,6 @@
>> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
$(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
$(BOARD_RECOVERY_IMAGE_PREPARE)
- $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \
- $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \
- rm -rf $(TARGET_RECOVERY_ROOT_OUT)/system; \
- ln -sf /system_root/system $(TARGET_RECOVERY_ROOT_OUT)/system) # Mount the system_root_image to /system_root and symlink /system.
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
$(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
@@ -1400,8 +1439,6 @@
$(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
endef
-ADBD := $(TARGET_OUT_EXECUTABLES)/adbd
-
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
@@ -1412,7 +1449,7 @@
ifeq (true,$(BOARD_AVB_ENABLE))
$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
endif
-$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) $(ADBD) \
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(INSTALLED_RAMDISK_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
$(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
@@ -1427,7 +1464,7 @@
$(call build-recoveryimage-target, $@)
endif
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) $(ADBD) \
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
@@ -1519,6 +1556,8 @@
# so that we can get the size stat even if the build fails due to too large
# system image.
INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
+INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
+$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -1571,20 +1610,13 @@
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
@mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
- $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt, \
+ $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
build/make/tools/releasetools/build_image.py \
$(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
- || ( echo "Out of space? the tree size of $(TARGET_OUT) is (MB): " 1>&2 ;\
- du -sm $(TARGET_OUT) 1>&2;\
- if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \
- maxsize=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE); \
- echo "The max is $$(( maxsize / 1048576 )) MB." 1>&2 ;\
- else \
- echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
- fi; \
- mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
+ $(systemimage_intermediates)/generated_system_image_info.txt \
+ || ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
exit 1 )
endef
@@ -1626,7 +1658,9 @@
$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
@echo "Install system fs image: $@"
$(copy-file-to-target)
- $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
+ $(call read-image-prop-dictionary,\
+ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
systemimage: $(INSTALLED_SYSTEMIMAGE)
@@ -1635,7 +1669,9 @@
| $(INTERNAL_USERIMAGES_DEPS)
@echo "make $@: ignoring dependencies"
$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
- $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),\
+ $(call read-image-prop-dictionary,\
+ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
ifeq (true,$(WITH_DEXPREOPT))
@@ -1808,7 +1844,7 @@
$(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_DATA)
@mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
- $(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt, skip_fsck=true)
+ $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
@@ -1915,7 +1951,7 @@
$(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_CACHE)
@mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
- $(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt, skip_fsck=true)
+ $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
@@ -1956,6 +1992,8 @@
$(PDK_FUSION_SYMLINK_STAMP)
INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
+INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
+$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -1972,11 +2010,14 @@
$(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
@mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
- $(call generate-userimage-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt, skip_fsck=true)
+ $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
+ $(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))
endef
# We just build this directly to the install location.
@@ -2033,6 +2074,8 @@
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
+INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
+$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -2047,13 +2090,16 @@
$(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_VENDOR)
@mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
- $(call generate-userimage-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt, skip_fsck=true)
+ $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
$(if $(BOARD_VENDOR_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor/,$(call intermediates-dir-for,PACKAGING,depmod_vendor)))
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
+ $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
+ $(vendorimage_intermediates)/generated_vendor_image_info.txt
+ $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
+ $(call read-image-prop-dictionary,\
+ $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
endef
# We just build this directly to the install location.
@@ -2088,6 +2134,8 @@
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
+INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
+$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@@ -2102,7 +2150,7 @@
$(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_PRODUCT)
@mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
- $(call generate-userimage-prop-dictionary, $(productimage_intermediates)/product_image_info.txt, skip_fsck=true)
+ $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
$(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
@@ -2264,12 +2312,12 @@
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
endif
-ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
- $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
+ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
+BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
endif
-ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
- $(error BOARD_SYSTEMIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
+ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
+ $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
endif
# $(1): the directory to extract public keys to
@@ -2452,9 +2500,8 @@
OTATOOLS_DEPS := \
system/extras/ext4_utils/mke2fs.conf \
- external/avb/test/data/atx_metadata.bin \
- external/avb/test/data/testkey_atx_psk.pem \
- external/avb/test/data/testkey_rsa4096.pem \
+ $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
+ -name "atx_metadata.bin")) \
$(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print)) \
$(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
-name verity_key)) \
@@ -2896,7 +2943,7 @@
# -----------------------------------------------------------------
# NDK Sysroot Package
NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
-$(NDK_SYSROOT_TARGET): ndk
+$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
@echo Package NDK sysroot...
$(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
@@ -3239,7 +3286,7 @@
if [ $$FAIL ]; then exit 1; fi
$(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
$(hide) ( \
- ATREE_STRIP="strip -x" \
+ ATREE_STRIP="$(HOST_STRIP) -x" \
$(HOST_OUT_EXECUTABLES)/atree \
$(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
-m $(PRIVATE_DEP_FILE) \
diff --git a/core/aapt2.mk b/core/aapt2.mk
index 4385b4d..fbbf3dd 100644
--- a/core/aapt2.mk
+++ b/core/aapt2.mk
@@ -52,7 +52,7 @@
ifneq ($(my_generated_res_zips),)
my_zipped_resources_flata := $(my_compiled_res_base_dir)/zip_res.flata
$(my_zipped_resources_flata): PRIVATE_SOURCE_RES_ZIPS := $(my_generated_res_zips)
-$(my_zipped_resources_flata) : $(my_generated_res_deps) $(AAPT2) $(ZIPSYNC)
+$(my_zipped_resources_flata) : $(my_generated_res_zips) $(AAPT2) $(ZIPSYNC)
@echo "AAPT2 compile $@ <- $(PRIVATE_SOURCE_RES_ZIPS)"
$(call aapt2-compile-resource-zips)
@@ -64,9 +64,11 @@
$(my_res_resources_flat) $(my_overlay_resources_flat) $(my_resources_flata): \
PRIVATE_AAPT2_CFLAGS := --pseudo-localize
-my_static_library_resources := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\
+# TODO(b/78447299): Forbid LOCAL_STATIC_JAVA_AAR_LIBRARIES in aapt2 and remove
+# support for it.
+my_static_library_resources := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk)
-my_static_library_extra_packages := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\
+my_static_library_extra_packages := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/extra_packages)
my_shared_library_resources := $(foreach l, $(LOCAL_SHARED_ANDROID_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk)
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index 7d573d3..3af81ff 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -6,40 +6,60 @@
LOCAL_MANIFEST_FILE := AndroidManifest.xml
endif
ifdef LOCAL_FULL_MANIFEST_FILE
- full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
+ main_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
else
- full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
+ main_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
endif
-my_full_libs_manifest_files := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
-my_full_libs_manifest_deps := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
-
-# Set up dependency on aar libraries
LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
-ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
-my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar)
-my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)
+
+my_full_libs_manifest_files :=
+
+ifndef LOCAL_DONT_MERGE_MANIFESTS
+ my_full_libs_manifest_files += $(LOCAL_FULL_LIBS_MANIFEST_FILES)
+
+ my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES) $(LOCAL_STATIC_ANDROID_LIBRARIES),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/manifest/AndroidManifest.xml)
+endif
# With aapt2, we'll link in the built resource from the AAR.
-ifndef LOCAL_USE_AAPT2
-LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
-endif # LOCAL_USE_AAPT2
-endif # LOCAL_STATIC_JAVA_AAR_LIBRARIES
+ifneq ($(LOCAL_USE_AAPT2),true)
+ LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
+endif
+
+full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
+
+ifdef LOCAL_MIN_SDK_VERSION
+ $(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(LOCAL_MIN_SDK_VERSION)
+else ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ $(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+else
+ $(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(DEFAULT_APP_TARGET_SDK)
+endif
# Set up rules to merge library manifest files
-ifdef my_full_libs_manifest_files
-main_android_manifest := $(full_android_manifest)
-full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
+my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
+$(full_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)
+$(full_android_manifest): $(my_exported_sdk_libs_file)
+$(full_android_manifest): $(MANIFEST_FIXER)
+
+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) : $(main_android_manifest) $(my_full_libs_manifest_deps)
+$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
- $(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
+ $(call fix-manifest,$<,$@.tmp,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
+ $(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
--libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
--out $@
+ rm $@.tmp
+
+else
+$(full_android_manifest): $(main_android_manifest)
+ @echo "Fix manifest: $@"
+ $(call fix-manifest,$<,$@,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
endif
diff --git a/core/autogen_test_config.mk b/core/autogen_test_config.mk
index d2eb7c3..5feec2b 100644
--- a/core/autogen_test_config.mk
+++ b/core/autogen_test_config.mk
@@ -17,8 +17,7 @@
# This build rule allows TradeFed test config file to be created based on
# following inputs:
# is_native: If the test is a native test.
-# LOCAL_MANIFEST_FILE: Name of the AndroidManifest file for the test. If it's
-# not set, default value `AndroidManifest.xml` will be used.
+# full_android_manifest: Name of the AndroidManifest file for the test.
# Output:
# autogen_test_config_file: Path to the test config file generated.
@@ -32,29 +31,21 @@
# Auto generating test config file for native test
$(autogen_test_config_file) : $(autogen_test_config_template)
@echo "Auto generating test config $(notdir $@)"
- $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $^ > $@
+ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $< > $@
my_auto_generate_config := true
else
# Auto generating test config file for instrumentation test
-ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
- LOCAL_MANIFEST_FILE := AndroidManifest.xml
-endif
-ifdef LOCAL_FULL_MANIFEST_FILE
- my_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
-else
- my_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
-endif
-ifneq (,$(wildcard $(my_android_manifest)))
+ifneq (,$(full_android_manifest))
$(autogen_test_config_file): PRIVATE_AUTOGEN_TEST_CONFIG_SCRIPT := $(AUTOGEN_TEST_CONFIG_SCRIPT)
-$(autogen_test_config_file): PRIVATE_TEST_CONFIG_ANDROID_MANIFEST := $(my_android_manifest)
+$(autogen_test_config_file): PRIVATE_TEST_CONFIG_ANDROID_MANIFEST := $(full_android_manifest)
$(autogen_test_config_file): PRIVATE_EMPTY_TEST_CONFIG := $(EMPTY_TEST_CONFIG)
$(autogen_test_config_file): PRIVATE_TEMPLATE := $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE)
-$(autogen_test_config_file) : $(my_android_manifest) $(EMPTY_TEST_CONFIG) $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE) $(AUTOGEN_TEST_CONFIG_SCRIPT)
+$(autogen_test_config_file) : $(full_android_manifest) $(EMPTY_TEST_CONFIG) $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE) $(AUTOGEN_TEST_CONFIG_SCRIPT)
@echo "Auto generating test config $(notdir $@)"
@rm -f $@
$(hide) $(PRIVATE_AUTOGEN_TEST_CONFIG_SCRIPT) $@ $(PRIVATE_TEST_CONFIG_ANDROID_MANIFEST) $(PRIVATE_EMPTY_TEST_CONFIG) $(PRIVATE_TEMPLATE)
my_auto_generate_config := true
-endif # ifeq (,$(wildcard $(my_android_manifest)))
+endif # ifneq (,$(full_android_manifest))
endif # ifneq (true,$(is_native))
ifeq (true,$(my_auto_generate_config))
@@ -65,5 +56,4 @@
autogen_test_config_file :=
endif
-my_android_manifest :=
my_auto_generate_config :=
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 075465e..f59df3f 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -31,6 +31,7 @@
ifeq ($(LOCAL_MODULE),)
$(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
endif
+$(call verify-module-name)
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
@@ -423,7 +424,7 @@
# Make sure we only set up the copy rules once, even if another arch variant
# shares a common LOCAL_INIT_RC.
my_init_rc_new_pairs := $(filter-out $(ALL_INIT_RC_INSTALLED_PAIRS),$(my_init_rc_pairs))
-my_init_rc_new_installed := $(call copy-many-files,$(my_init_rc_new_pairs))
+my_init_rc_new_installed := $(call copy-many-init-script-files-checked,$(my_init_rc_new_pairs))
ALL_INIT_RC_INSTALLED_PAIRS += $(my_init_rc_new_pairs)
$(my_all_targets) : $(my_init_rc_installed)
@@ -795,8 +796,10 @@
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
endif
$(LOCAL_MODULE)-$(h_or_hc_or_t) : $(my_all_targets)
+.PHONY: $(LOCAL_MODULE)-$(h_or_hc_or_t)
ifeq ($(j_or_n),native)
$(LOCAL_MODULE)-$(h_or_hc_or_t)$(my_32_64_bit_suffix) : $(my_all_targets)
+.PHONY: $(LOCAL_MODULE)-$(h_or_hc_or_t)$(my_32_64_bit_suffix)
endif
endif
diff --git a/core/binary.mk b/core/binary.mk
index 39f1161..60f78dd 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -405,6 +405,13 @@
my_cpp_std_cppflags := -std=$(my_cpp_std_version)
endif
+# Extra cflags for projects under external/ directory
+ifeq ($(my_clang),true)
+ifneq ($(filter external/%,$(LOCAL_PATH)),)
+ my_cflags += $(CLANG_EXTERNAL_CFLAGS)
+endif
+endif
+
# arch-specific static libraries go first so that generic ones can depend on them
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
@@ -519,6 +526,10 @@
my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
ifeq ($(my_use_clang_lld),true)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
+ include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
+ ifeq ($(my_pack_module_relocations),false)
+ my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
+ endif
else
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
endif # my_use_clang_lld
@@ -804,7 +815,7 @@
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
-$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
+$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(patsubst current,0,$(renderscript_target_api))
$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
$(transform-renderscripts-to-cpp-and-bc)
@@ -1591,10 +1602,15 @@
# libraries have already been linked into the module at that point.
# We do, however, care about the NOTICE files for any static
# libraries that we use. (see notice_files.mk)
-
+#
+# Don't do this in mm, since many of the targets won't exist.
+ifeq ($(ONE_SHOT_MAKEFILE),)
installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
+else
+installed_static_library_notice_file_targets :=
+endif
# Default is -fno-rtti.
ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
@@ -1724,10 +1740,19 @@
my_tidy_flags += -quiet -extra-arg-before=-fno-caret-diagnostics
endif
- # We might be using the static analyzer through clang-tidy.
- # https://bugs.llvm.org/show_bug.cgi?id=32914
ifneq ($(my_tidy_checks),)
+ # We might be using the static analyzer through clang-tidy.
+ # https://bugs.llvm.org/show_bug.cgi?id=32914
my_tidy_flags += -extra-arg-before=-D__clang_analyzer__
+
+ # A recent change in clang-tidy (r328258) enabled destructor inlining,
+ # which appears to cause a number of false positives. Until that's
+ # resolved, this turns off the effects of r328258.
+ # https://bugs.llvm.org/show_bug.cgi?id=37459
+ my_tidy_flags += -extra-arg-before=-Xclang
+ my_tidy_flags += -extra-arg-before=-analyzer-config
+ my_tidy_flags += -extra-arg-before=-Xclang
+ my_tidy_flags += -extra-arg-before=c++-temp-dtor-inlining=false
endif
endif
endif
diff --git a/core/ccache.mk b/core/ccache.mk
index 893c985..d10aceb 100644
--- a/core/ccache.mk
+++ b/core/ccache.mk
@@ -32,24 +32,24 @@
ifneq ($(filter-out false,$(USE_CCACHE)),)
# The default check uses size and modification time, causing false misses
# since the mtime depends when the repo was checked out
- export CCACHE_COMPILERCHECK ?= content
+ CCACHE_COMPILERCHECK ?= content
# See man page, optimizations to get more cache hits
# implies that __DATE__ and __TIME__ are not critical for functionality.
# Ignore include file modification time since it will depend on when
# the repo was checked out
- export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
+ CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
# Turn all preprocessor absolute paths into relative paths.
# Fixes absolute paths in preprocessed source due to use of -g.
# We don't really use system headers much so the rootdir is
# fine; ensures these paths are relative for all Android trees
# on a workstation.
- export CCACHE_BASEDIR := /
+ CCACHE_BASEDIR := /
# Workaround for ccache with clang.
# See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
- export CCACHE_CPP2 := true
+ CCACHE_CPP2 := true
ifndef CC_WRAPPER
CC_WRAPPER := $(CCACHE_EXEC)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 3325752..5051ef7 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -57,9 +57,11 @@
LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG:=
+LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES:=
LOCAL_DONT_CHECK_MODULE:=
# Don't delete the META_INF dir when merging static Java libraries.
LOCAL_DONT_DELETE_JAR_META_INF:=
+LOCAL_DONT_MERGE_MANIFESTS:=
LOCAL_DPI_FILE_STEM:=
LOCAL_DPI_VARIANTS:=
LOCAL_DROIDDOC_ASSET_DIR:=
@@ -74,6 +76,7 @@
LOCAL_DX_FLAGS:=
LOCAL_EMMA_COVERAGE_FILTER:=
LOCAL_EMMA_INSTRUMENT:=
+LOCAL_ENFORCE_USES_LIBRARIES:=
LOCAL_ERROR_PRONE_FLAGS:=
LOCAL_EXPORT_CFLAGS:=
LOCAL_EXPORT_C_INCLUDE_DEPS:=
@@ -81,6 +84,7 @@
LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=
LOCAL_EXPORT_PACKAGE_RESOURCES:=
LOCAL_EXPORT_PROGUARD_FLAG_FILES:=
+LOCAL_EXPORT_SDK_LIBRARIES:=
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:=
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:=
LOCAL_EXTRACT_APK:=
@@ -179,6 +183,7 @@
LOCAL_NOTICE_FILE:=
LOCAL_ODM_MODULE:=
LOCAL_OEM_MODULE:=
+LOCAL_OPTIONAL_USES_LIBRARIES:=
LOCAL_OVERRIDES_PACKAGES:=
LOCAL_OVERRIDES_MODULES:=
LOCAL_PACKAGE_NAME:=
@@ -271,6 +276,7 @@
LOCAL_USE_CLANG_LLD:=
LOCAL_USE_R8:=
LOCAL_USE_VNDK:=
+LOCAL_USES_LIBRARIES:=
LOCAL_VENDOR_MODULE:=
LOCAL_VINTF_FRAGMENTS:=
LOCAL_VTSC_FLAGS:=
@@ -465,6 +471,8 @@
LOCAL_CUSTOM_BUILD_STEP_OUTPUT:=
LOCAL_IS_AUX_MODULE :=
+full_android_manifest :=
+
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
# Leave the current makefile to make sure we don't break anything
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 01cf3f5..3ce64f9 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -33,7 +33,7 @@
TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT := generic
endif
-KNOWN_ARMv8_CORES := cortex-a53 cortex-a53.a57 cortex-a73
+KNOWN_ARMv8_CORES := cortex-a53 cortex-a53.a57 cortex-a55 cortex-a73 cortex-a75
KNOWN_ARMv8_CORES += kryo denver64 exynos-m1 exynos-m2
# Many devices (incorrectly) use armv7-a-neon as the 2nd architecture variant
diff --git a/core/combo/arch/arm64/armv8-2a.mk b/core/combo/arch/arm64/armv8-2a.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/combo/arch/arm64/armv8-2a.mk
diff --git a/core/config.mk b/core/config.mk
index 3664c6c..3045929 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -45,6 +45,9 @@
backslash := \a
backslash := $(patsubst %a,%,$(backslash))
+# Prevent accidentally changing these variables
+.KATI_READONLY := SHELL empty space comma newline pound backslash
+
# this turns off the suffix rules built into make
.SUFFIXES:
@@ -58,6 +61,10 @@
# If a rule fails, delete $@.
.DELETE_ON_ERROR:
+# Mark variables that should be coming as environment variables from soong_ui
+# as readonly
+.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE
+
# Mark variables deprecated/obsolete
CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
$(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH)
@@ -78,6 +85,9 @@
$(KATI_obsolete_var PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE,Set FCM Version in device manifest instead. See $(CHANGES_URL)#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE)
$(KATI_obsolete_var USE_CLANG_PLATFORM_BUILD,Clang is the only supported Android compiler. See $(CHANGES_URL)#USE_CLANG_PLATFORM_BUILD)
+# 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.
@@ -92,9 +102,6 @@
UNAME := $(shell uname -sm)
SRC_TARGET_DIR := $(TOPDIR)build/target
-SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
-SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
-SRC_TEST_API_DIR := $(TOPDIR)prebuilts/sdk/test-api
# Some specific paths to tools
SRC_DROIDDOC_DIR := $(TOPDIR)build/make/tools/droiddoc
@@ -111,6 +118,9 @@
# Various mappings to avoid hard-coding paths all over the place
include $(BUILD_SYSTEM)/pathmap.mk
+# Allow projects to define their own globally-available variables
+include $(BUILD_SYSTEM)/project_definitions.mk
+
# ###############################################################
# Build system internal files
# ###############################################################
@@ -201,8 +211,10 @@
# ###############################################################
# Broken build defaults
# ###############################################################
-# Assume that all boards have duplicate rules right now.
-BUILD_BROKEN_DUP_RULES := true
+BUILD_BROKEN_ANDROIDMK_EXPORTS :=
+BUILD_BROKEN_DUP_COPY_HEADERS :=
+BUILD_BROKEN_DUP_RULES :=
+BUILD_BROKEN_PHONY_TARGETS :=
# ###############################################################
# Include sub-configuration files
@@ -304,8 +316,8 @@
# Commands to generate .toc file from Darwin dynamic library.
define _gen_toc_command_for_macho
-$(hide) otool -l $(1) | grep LC_ID_DYLIB -A 5 > $(2)
-$(hide) nm -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true)
+$(hide) $(HOST_OTOOL) -l $(1) | grep LC_ID_DYLIB -A 5 > $(2)
+$(hide) $(HOST_NM) -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true)
endef
combo_target := HOST_
@@ -349,10 +361,6 @@
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ccache.mk
include $(BUILD_SYSTEM)/goma.mk
-
-export CC_WRAPPER
-export CXX_WRAPPER
-export JAVAC_WRAPPER
endif
ifdef TARGET_PREFER_32_BIT
@@ -552,8 +560,9 @@
prebuilt_build_tools := prebuilts/build-tools
prebuilt_build_tools_wrappers := prebuilts/build-tools/common/bin
prebuilt_build_tools_jars := prebuilts/build-tools/common/framework
+prebuilt_build_tools_bin_noasan := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin
ifeq ($(filter address,$(SANITIZE_HOST)),)
-prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin
+prebuilt_build_tools_bin := $(prebuilt_build_tools_bin_noasan)
else
prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin
endif
@@ -562,9 +571,7 @@
# Work around for b/68406220
# This should match the soong version.
-ifndef USE_D8
- USE_D8 := true
-endif
+USE_D8 := true
# Default R8 behavior when USE_R8 is not specified.
ifndef USE_R8
@@ -578,7 +585,6 @@
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2
- DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
@@ -588,7 +594,6 @@
AIDL := $(prebuilt_build_tools_bin)/aidl
AAPT := $(prebuilt_sdk_tools_bin)/aapt
AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2
- DESUGAR := $(prebuilt_build_tools_jars)/desugar.jar
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
@@ -611,6 +616,7 @@
CKATI := $(prebuilt_build_tools_bin)/ckati
DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod
FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist
+HOST_INIT_VERIFIER := $(HOST_OUT_EXECUTABLES)/host_init_verifier
MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel
SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper
SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip
@@ -623,13 +629,13 @@
# ---------------------------------------------------------------
# Generic tools.
-LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39
+LEX := $(prebuilt_build_tools_bin_noasan)/flex
# The default PKGDATADIR built in the prebuilt bison is a relative path
# prebuilts/build-tools/common/bison.
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison
-BISON := prebuilts/build-tools/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bin/bison
+BISON := $(prebuilt_build_tools_bin_noasan)/bison
YACC := $(BISON) -d
BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*)
@@ -712,9 +718,12 @@
# Tool to merge AndroidManifest.xmls
ANDROID_MANIFEST_MERGER_CLASSPATH := \
- prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.0.0-beta2/manifest-merger-26.0.0-beta2.jar \
- prebuilts/gradle-plugin/com/android/tools/sdk-common/26.0.0-beta2/sdk-common-26.0.0-beta2.jar \
- prebuilts/gradle-plugin/com/android/tools/common/26.0.0-beta2/common-26.0.0-beta2.jar \
+ 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))) \
@@ -722,21 +731,13 @@
COLUMN:= column
-ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
-ifeq ($(RUN_ERROR_PRONE),true)
-USE_OPENJDK9 :=
-else
USE_OPENJDK9 := true
-endif
-TARGET_OPENJDK9 :=
-else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),false)
-USE_OPENJDK9 :=
+
+ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
TARGET_OPENJDK9 :=
else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),1.8)
-USE_OPENJDK9 := true
TARGET_OPENJDK9 :=
else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),true)
-USE_OPENJDK9 := true
TARGET_OPENJDK9 := true
endif
@@ -751,8 +752,7 @@
endif
APICHECK_CLASSPATH_ENTRIES := \
- $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) \
- $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ $(HOST_OUT_JAVA_LIBRARIES)/apicheck$(COMMON_JAVA_PACKAGE_SUFFIX) \
$(HOST_JDK_TOOLS_JAR) \
)
APICHECK_CLASSPATH := $(subst $(space),:,$(strip $(APICHECK_CLASSPATH_ENTRIES)))
@@ -914,6 +914,30 @@
PLATFORM_SEPOLICY_VERSION \
TOT_SEPOLICY_VERSION \
+ifndef USE_LOGICAL_PARTITIONS
+ USE_LOGICAL_PARTITIONS := $(PRODUCT_USE_LOGICAL_PARTITIONS)
+endif
+.KATI_READONLY := USE_LOGICAL_PARTITIONS
+
+ifeq ($(USE_LOGICAL_PARTITIONS),true)
+ BOARD_KERNEL_CMDLINE += androidboot.logical_partitions=1
+
+ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_SYSTEMIMAGE_PARTITION_SIZE and \
+ BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE together)
+endif
+endif
+
+ifneq ($(BOARD_VENDORIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_VENDORIMAGE_PARTITION_SIZE and \
+ BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE together)
+endif
+endif
+
+endif # USE_LOGICAL_PARTITIONS
+
# ###############################################################
# Set up final options.
# ###############################################################
@@ -1022,6 +1046,10 @@
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
+# Missing optional uses-libraries so that the platform doesn't create build rules that depend on
+# them. See setup_one_odex.mk.
+INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := com.google.android.ble com.google.android.wearable
+
# This is the standard way to name a directory containing prebuilt target
# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index aa591ec..aeead06 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -190,6 +190,15 @@
endif
endif
+# Disable Scudo if ASan or TSan is enabled.
+ifneq ($(filter address thread,$(my_sanitize)),)
+ my_sanitize := $(filter-out scudo,$(my_sanitize))
+endif
+
+ifneq ($(filter scudo,$(my_sanitize)),)
+ my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)SCUDO_RUNTIME_LIBRARY)
+endif
+
# Undefined symbols can occur if a non-sanitized library links
# sanitized static libraries. That's OK, because the executable
# always depends on the ASan runtime library, which defines these
@@ -345,6 +354,7 @@
ifeq ($(filter STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
ifndef LOCAL_SDK_VERSION
my_static_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_MINIMAL_RUNTIME_LIBRARY)
+ my_ldflags += -Wl,--exclude-libs,$($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_MINIMAL_RUNTIME_LIBRARY).a
endif
endif
ifneq ($(filter unsigned-integer-overflow signed-integer-overflow integer,$(my_sanitize)),)
@@ -373,7 +383,7 @@
notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
my_cflags += -fno-sanitize-trap=$(notrap_arg)
# Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
- ifeq ($(filter address thread,$(my_sanitize)),)
+ ifeq ($(filter address thread scudo,$(my_sanitize)),)
# Does not have to be the first DT_NEEDED unlike ASan.
my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
endif
diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk
index 48b7787..30df8ea 100644
--- a/core/configure_module_stem.mk
+++ b/core/configure_module_stem.mk
@@ -1,20 +1,26 @@
my_multilib_stem := $(LOCAL_MODULE_STEM_$(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32))
ifdef my_multilib_stem
my_module_stem := $(my_multilib_stem)
+ $(call verify-module-stem,my_multilib_stem)
else ifdef LOCAL_MODULE_STEM
my_module_stem := $(LOCAL_MODULE_STEM)
+ $(call verify-module-stem,LOCAL_MODULE_STEM)
else
my_module_stem := $(LOCAL_MODULE)
endif
ifdef LOCAL_BUILT_MODULE_STEM
my_built_module_stem := $(LOCAL_BUILT_MODULE_STEM)
+ $(call verify-module-stem,LOCAL_BUILT_MODULE_STEM)
else
my_built_module_stem := $(my_module_stem)$(LOCAL_MODULE_SUFFIX)
+ $(call verify-module-stem,LOCAL_MODULE_SUFFIX)
endif
ifdef LOCAL_INSTALLED_MODULE_STEM
my_installed_module_stem := $(LOCAL_INSTALLED_MODULE_STEM)
+ $(call verify-module-stem,LOCAL_INSTALLED_MODULE_STEM)
else
my_installed_module_stem := $(my_module_stem)$(LOCAL_MODULE_SUFFIX)
+ $(call verify-module-stem,LOCAL_MODULE_SUFFIX)
endif
diff --git a/core/construct_context.sh b/core/construct_context.sh
new file mode 100755
index 0000000..b4ae519
--- /dev/null
+++ b/core/construct_context.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# 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.
+
+set -e
+
+# inputs:
+# $1 is PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST
+# $2 is PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET
+
+# class_loader_context: library paths on the host
+# stored_class_loader_context_libs: library paths on device
+# these are both comma separated paths, example: lib1.jar:lib2.jar or /system/framework/lib1.jar:/system/framework/lib2.jar
+
+# target_sdk_version: parsed from manifest
+# my_conditional_host_libs: libraries conditionally added for non P
+# my_conditional_target_libs: target libraries conditionally added for non P
+#
+# outputs
+# class_loader_context_arg: final class loader conext arg
+# stored_class_loader_context_arg: final stored class loader context arg
+
+my_conditional_host_libs=$1
+my_conditional_target_libs=$2
+
+# Note that SDK 28 is P.
+if [[ "${target_sdk_version}" -lt "28" ]]; then
+ if [[ -z "${class_loader_context}" ]]; then
+ export class_loader_context="${my_conditional_host_libs}"
+ else
+ export class_loader_context="${my_conditional_host_libs}:${class_loader_context}"
+ fi
+ if [[ -z "${stored_class_loader_context_libs}" ]]; then
+ export stored_class_loader_context_libs="${my_conditional_target_libs}";
+ else
+ export stored_class_loader_context_libs="${my_conditional_target_libs}:${stored_class_loader_context_libs}";
+ fi
+fi
+
+# Generate the actual context string.
+export class_loader_context_arg="--class-loader-context=PCL[${class_loader_context}]"
+export stored_class_loader_context_arg="--stored-class-loader-context=PCL[${stored_class_loader_context_libs}]"
diff --git a/core/definitions.mk b/core/definitions.mk
index 90c6ecb..2c5fc6a 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -731,6 +731,25 @@
endef
endif
+# Get the exported-sdk-libs files which collectively give you the list of exported java sdk
+# lib names that are (transitively) exported from the given set of java libs
+# $(1): library name list
+define exported-sdk-libs-files
+$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/exported-sdk-libs)
+endef
+
+# Fix manifest
+# $(1): input manifest path
+# $(2): output manifest path
+# $(3): min sdk version
+# $(4): (optional) exported-sdk-libs file
+define fix-manifest
+$(MANIFEST_FIXER) \
+--minSdkVersion $(3) \
+$(if $(4),$$(cat $(4) | sort -u | sed -e 's/^/\ --uses-library\ /' | tr '\n' ' ')) \
+$(1) $(2)
+endef
+
###########################################################
## Returns true if $(1) and $(2) are equal. Returns
## the empty string if they are not equal.
@@ -1835,14 +1854,15 @@
###########################################################
ifneq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_EXTRA = && $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
+ TARGET_STRIP_EXTRA = && $(PRIVATE_OBJCOPY_ADD_SECTION) --add-gnu-debuglink=$< $@
TARGET_STRIP_KEEP_SYMBOLS_EXTRA = --add-gnu-debuglink=$<
endif
define transform-to-stripped
@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ \
+$(hide) $(PRIVATE_STRIP) $(PRIVATE_STRIP_ALL_FLAGS) $< \
+ $(PRIVATE_STRIP_O_FLAG) $@ \
$(if $(PRIVATE_NO_DEBUGLINK),,$(TARGET_STRIP_EXTRA))
endef
@@ -1850,7 +1870,9 @@
@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip (mini debug info): $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(hide) rm -f $@ $@.dynsyms $@.funcsyms $@.keep_symbols $@.debug $@.mini_debuginfo.xz
-if $(PRIVATE_STRIP) --strip-all -R .comment $< -o $@; then \
+if $(PRIVATE_STRIP) $(PRIVATE_STRIP_ALL_FLAGS) \
+ --remove-section .comment $< \
+ $(PRIVATE_STRIP_O_FLAG) $@; then \
$(PRIVATE_OBJCOPY) --only-keep-debug $< $@.debug && \
$(PRIVATE_NM) -D $< --format=posix --defined-only | awk '{ print $$1 }' | sort >$@.dynsyms && \
$(PRIVATE_NM) $< --format=posix --defined-only | awk '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort >$@.funcsyms && \
@@ -1861,7 +1883,7 @@
$(PRIVATE_OBJCOPY) --rename-section saved_debug_frame=.debug_frame $@.mini_debuginfo && \
rm -f $@.mini_debuginfo.xz && \
$(XZ) $@.mini_debuginfo && \
- $(PRIVATE_OBJCOPY) --add-section .gnu_debugdata=$@.mini_debuginfo.xz $@; \
+ $(PRIVATE_OBJCOPY_ADD_SECTION) --add-section .gnu_debugdata=$@.mini_debuginfo.xz $@; \
else \
cp -f $< $@; \
fi
@@ -1870,8 +1892,8 @@
define transform-to-stripped-keep-symbols
@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip (keep symbols): $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
-$(hide) $(PRIVATE_OBJCOPY) \
- `$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "-R " $$2}' | xargs` \
+$(hide) $(PRIVATE_OBJCOPY_ADD_SECTION) \
+ `$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "--remove-section " $$2}' | xargs` \
$(TARGET_STRIP_KEEP_SYMBOLS_EXTRA) $< $@
endef
@@ -2092,7 +2114,7 @@
define aapt2-compile-resource-zips
@mkdir -p $(dir $@)
$(ZIPSYNC) -d $@.contents -l $@.list $(PRIVATE_SOURCE_RES_ZIPS)
-$(hide) $(AAPT2) compile -o $@ --dir $@.tmp $(PRIVATE_AAPT2_CFLAGS) --legacy
+$(hide) $(AAPT2) compile -o $@ --dir $@.contents $(PRIVATE_AAPT2_CFLAGS) --legacy
endef
# Set up rule to compile one resource file with aapt2.
@@ -2147,6 +2169,19 @@
$(EXTRACT_JAR_PACKAGES) -i $(PRIVATE_SRCJAR) -o $(PRIVATE_AAPT_EXTRA_PACKAGES) --prefix '--extra-packages '
endef
+define _create-default-manifest-file
+$(1):
+ rm -f $1
+ (echo '<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="missing.manifest">' && \
+ echo ' <uses-sdk android:minSdkVersion="$(2)" />' && \
+ echo '</manifest>' ) > $1
+endef
+
+define create-default-manifest-file
+ $(eval $(call _create-default-manifest-file,$(1),$(2)))
+endef
+
+
###########################################################
xlint_unchecked := -Xlint:unchecked
@@ -2361,48 +2396,10 @@
$(if $(filter $(1),$(PLATFORM_VERSION_CODENAME)),10000,$(1))
endef
-# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
-define desugar-classes-jar
-@echo Desugar: $@
-@mkdir -p $(dir $@)
-$(hide) rm -f $@ $@.tmp
-@rm -rf $(dir $@)/desugar_dumped_classes
-@mkdir $(dir $@)/desugar_dumped_classes
-$(hide) $(JAVA) \
- $(if $(USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
- -Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
- -jar $(DESUGAR) \
- $(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
- $(addprefix --classpath_entry ,$(PRIVATE_SHARED_JAVA_HEADER_LIBRARIES)) \
- --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
- --allow_empty_bootclasspath \
- $(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
- -i $< -o $@.tmp
- mv $@.tmp $@
-endef
-
define transform-classes.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
-$(hide) rm -f $(dir $@)classes*.dex
-$(hide) $(DX_COMMAND) \
- --dex --output=$(dir $@) \
- --min-sdk-version=$(PRIVATE_MIN_SDK_VERSION) \
- $(if $(NO_OPTIMIZE_DX), \
- --no-optimize) \
- $(if $(GENERATE_DEX_DEBUG), \
- --debug --verbose \
- --dump-to=$(@:.dex=.lst) \
- --dump-width=1000) \
- $(PRIVATE_DX_FLAGS) \
- $<
-endef
-
-
-define transform-classes-d8.jar-to-dex
-@echo "target Dex: $(PRIVATE_MODULE)"
-@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
$(hide) $(DX_COMMAND) \
@@ -2661,6 +2658,33 @@
$(_cmf_dest)))
endef
+# Copy the file only if it's a well-formed init script file. For use via $(eval).
+# $(1): source file
+# $(2): destination file
+define copy-init-script-file-checked
+# Host init verifier doesn't exist on darwin.
+ifneq ($(HOST_OS),darwin)
+$(2): $(1) $(HOST_INIT_VERIFIER) $(call intermediates-dir-for,ETC,passwd)/passwd
+ $(hide) $(HOST_INIT_VERIFIER) $$< $(call intermediates-dir-for,ETC,passwd)/passwd
+else
+$(2): $(1)
+endif
+ @echo "Copy init script: $$@"
+ $$(copy-file-to-target)
+endef
+
+# Copies many init script files and check they are well-formed.
+# $(1): The init script files to copy. Each entry is a ':' separated src:dst pair.
+# Evaluates to the list of the dst files. (ie suitable for a dependency list.)
+define copy-many-init-script-files-checked
+$(foreach f, $(1), $(strip \
+ $(eval _cmf_tuple := $(subst :, ,$(f))) \
+ $(eval _cmf_src := $(word 1,$(_cmf_tuple))) \
+ $(eval _cmf_dest := $(word 2,$(_cmf_tuple))) \
+ $(eval $(call copy-init-script-file-checked,$(_cmf_src),$(_cmf_dest))) \
+ $(_cmf_dest)))
+endef
+
# Copy the file only if it's a well-formed xml file. For use via $(eval).
# $(1): source file
# $(2): destination file, must end with .xml.
@@ -3495,10 +3519,18 @@
$(if $(call has-system-sdk-version,$(1)),$(patsubst system_%,%,$(1)),$(1)))
endef
-# Convert to lower case without requiring a shell, which isn't cacheable.
+###########################################################
+## Convert to lower case without requiring a shell, which isn't cacheable.
+##
+## $(1): string
+###########################################################
to-lower=$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
-# Convert to upper case without requiring a shell, which isn't cacheable.
+###########################################################
+## Convert to upper case without requiring a shell, which isn't cacheable.
+##
+## $(1): string
+###########################################################
to-upper=$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
# Sanity-check to-lower and to-upper
@@ -3515,3 +3547,40 @@
lower :=
upper :=
+
+###########################################################
+## 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
+###########################################################
+define verify-module-name
+$(if $(filter-out $(LOCAL_MODULE),$(subst /,,$(LOCAL_MODULE))), \
+ $(call pretty-warning,Module name contains a /$(comma) use LOCAL_MODULE_STEM and LOCAL_MODULE_RELATIVE_PATH instead)) \
+$(if $(call _invalid-name-chars,$(LOCAL_MODULE)), \
+ $(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))))))))))))))))))))))))))))))))))))))))))))))
+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
+##
+## $(1): The module stem variable to check
+###########################################################
+define verify-module-stem
+$(if $(filter-out $($(1)),$(subst /,,$($(1)))), \
+ $(call pretty-warning,Module stem \($(1)\) contains a /$(comma) use LOCAL_MODULE_RELATIVE_PATH instead)) \
+$(if $(call _invalid-name-chars,$($(1))), \
+ $(call pretty-error,Invalid characters in module stem \($(1)\): $(call _invalid-name-chars,$($(1)))))
+endef
+.KATI_READONLY := verify-module-stem
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 10522ac..b64155c 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -100,6 +100,9 @@
my_use_profile_for_boot_image := true
endif
endif
+ifeq (,$(strip $(LIBART_TARGET_BOOT_DEX_FILES)))
+my_use_profile_for_boot_image := false
+endif
ifeq (true,$(my_use_profile_for_boot_image))
@@ -163,12 +166,27 @@
# $(1): the input .jar or .apk file
# $(2): the output .odex file
+# In the case where LOCAL_ENFORCE_USES_LIBRARIES is true, PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT
+# contains the normalized path list of the libraries. This makes it easier to conditionally prepend
+# org.apache.http.legacy.impl based on the SDK level if required.
define dex2oat-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
-$(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
+stored_class_loader_context_libs=$(PRIVATE_DEX2OAT_STORED_CLASS_LOADER_CONTEXT_LIBS) && \
+class_loader_context_arg=--class-loader-context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) && \
+class_loader_context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) && \
+stored_class_loader_context_arg="" && \
+uses_library_names="$(PRIVATE_USES_LIBRARY_NAMES)" && \
+optional_uses_library_names="$(PRIVATE_OPTIONAL_USES_LIBRARY_NAMES)" && \
+aapt_binary="$(AAPT)" && \
+$(if $(filter true,$(PRIVATE_ENFORCE_USES_LIBRARIES)), \
+source build/make/core/verify_uses_libraries.sh "$(1)" && \
+source build/make/core/construct_context.sh "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST)" "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET)" && \
+,) \
+ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
- --class-loader-context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) \
+ $${class_loader_context_arg} \
+ $${stored_class_loader_context_arg} \
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
--dex-file=$(1) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 29584b1..977f852 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -54,11 +54,11 @@
ifeq (,$(my_out_boot_image_profile_location))
my_boot_image_flags := --image-classes=$(PRELOADED_CLASSES)
-my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS)
else
my_boot_image_flags := --compiler-filter=speed-profile
my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
endif
+my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS)
ifneq (addresstrue,$(SANITIZE_TARGET)$(SANITIZE_LITE))
# Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index cd48316..deaee56 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -232,16 +232,11 @@
##
##
-ifdef USE_OPENJDK9
# For OpenJDK 9 we use --patch-module to define the core libraries code.
# TODO(tobiast): Reorganize this when adding proper support for OpenJDK 9
# modules. Here we treat all code in core libraries as being in java.base
# to work around the OpenJDK 9 module system. http://b/62049770
$(full_target): PRIVATE_BOOTCLASSPATH_ARG := --patch-module=java.base=$(PRIVATE_BOOTCLASSPATH)
-else
-# For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
-$(full_target): PRIVATE_BOOTCLASSPATH_ARG := $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH))
-endif
$(full_target): $(full_src_files) $(LOCAL_GENERATED_SOURCES) $(full_java_libs) $(ZIPSYNC) $(LOCAL_SRCJARS) $(LOCAL_ADDITIONAL_DEPENDENCIES)
@echo Docs javadoc: $(PRIVATE_OUT_DIR)
@mkdir -p $(dir $@)
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 74e0fa2..939af33 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -35,6 +35,7 @@
LOCAL_INTERMEDIATE_TARGETS := $(linked_module)
###################################
+include $(BUILD_SYSTEM)/use_lld_setup.mk
include $(BUILD_SYSTEM)/binary.mk
###################################
@@ -44,43 +45,21 @@
relocation_packer_input := $(linked_module)
relocation_packer_output := $(intermediates)/PACKED/$(my_built_module_stem)
-my_pack_module_relocations := false
-ifneq ($(DISABLE_RELOCATION_PACKER),true)
- my_pack_module_relocations := $(firstword \
- $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
- $(LOCAL_PACK_MODULE_RELOCATIONS))
-endif
+include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
-ifeq ($(my_pack_module_relocations),)
- my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
-endif
-
-# Do not pack relocations for executables. Because packing results in
-# non-zero p_vaddr which causes kernel to load executables to lower
-# address (starting at 0x8000) http://b/20665974
-ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
- my_pack_module_relocations := false
-endif
-
-# TODO (dimitry): Relocation packer is not yet available for darwin
-ifneq ($(HOST_OS),linux)
- my_pack_module_relocations := false
-endif
-
-# Relocation packer does not work with LLD yet.
-ifeq ($(my_use_clang_lld),true)
- my_pack_module_relocations := false
-endif
-
+# Stand-alone relocation_packer does not work with LLD output,
+# but it can be replaced by lld's --pack-dyn-relocs=android.
ifeq (true,$(my_pack_module_relocations))
+ifeq (false,$(my_use_clang_lld))
# Pack relocations
$(relocation_packer_output): $(relocation_packer_input)
$(pack-elf-relocations)
else
-$(relocation_packer_output): $(relocation_packer_input)
- @echo "target Unpacked: $(PRIVATE_MODULE) ($@)"
- $(copy-file-to-target)
-endif
+relocation_packer_output := $(relocation_packer_input)
+endif # my_use_clang_lld
+else
+relocation_packer_output := $(relocation_packer_input)
+endif # my_pack_module_relocations
###########################################################
## Store a copy with symbols for symbolic debugging
@@ -138,7 +117,25 @@
endif
endif
-$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+ifeq ($(my_use_clang_lld),true)
+ # b/80093681: GNU strip and objcopy --{add,remove}-section have bug in handling
+ # GNU_RELRO segment of files lnked by clang lld; so they are replaced
+ # by llvm-strip and llvm-objcopy here.
+ $(strip_output): PRIVATE_OBJCOPY_ADD_SECTION := $(LLVM_OBJCOPY)
+ $(strip_output): PRIVATE_STRIP := $(LLVM_STRIP)
+ $(strip_output): PRIVATE_STRIP_O_FLAG :=
+ # GNU strip keeps .ARM.attributes section even with -strip-all,
+ # so here pass -keep=.ARM.attributes to llvm-strip.
+ $(strip_output): PRIVATE_STRIP_ALL_FLAGS := -strip-all -keep=.ARM.attributes
+else
+ $(strip_output): PRIVATE_OBJCOPY_ADD_SECTION := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
+ $(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+ $(strip_output): PRIVATE_STRIP_O_FLAG := -o
+ $(strip_output): PRIVATE_STRIP_ALL_FLAGS := --strip-all
+endif
+# PRIVATE_OBJCOPY is not changed to llvm-objcopy yet.
+# It is used even when my_use_clang_lld is true,
+# because some objcopy flags are not supported by llvm-objcopy yet.
$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
$(strip_output): PRIVATE_NM := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NM)
$(strip_output): PRIVATE_READELF := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_READELF)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 1a36703..874ea91 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -273,6 +273,31 @@
board_config_mk :=
###########################################
+# Handle BUILD_BROKEN_* settings
+vars := \
+ BUILD_BROKEN_ANDROIDMK_EXPORTS \
+ BUILD_BROKEN_DUP_COPY_HEADERS \
+ BUILD_BROKEN_DUP_RULES \
+ BUILD_BROKEN_PHONY_TARGETS
+
+$(foreach var,$(vars),$(eval $(var) := $$(strip $$($(var)))))
+
+$(foreach var,$(vars), \
+ $(if $(filter-out true false,$($(var))), \
+ $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))")))
+
+.KATI_READONLY := $(vars)
+
+CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
+
+# "" is equivalent to true currently.
+ifeq ($(BUILD_BROKEN_ANDROIDMK_EXPORTS),false)
+$(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_VENDOR
ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
TARGET_COPY_OUT_VENDOR := system/vendor
@@ -374,28 +399,22 @@
# ---------------------------------------------------------------
# figure out the output directories
-ifeq (,$(strip $(OUT_DIR)))
-ifeq (,$(strip $(OUT_DIR_COMMON_BASE)))
-OUT_DIR := $(TOPDIR)out
-else
-OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD))
-endif
-endif
-
SOONG_OUT_DIR := $(OUT_DIR)/soong
TARGET_OUT_ROOT := $(OUT_DIR)/target
HOST_OUT_ROOT := $(OUT_DIR)/host
+.KATI_READONLY := SOONG_OUT_DIR TARGET_OUT_ROOT HOST_OUT_ROOT
+
# We want to avoid two host bin directories in multilib build.
HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-# TODO: remove
-BUILD_OUT := $(HOST_OUT)
HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH)
+.KATI_READONLY := HOST_OUT SOONG_HOST_OUT HOST_CROSS_OUT
+
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common
@@ -403,11 +422,17 @@
PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)
+.KATI_READONLY := TARGET_PRODUCT_OUT_ROOT TARGET_COMMON_OUT_ROOT HOST_COMMON_OUT_ROOT PRODUCT_OUT
+
OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
OUT_NDK_DOCS := $(TARGET_COMMON_OUT_ROOT)/ndk-docs
+.KATI_READONLY := OUT_DOCS OUT_NDK_DOCS
-BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin
+$(call KATI_obsolete,BUILD_OUT,Use HOST_OUT instead)
+
+BUILD_OUT_EXECUTABLES := $(HOST_OUT)/bin
SOONG_HOST_OUT_EXECUTABLES := $(SOONG_HOST_OUT)/bin
+.KATI_READONLY := BUILD_OUT_EXECUTABLES SOONG_HOST_OUT_EXECUTABLES
HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin
HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64
@@ -417,18 +442,39 @@
HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest64
HOST_OUT_COVERAGE := $(HOST_OUT)/coverage
HOST_OUT_TESTCASES := $(HOST_OUT)/testcases
+.KATI_READONLY := \
+ HOST_OUT_EXECUTABLES \
+ HOST_OUT_SHARED_LIBRARIES \
+ HOST_OUT_RENDERSCRIPT_BITCODE \
+ HOST_OUT_JAVA_LIBRARIES \
+ HOST_OUT_SDK_ADDON \
+ HOST_OUT_NATIVE_TESTS \
+ HOST_OUT_COVERAGE \
+ HOST_OUT_TESTCASES
HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin
HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib
HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest
HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage
HOST_CROSS_OUT_TESTCASES := $(HOST_CROSS_OUT)/testcases
+.KATI_READONLY := \
+ HOST_CROSS_OUT_EXECUTABLES \
+ HOST_CROSS_OUT_SHARED_LIBRARIES \
+ HOST_CROSS_OUT_NATIVE_TESTS \
+ HOST_CROSS_OUT_COVERAGE \
+ HOST_CROSS_OUT_TESTCASES
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
+.KATI_READONLY := \
+ HOST_OUT_INTERMEDIATES \
+ HOST_OUT_INTERMEDIATE_LIBRARIES \
+ HOST_OUT_NOTICE_FILES \
+ HOST_OUT_COMMON_INTERMEDIATES \
+ HOST_OUT_FAKE
# Nano environment config
include $(BUILD_SYSTEM)/aux_config.mk
@@ -436,13 +482,22 @@
HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib
HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
+.KATI_READONLY := \
+ HOST_CROSS_OUT_INTERMEDIATES \
+ HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES \
+ HOST_CROSS_OUT_NOTICE_FILES
HOST_OUT_GEN := $(HOST_OUT)/gen
HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
+.KATI_READONLY := \
+ HOST_OUT_GEN \
+ HOST_OUT_COMMON_GEN
HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
+.KATI_READONLY := HOST_CROSS_OUT_GEN
HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config
+.KATI_READONLY := HOST_OUT_TEST_CONFIG
# Out for HOST_2ND_ARCH
HOST_2ND_ARCH_VAR_PREFIX := 2ND_
@@ -454,10 +509,21 @@
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT_JAVA_LIBRARIES)
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES := $(HOST_OUT_TESTCASES)
+.KATI_READONLY := \
+ HOST_2ND_ARCH_VAR_PREFIX \
+ HOST_2ND_ARCH_MODULE_SUFFIX \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS \
+ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES
# The default host library path.
# It always points to the path where we build libraries in the default bitness.
HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
+.KATI_READONLY := HOST_LIBRARY_PATH
# Out for HOST_CROSS_2ND_ARCH
HOST_CROSS_2ND_ARCH_VAR_PREFIX := 2ND_
@@ -467,6 +533,14 @@
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib64
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT_EXECUTABLES)
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest64
+.KATI_READONLY := \
+ HOST_CROSS_2ND_ARCH_VAR_PREFIX \
+ HOST_CROSS_2ND_ARCH_MODULE_SUFFIX \
+ $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES \
+ $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES \
+ $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES \
+ $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES \
+ $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS
ifneq ($(filter address,$(SANITIZE_TARGET)),)
TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_asan
@@ -475,17 +549,21 @@
endif
TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
+.KATI_READONLY := TARGET_OUT_INTERMEDIATES TARGET_OUT_HEADERS TARGET_OUT_INTERMEDIATE_LIBRARIES
ifneq ($(filter address,$(SANITIZE_TARGET)),)
TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj_asan
else
TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
endif
+.KATI_READONLY := TARGET_OUT_COMMON_INTERMEDIATES
TARGET_OUT_GEN := $(PRODUCT_OUT)/gen
TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
+.KATI_READONLY := TARGET_OUT_GEN TARGET_OUT_COMMON_GEN
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
+.KATI_READONLY := TARGET_OUT
ifneq ($(filter address,$(SANITIZE_TARGET)),)
target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
ifeq ($(SANITIZE_LITE),true)
@@ -520,6 +598,21 @@
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config
+.KATI_READONLY := \
+ TARGET_OUT_EXECUTABLES \
+ TARGET_OUT_OPTIONAL_EXECUTABLES \
+ TARGET_OUT_SHARED_LIBRARIES \
+ TARGET_OUT_RENDERSCRIPT_BITCODE \
+ TARGET_OUT_JAVA_LIBRARIES \
+ TARGET_OUT_APPS \
+ TARGET_OUT_APPS_PRIVILEGED \
+ TARGET_OUT_KEYLAYOUT \
+ TARGET_OUT_KEYCHARS \
+ TARGET_OUT_ETC \
+ TARGET_OUT_NOTICE_FILES \
+ TARGET_OUT_FAKE \
+ TARGET_OUT_TESTCASES \
+ TARGET_OUT_TEST_CONFIG
ifeq ($(SANITIZE_LITE),true)
# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
@@ -528,6 +621,7 @@
else
TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
endif
+.KATI_READONLY := TARGET_OUT_SYSTEM_OTHER
# Out for TARGET_2ND_ARCH
TARGET_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
@@ -537,6 +631,7 @@
else
TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX)
endif
+.KATI_READONLY := TARGET_2ND_ARCH_VAR_PREFIX TARGET_2ND_ARCH_MODULE_SUFFIX
ifneq ($(filter address,$(SANITIZE_TARGET)),)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)_asan
@@ -554,6 +649,15 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES := $(TARGET_OUT_TESTCASES)
+.KATI_READONLY := \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_RENDERSCRIPT_BITCODE \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES
TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
@@ -575,6 +679,20 @@
TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX)
endif
TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages
+.KATI_READONLY := \
+ TARGET_OUT_DATA \
+ TARGET_OUT_DATA_EXECUTABLES \
+ TARGET_OUT_DATA_SHARED_LIBRARIES \
+ TARGET_OUT_DATA_JAVA_LIBRARIES \
+ TARGET_OUT_DATA_APPS \
+ TARGET_OUT_DATA_KEYLAYOUT \
+ TARGET_OUT_DATA_KEYCHARS \
+ TARGET_OUT_DATA_ETC \
+ TARGET_OUT_DATA_NATIVE_TESTS \
+ TARGET_OUT_DATA_METRIC_TESTS \
+ TARGET_OUT_VENDOR_NATIVE_TESTS \
+ TARGET_OUT_VENDOR_METRIC_TESTS \
+ TARGET_OUT_DATA_FAKE
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
@@ -590,10 +708,20 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX)
endif
+.KATI_READONLY := \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS \
TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
+.KATI_READONLY := TARGET_OUT_CACHE
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
+.KATI_READONLY := TARGET_OUT_VENDOR
ifneq ($(filter address,$(SANITIZE_TARGET)),)
target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor
ifeq ($(SANITIZE_LITE),true)
@@ -620,6 +748,15 @@
TARGET_OUT_VENDOR_APPS := $(target_out_vendor_app_base)/app
TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(target_out_vendor_app_base)/priv-app
TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
+.KATI_READONLY := \
+ TARGET_OUT_VENDOR_EXECUTABLES \
+ TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES \
+ TARGET_OUT_VENDOR_SHARED_LIBRARIES \
+ TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE \
+ TARGET_OUT_VENDOR_JAVA_LIBRARIES \
+ TARGET_OUT_VENDOR_APPS \
+ TARGET_OUT_VENDOR_APPS_PRIVILEGED \
+ TARGET_OUT_VENDOR_ETC
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
@@ -630,6 +767,12 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR_APPS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(TARGET_OUT_VENDOR_APPS_PRIVILEGED)
+.KATI_READONLY := \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED
TARGET_OUT_OEM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_OEM)
TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM)/bin
@@ -642,6 +785,12 @@
# TARGET_OUT_OEM_JAVA_LIBRARIES:= $(TARGET_OUT_OEM)/framework
TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM)/app
TARGET_OUT_OEM_ETC := $(TARGET_OUT_OEM)/etc
+.KATI_READONLY := \
+ TARGET_OUT_OEM \
+ TARGET_OUT_OEM_EXECUTABLES \
+ TARGET_OUT_OEM_SHARED_LIBRARIES \
+ TARGET_OUT_OEM_APPS \
+ TARGET_OUT_OEM_ETC
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM_EXECUTABLES)
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
@@ -650,6 +799,10 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
endif
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM_APPS)
+.KATI_READONLY := \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS \
TARGET_OUT_ODM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM)
TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM)/bin
@@ -660,6 +813,12 @@
endif
TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM)/app
TARGET_OUT_ODM_ETC := $(TARGET_OUT_ODM)/etc
+.KATI_READONLY := \
+ TARGET_OUT_ODM \
+ TARGET_OUT_ODM_EXECUTABLES \
+ TARGET_OUT_ODM_SHARED_LIBRARIES \
+ TARGET_OUT_ODM_APPS \
+ TARGET_OUT_ODM_ETC
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM_EXECUTABLES)
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
@@ -668,10 +827,15 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib
endif
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS)
+.KATI_READONLY := \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS
TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT)
+.KATI_READONLY := TARGET_OUT_PRODUCT
ifneq ($(filter address,$(SANITIZE_TARGET)),)
-target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
+target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/product
ifeq ($(SANITIZE_LITE),true)
# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
@@ -680,7 +844,7 @@
target_out_product_app_base := $(TARGET_OUT_PRODUCT)
endif
else
-target_out_product_shared_libraries_base := $(TARGET_OUT)
+target_out_product_shared_libraries_base := $(TARGET_OUT_PRODUCT)
target_out_product_app_base := $(TARGET_OUT_PRODUCT)
endif
@@ -689,10 +853,16 @@
else
TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
endif
-TARGET_OUT_PRODUCT_JAVA_LIBRARIES:= $(TARGET_OUT_PRODUCT)/framework
+TARGET_OUT_PRODUCT_JAVA_LIBRARIES := $(TARGET_OUT_PRODUCT)/framework
TARGET_OUT_PRODUCT_APPS := $(target_out_product_app_base)/app
TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(target_out_product_app_base)/priv-app
TARGET_OUT_PRODUCT_ETC := $(TARGET_OUT_PRODUCT)/etc
+.KATI_READONLY := \
+ TARGET_OUT_PRODUCT_SHARED_LIBRARIES \
+ TARGET_OUT_PRODUCT_JAVA_LIBRARIES \
+ TARGET_OUT_PRODUCT_APPS \
+ TARGET_OUT_PRODUCT_APPS_PRIVILEGED \
+ TARGET_OUT_PRODUCT_ETC
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib/$(TARGET_2ND_ARCH)
@@ -701,8 +871,13 @@
endif
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS := $(TARGET_OUT_PRODUCT_APPS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_APPS_PRIVILEGED)
+.KATI_READONLY := \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS \
+ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED
TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
+.KATI_READONLY := TARGET_OUT_BREAKPAD
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
@@ -712,31 +887,60 @@
TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin
TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin
TARGET_OUT_COVERAGE := $(PRODUCT_OUT)/coverage
+.KATI_READONLY := \
+ TARGET_OUT_UNSTRIPPED \
+ TARGET_OUT_EXECUTABLES_UNSTRIPPED \
+ TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED \
+ TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED \
+ TARGET_ROOT_OUT_UNSTRIPPED \
+ TARGET_ROOT_OUT_SBIN_UNSTRIPPED \
+ TARGET_ROOT_OUT_BIN_UNSTRIPPED \
+ TARGET_OUT_COVERAGE
TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)
TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin
TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc
TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr
+.KATI_READONLY := \
+ TARGET_ROOT_OUT \
+ TARGET_ROOT_OUT_BIN \
+ TARGET_ROOT_OUT_SBIN \
+ TARGET_ROOT_OUT_ETC \
+ TARGET_ROOT_OUT_USR
TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY)
TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root
+.KATI_READONLY := \
+ TARGET_RECOVERY_OUT \
+ TARGET_RECOVERY_ROOT_OUT
TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader
TARGET_SYSLOADER_ROOT_OUT := $(TARGET_SYSLOADER_OUT)/root
TARGET_SYSLOADER_SYSTEM_OUT := $(TARGET_SYSLOADER_OUT)/root/system
+.KATI_READONLY := \
+ TARGET_SYSLOADER_OUT \
+ TARGET_SYSLOADER_ROOT_OUT \
+ TARGET_SYSLOADER_SYSTEM_OUT
TARGET_INSTALLER_OUT := $(PRODUCT_OUT)/installer
TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data
TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root
TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system
+.KATI_READONLY := \
+ TARGET_INSTALLER_OUT \
+ TARGET_INSTALLER_DATA_OUT \
+ TARGET_INSTALLER_ROOT_OUT \
+ TARGET_INSTALLER_SYSTEM_OUT
COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES
PER_ARCH_MODULE_CLASSES := SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP RENDERSCRIPT_BITCODE NATIVE_TESTS HEADER_LIBRARIES
+.KATI_READONLY := COMMON_MODULE_CLASSES PER_ARCH_MODULE_CLASSES
ifeq (,$(strip $(DIST_DIR)))
DIST_DIR := $(OUT_DIR)/dist
endif
+.KATI_READONLY := DIST_DIR
ifeq ($(CALLED_FROM_SETUP),true)
PRINT_BUILD_CONFIG ?= true
diff --git a/core/force_aapt2.mk b/core/force_aapt2.mk
new file mode 100644
index 0000000..ede6fd4
--- /dev/null
+++ b/core/force_aapt2.mk
@@ -0,0 +1,71 @@
+#
+# 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.
+#
+
+# Including this makefile will force AAPT2 on if FORCE_AAPT2==true,
+# rewriting some properties to convert standard AAPT usage to AAPT2.
+
+ifneq ($(FORCE_AAPT2),false)
+ ifeq ($(LOCAL_USE_AAPT2),)
+ # Force AAPT2 on
+ LOCAL_USE_AAPT2 := true
+ # Filter out support library resources
+ LOCAL_RESOURCE_DIR := $(filter-out \
+ prebuilts/sdk/current/% \
+ frameworks/support/%,\
+ $(LOCAL_RESOURCE_DIR))
+ # Filter out unnecessary aapt flags
+ ifneq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
+ LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \
+ $(filter-out \
+ --extra-packages=android.support.% \
+ --extra-packages=androidx.%, \
+ $(subst --extra-packages$(space),--extra-packages=,$(LOCAL_AAPT_FLAGS))))
+ ifeq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
+ LOCAL_AAPT_FLAGS := $(filter-out --auto-add-overlay,$(LOCAL_AAPT_FLAGS))
+ endif
+ endif
+
+ # AAPT2 is pickier about missing resources. Support library may have references to resources
+ # added in current, so always treat LOCAL_SDK_VERSION as LOCAL_SDK_RES_VERSION := current.
+ ifdef LOCAL_SDK_VERSION
+ LOCAL_SDK_RES_VERSION := current
+ endif
+
+ ifeq (,$(strip $(LOCAL_MANIFEST_FILE)$(LOCAL_FULL_MANIFEST_FILE)))
+ ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml))
+ # work around missing manifests by creating a default one
+ LOCAL_FULL_MANIFEST_FILE := $(call local-intermediates-dir,COMMON)/DefaultManifest.xml
+ ifdef LOCAL_MIN_SDK_VERSION
+ my_manifest_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
+ else ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ my_manifest_min_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+ else
+ my_manifest_min_sdk_version := $(DEFAULT_APP_TARGET_SDK)
+ endif
+ $(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(my_manifest_min_sdk_version))
+ my_manifest_min_sdk_version :=
+ endif
+ endif
+ endif
+endif
+
+ifneq ($(LOCAL_USE_AAPT2),true)
+ ifneq ($(LOCAL_USE_AAPT2),false)
+ ifneq ($(LOCAL_USE_AAPT2),)
+ $(call pretty-error,Invalid value for LOCAL_USE_AAPT2: "$(LOCAL_USE_AAPT2)")
+ endif
+ endif
+endif
diff --git a/core/goma.mk b/core/goma.mk
index 2fb37a7..3787dfd 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -14,9 +14,6 @@
# limitations under the License.
#
-# Used by the compiler wrapper, but should only be set by gomacc
-unexport GOMACC_PATH
-
# Notice: this works only with Google's Goma build infrastructure.
ifneq ($(filter-out false,$(USE_GOMA)),)
# Goma requires a lot of processes and file descriptors.
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 1ef0ccb..d35f39d 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -33,7 +33,6 @@
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
-full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
@@ -43,7 +42,6 @@
$(full_classes_turbine_jar) \
$(full_classes_compiled_jar) \
$(full_classes_combined_jar) \
- $(full_classes_desugar_jar) \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(built_dex) \
@@ -158,22 +156,6 @@
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
-ifneq ($(USE_D8_DESUGAR),true)
-my_desugaring :=
-ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
-my_desugaring := true
-$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
- $(desugar-classes-jar)
-endif
-else
-my_desugaring :=
-endif
-
-ifndef my_desugaring
-full_classes_desugar_jar := $(full_classes_jar)
-endif
-
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex; all we want are the .class files with resources.
$(LOCAL_BUILT_MODULE) : $(java_resource_sources)
@@ -184,12 +166,8 @@
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_desugar_jar) $(DX) $(ZIP2ZIP)
-ifneq ($(USE_D8_DESUGAR),true)
+$(built_dex): $(full_classes_jar) $(DX) $(ZIP2ZIP)
$(transform-classes.jar-to-dex)
-else
- $(transform-classes-d8.jar-to-dex)
-endif
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
index c4f9f66..e72c419 100644
--- a/core/host_executable_internal.mk
+++ b/core/host_executable_internal.mk
@@ -33,7 +33,7 @@
my_libdir := $(notdir $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))
ifeq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
-$(LOCAL_BUILT_MODULE): PRIVATE_RPATHS := ../../$(my_libdir)
+$(LOCAL_BUILT_MODULE): PRIVATE_RPATHS := ../../$(my_libdir) ../../../$(my_libdir)
else
$(LOCAL_BUILT_MODULE): PRIVATE_RPATHS := ../$(my_libdir) $(my_libdir)
endif
diff --git a/core/host_java_library_common.mk b/core/host_java_library_common.mk
index 51e2d94..8df4b37 100644
--- a/core/host_java_library_common.mk
+++ b/core/host_java_library_common.mk
@@ -48,8 +48,3 @@
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
-
-# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
-ifeq ($(RUN_ERROR_PRONE),true)
-LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
-endif
diff --git a/core/java.mk b/core/java.mk
index ad9c71f..78b492d 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -72,7 +72,6 @@
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
-full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
@@ -94,7 +93,6 @@
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_turbine_jar) \
$(full_classes_compiled_jar) \
- $(full_classes_desugar_jar) \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(full_classes_combined_jar) \
@@ -229,11 +227,6 @@
# Deps for generated source files must be handled separately,
# via deps on the target that generates the sources.
-# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
-ifeq ($(RUN_ERROR_PRONE),true)
-LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
-endif
-
# For user / userdebug builds, strip the local variable table and the local variable
# type table. This has no bearing on stack traces, but will leave less information
# available via JDWP.
@@ -376,23 +369,7 @@
LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
endif
-ifneq ($(USE_D8_DESUGAR),true)
-my_desugaring :=
-ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
-my_desugaring := true
-$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(LOCAL_FULL_CLASSES_JACOCO_JAR) $(full_java_header_libs) $(DESUGAR)
- $(desugar-classes-jar)
-endif
-else
-my_desugaring :=
-endif
-
-ifndef my_desugaring
-full_classes_desugar_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
-endif
-
-full_classes_pre_proguard_jar := $(full_classes_desugar_jar)
+full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
# Keep a copy of the jar just before proguard processing.
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
@@ -444,7 +421,7 @@
common_proguard_flags += -dontshrink # don't shrink tests by default
endif # test package
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
- ifdef LOCAL_USE_AAPT2
+ ifeq ($(LOCAL_USE_AAPT2),true)
common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
endif
@@ -556,18 +533,14 @@
$(built_dex_intermediate): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
$(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
$(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
-$(built_dex_intermediate) : $(full_classes_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD)
+$(built_dex_intermediate) : $(full_classes_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD)
$(transform-jar-to-dex-r8)
endif # LOCAL_USE_R8
endif # LOCAL_PROGUARD_ENABLED
ifndef my_r8
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
-ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
-else
- $(transform-classes-d8.jar-to-dex)
-endif
endif
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
diff --git a/core/java_common.mk b/core/java_common.mk
index 2695aff..486f087 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -193,16 +193,25 @@
annotation_processor_flags :=
annotation_processor_deps :=
+annotation_processor_jars :=
+
+# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
+ifeq ($(RUN_ERROR_PRONE),true)
+annotation_processor_jars += $(ERROR_PRONE_JARS)
+LOCAL_JAVACFLAGS += $(ERROR_PRONE_FLAGS)
+LOCAL_JAVACFLAGS += '-Xplugin:ErrorProne $(ERROR_PRONE_CHECKS) $(LOCAL_ERROR_PRONE_FLAGS)'
+endif
ifdef LOCAL_ANNOTATION_PROCESSORS
- annotation_processor_jars := $(call java-lib-files,$(LOCAL_ANNOTATION_PROCESSORS),true)
- annotation_processor_flags += -processorpath $(call normalize-path-list,$(annotation_processor_jars))
- annotation_processor_deps += $(annotation_processor_jars)
+ annotation_processor_jars += $(call java-lib-files,$(LOCAL_ANNOTATION_PROCESSORS),true)
# b/25860419: annotation processors must be explicitly specified for grok
annotation_processor_flags += $(foreach class,$(LOCAL_ANNOTATION_PROCESSOR_CLASSES),-processor $(class))
+endif
- annotation_processor_jars :=
+ifneq (,$(strip $(annotation_processor_jars)))
+annotation_processor_flags += -processorpath $(call normalize-path-list,$(annotation_processor_jars))
+annotation_processor_deps += $(annotation_processor_jars)
endif
full_static_java_libs := $(call java-lib-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
@@ -237,6 +246,8 @@
full_java_bootclasspath_libs :=
empty_bootclasspath :=
my_system_modules :=
+exported_sdk_libs_files :=
+my_exported_sdk_libs_file :=
ifndef LOCAL_IS_HOST_MODULE
sdk_libs :=
@@ -259,9 +270,13 @@
LOCAL_JAVA_LIBRARIES := $(filter-out $(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES),$(LOCAL_JAVA_LIBRARIES))
my_system_modules := $(DEFAULT_SYSTEM_MODULES)
endif # LOCAL_NO_STANDARD_LIBRARIES
- # When SDK libraries are referenced from modules built without SDK, provide the system stub to them
- # because it has the largest API surface.
- sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(lib_name).stubs.system)
+
+ ifneq (,$(TARGET_BUILD_APPS))
+ sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,system_current,$(lib_name)))
+ else
+ # When SDK libraries are referenced from modules built without SDK, provide the all APIs to them
+ sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(lib_name).impl)
+ endif
else
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
$(call pretty-error,Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
@@ -322,6 +337,14 @@
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE))
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE))
sdk_libs :=
+
+ # Files that contains the names of SDK libraries exported from dependencies. These will be re-exported.
+ # Note: No need to consider LOCAL_*_ANDROID_LIBRARIES and LOCAL_STATIC_JAVA_AAR_LIBRARIES. They are all appended to
+ # LOCAL_*_JAVA_LIBRARIES in java.mk
+ exported_sdk_libs_files := $(call exported-sdk-libs-files,$(LOCAL_JAVA_LIBRARIES) $(LOCAL_STATIC_JAVA_LIBRARIES))
+ # The file that contains the names of all SDK libraries that this module exports and re-exports
+ my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
+
else # LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
@@ -358,6 +381,22 @@
endif # USE_CORE_LIB_BOOTCLASSPATH
endif # !LOCAL_IS_HOST_MODULE
+
+# Export the SDK libs. The sdk library names listed in LOCAL_SDK_LIBRARIES are first exported.
+# Then sdk library names exported from dependencies are all re-exported.
+$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS_FILES := $(exported_sdk_libs_files)
+$(my_exported_sdk_libs_file): PRIVATE_SDK_LIBS := $(sort $(LOCAL_SDK_LIBRARIES))
+$(my_exported_sdk_libs_file): $(exported_sdk_libs_files)
+ @echo "Export SDK libs $@"
+ $(hide) mkdir -p $(dir $@) && rm -f $@ $@.temp
+ $(if $(PRIVATE_SDK_LIBS),\
+ echo $(PRIVATE_SDK_LIBS) | tr ' ' '\n' > $@.temp,\
+ touch $@.temp)
+ $(if $(PRIVATE_EXPORTED_SDK_LIBS_FILES),\
+ cat $(PRIVATE_EXPORTED_SDK_LIBS_FILES) >> $@.temp)
+ $(hide) cat $@.temp | sort -u > $@
+ $(hide) rm -f $@.temp
+
ifdef empty_bootclasspath
ifdef full_java_bootclasspath_libs
$(call pretty-error,internal error: empty_bootclasspath and full_java_bootclasspath_libs should not both be set)
@@ -477,7 +516,7 @@
ifdef LOCAL_AAPT2_ONLY
my_link_type += aapt2_only
endif
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
my_allowed_types += aapt2_only
endif
diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk
index 191b3be..d7dd4ed 100644
--- a/core/java_renderscript.mk
+++ b/core/java_renderscript.mk
@@ -75,7 +75,7 @@
$(rs_generated_src_jar): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(rs_generated_src_jar): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
$(rs_generated_src_jar): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
-$(rs_generated_src_jar): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
+$(rs_generated_src_jar): PRIVATE_RS_TARGET_API := $(patsubst current,0,$(renderscript_target_api))
$(rs_generated_src_jar): PRIVATE_DEP_FILES := $(bc_dep_files)
$(rs_generated_src_jar): PRIVATE_RS_OUTPUT_RES_ZIP := $(rs_generated_res_zip)
$(rs_generated_src_jar): .KATI_IMPLICIT_OUTPUTS := $(rs_generated_res_zip)
diff --git a/core/main.mk b/core/main.mk
index 2ef17a2..c440f55 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -229,6 +229,8 @@
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
endif
+ADDITIONAL_BUILD_PROPERTIES += ro.boot.logical_partitions=${USE_LOGICAL_PARTITIONS}
+
# -----------------------------------------------------------------
###
### In this section we set up the things that are different
@@ -414,10 +416,6 @@
# would have been with a normal make.
CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS)))
FULL_BUILD :=
-# Stub out the notice targets, which probably aren't defined
-# when using ONE_SHOT_MAKEFILE.
-NOTICE-HOST-%: ;
-NOTICE-TARGET-%: ;
# A helper goal printing out install paths
define register_module_install_path
@@ -887,47 +885,40 @@
# $(2): The initial module name list.
# Returns empty string (maybe with some whitespaces).
define expand-required-modules
-$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
- $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
+$(eval _erm_req := $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED))) \
+$(eval _erm_new_modules := $(sort $(filter-out $($(1)),$(_erm_req))))\
$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
$(call expand-required-modules,$(1),$(_erm_new_modules)))
endef
+# Determines the files a particular product installs.
+# The base list of modules to build for this product is specified
+# by the appropriate product definition file, which was included
+# by product_config.mk.
+# $(1): product makefile
+define product-installed-files
+ $(eval _pif_modules := $(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGES)) \
+ $(if $(BOARD_VNDK_VERSION),$(eval _pif_modules += vndk_package)) \
+ $(eval ### Filter out the overridden packages and executables before doing expansion) \
+ $(eval _pif_overrides := $(foreach p, $(_pif_modules), $(PACKAGES.$(p).OVERRIDES))) \
+ $(eval _pif_overrides += $(foreach m, $(_pif_modules), $(EXECUTABLES.$(m).OVERRIDES))) \
+ $(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \
+ $(eval ### Resolve the :32 :64 module name) \
+ $(eval _pif_modules_32 := $(patsubst %:32,%,$(filter %:32, $(_pif_modules)))) \
+ $(eval _pif_modules_64 := $(patsubst %:64,%,$(filter %:64, $(_pif_modules)))) \
+ $(eval _pif_modules_rest := $(filter-out %:32 %:64,$(_pif_modules))) \
+ $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
+ $(eval _pif_modules := $(call get-32-bit-modules-if-we-can, $(_pif_modules_32))) \
+ $(eval _pif_modules += $(_pif_modules_64)) \
+ $(eval ### For the rest we add both) \
+ $(eval _pif_modules += $(call get-32-bit-modules, $(_pif_modules_rest))) \
+ $(eval _pif_modules += $(_pif_modules_rest)) \
+ $(call expand-required-modules,_pif_modules,$(_pif_modules)) \
+ $(call module-installed-files, $(_pif_modules))
+endef
+
ifdef FULL_BUILD
- # The base list of modules to build for this product is specified
- # by the appropriate product definition file, which was included
- # by product_config.mk.
- product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
-ifdef BOARD_VNDK_VERSION
- product_MODULES += vndk_package
-endif
- # Filter out the overridden packages before doing expansion
- product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
- $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
- # Filter out executables as well
- product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \
- $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES))
-
- # Resolve the :32 :64 module name
- modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
- modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES)))
- modules_rest := $(filter-out %:32 %:64,$(product_MODULES))
- # Note for 32-bit product, $(modules_32) and $(modules_64) will be
- # added as their original module names.
- product_MODULES := $(call get-32-bit-modules-if-we-can, $(modules_32))
- product_MODULES += $(modules_64)
- # For the rest we add both
- product_MODULES += $(call get-32-bit-modules, $(modules_rest))
- product_MODULES += $(modules_rest)
-
- $(call expand-required-modules,product_MODULES,$(product_MODULES))
-
- product_FILES := $(call module-installed-files, $(product_MODULES))
- ifeq (0,1)
- $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
- $(foreach p,$(product_FILES),$(info : $(p)))
- $(error done)
- endif
+ product_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT))
else
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
@@ -936,6 +927,59 @@
product_FILES :=
endif
+# Transforms paths relative to PRODUCT_OUT to absolute paths.
+# $(1): list of relative paths
+# $(2): optional suffix to append to paths
+define resolve-product-relative-paths
+ $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),\
+ $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),\
+ $(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)) \
+ $(eval ### Verify that the product only produces files inside its path requirements.) \
+ $(eval whitelist := $(PRODUCTS.$(makefile).ARTIFACT_PATH_WHITELIST)) \
+ $(eval path_patterns := $(call resolve-product-relative-paths,$(requirements),%)) \
+ $(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \
+ $(eval files := $(call product-installed-files, $(makefile))) \
+ $(eval files := $(filter-out $(TARGET_OUT_FAKE)/% $(HOST_OUT)/%,$(files))) \
+ $(eval offending_files := $(filter-out $(path_patterns) $(whitelist_patterns),$(files))) \
+ $(call maybe-print-list-and-error,$(offending_files),$(makefile) produces files outside its artifact path requirement.) \
+ $(eval unused_whitelist := $(filter-out $(files),$(whitelist_patterns))) \
+ $(call maybe-print-list-and-error,$(unused_whitelist),$(makefile) includes redundant whitelist entries in its artifact path requirement.) \
+ $(eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS),\
+ $(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_FILES))) \
+ $(eval whitelist := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST)) \
+ $(eval whitelist_patterns := $(call resolve-product-relative-paths,$(whitelist))) \
+ $(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \
+ $(eval offending_files := $(filter-out $(whitelist_patterns),$(files_in_requirement))) \
+ $(call maybe-print-list-and-error,$(offending_files),$(INTERNAL_PRODUCT) produces files inside $(makefile)s artifact path requirement.) \
+ $(eval unused_whitelist := $(filter-out $(extra_files),$(whitelist_patterns))) \
+ $(call maybe-print-list-and-error,$(unused_whitelist),$(INTERNAL_PRODUCT) includes redundant artifact path requirement whitelist entries.) \
+ ) \
+)
+
+ifeq (0,1)
+ $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
+ $(foreach p,$(product_FILES),$(info : $(p)))
+ $(error done)
+endif
+
eng_MODULES := $(sort \
$(call get-tagged-modules,eng) \
$(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG)) \
@@ -1111,21 +1155,25 @@
# Build files and then package it into the rom formats
.PHONY: droidcore
droidcore: files \
- systemimage \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_RECOVERYIMAGE_TARGET) \
- $(INSTALLED_VBMETAIMAGE_TARGET) \
- $(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_CACHEIMAGE_TARGET) \
- $(INSTALLED_BPTIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
- $(INSTALLED_FILES_FILE) \
- $(INSTALLED_FILES_FILE_VENDOR) \
- $(INSTALLED_FILES_FILE_PRODUCT) \
- $(INSTALLED_FILES_FILE_SYSTEMOTHER) \
- soong_docs
+ systemimage \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(INSTALLED_VBMETAIMAGE_TARGET) \
+ $(INSTALLED_USERDATAIMAGE_TARGET) \
+ $(INSTALLED_CACHEIMAGE_TARGET) \
+ $(INSTALLED_BPTIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
+ $(INSTALLED_FILES_FILE) \
+ $(INSTALLED_FILES_JSON) \
+ $(INSTALLED_FILES_FILE_VENDOR) \
+ $(INSTALLED_FILES_JSON_VENDOR) \
+ $(INSTALLED_FILES_FILE_PRODUCT) \
+ $(INSTALLED_FILES_JSON_PRODUCT) \
+ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \
+ $(INSTALLED_FILES_JSON_SYSTEMOTHER) \
+ soong_docs
# dist_files only for putting your library into the dist directory with a full build.
.PHONY: dist_files
@@ -1188,9 +1236,13 @@
$(SYMBOLS_ZIP) \
$(COVERAGE_ZIP) \
$(INSTALLED_FILES_FILE) \
+ $(INSTALLED_FILES_JSON) \
$(INSTALLED_FILES_FILE_VENDOR) \
+ $(INSTALLED_FILES_JSON_VENDOR) \
$(INSTALLED_FILES_FILE_PRODUCT) \
+ $(INSTALLED_FILES_JSON_PRODUCT) \
$(INSTALLED_FILES_FILE_SYSTEMOTHER) \
+ $(INSTALLED_FILES_JSON_SYSTEMOTHER) \
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
@@ -1214,11 +1266,41 @@
ifeq ($(EMMA_INSTRUMENT),true)
$(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE)
$(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
+
+ # Put XML formatted API files in the dist dir.
+ api_xmls := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/,api.xml system-api.xml test-api.xml)
+ $(api_xmls): $(TARGET_OUT_COMMON_INTERMEDIATES)/%api.xml : frameworks/base/api/%current.txt $(APICHECK)
+ $(hide) echo "Converting API file to XML: $@"
+ $(hide) mkdir -p $(dir $@)
+ $(hide) $(APICHECK_COMMAND) -convert2xml $< $@
+
+ $(call dist-for-goals, dist_files, $(api_xmls))
+ api_xmls :=
endif
# Building a full system-- the default is to build droidcore
droid_targets: droidcore dist_files
+ifdef USE_LOGICAL_PARTITIONS
+ifdef BOARD_SUPER_PARTITION_SIZE
+ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
+
+droid_targets: check_android_partition_sizes
+
+.PHONY: check_android_partition_sizes
+check_android_partition_sizes: partition_size_list=$(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST),$(BOARD_$(call to-upper,$(p))IMAGE_PARTITION_SIZE))
+check_android_partition_sizes: sum_sizes_expr=$(subst $(space),+,$(partition_size_list))
+check_android_partition_sizes:
+ if [ $$(( $(sum_sizes_expr) )) -gt $(BOARD_SUPER_PARTITION_SIZE) ]; then \
+ echo The sum of sizes of all logical partitions is larger than BOARD_SUPER_PARTITION_SIZE.; \
+ echo $(sum_sizes_expr) == $$(( $(sum_sizes_expr) )) '>' $(BOARD_SUPER_PARTITION_SIZE); \
+ exit 1; \
+ fi
+
+endif # BOARD_SUPER_PARTITION_PARTITION_LIST
+endif # BOARD_SUPER_PARTITION_SIZE
+endif # USE_LOGICAL_PARTITIONS
+
endif # TARGET_BUILD_APPS
.PHONY: docs
diff --git a/core/math.mk b/core/math.mk
index 44e03ce..ac3151e 100644
--- a/core/math.mk
+++ b/core/math.mk
@@ -15,44 +15,104 @@
#
###########################################################
-# Basic math functions for positive integers <= 100
+# Basic math functions for non-negative integers <= 100
#
# (SDK versions for example)
###########################################################
-__MATH_NUMBERS := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
- 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
- 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
- 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
- 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
+__MATH_POS_NUMBERS := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
+ 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
+ 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
+ 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
+ 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
+__MATH_NUMBERS := 0 $(__MATH_POS_NUMBERS)
-# Returns true if $(1) is a positive integer <= 100, otherwise returns nothing.
+math-error = $(call pretty-error,$(1))
+math-expect :=
+math-expect-true :=
+math-expect :=
+math-expect-error :=
+
+# Run the math tests with:
+# make -f ${ANDROID_BUILD_TOP}/build/make/core/math.mk RUN_MATH_TESTS=true
+# $(get_build_var CKATI) -f ${ANDROID_BUILD_TOP}//build/make/core/math.mk RUN_MATH_TESTS=true
+ifdef RUN_MATH_TESTS
+ MATH_TEST_FAILURE :=
+ MATH_TEST_ERROR :=
+ math-error = $(if $(MATH_TEST_ERROR),,$(eval MATH_TEST_ERROR:=$(1)))
+ define math-expect
+ $(eval got:=$$$1) \
+ $(if $(subst $(got),,$(2))$(subst $(2),,$(got))$(MATH_TEST_ERROR), \
+ $(if $(MATH_TEST_ERROR),$(warning $(MATH_TEST_ERROR)),$(warning $$$1 '$(got)' != '$(2)')) \
+ $(eval MATH_TEST_FAILURE := true)) \
+ $(eval MATH_TEST_ERROR :=) \
+ $(eval got:=)
+ endef
+ math-expect-true = $(call math-expect,$(1),true)
+ math-expect-false = $(call math-expect,$(1),)
+
+ define math-expect-error
+ $(eval got:=$$$1) \
+ $(if $(subst $(MATH_TEST_ERROR),,$(2))$(subst $(2),,$(MATH_TEST_ERROR)), \
+ $(warning '$(MATH_TEST_ERROR)' != '$(2)') \
+ $(eval MATH_TEST_FAILURE := true)) \
+ $(eval MATH_TEST_ERROR :=) \
+ $(eval got:=)
+ endef
+endif
+
+# Returns true if $(1) is a non-negative integer <= 100, otherwise returns nothing.
define math_is_number
$(strip \
- $(if $(1),,$(error Argument missing)) \
- $(if $(word 2,$(1)),$(error Multiple words in a single argument: $(1))) \
+ $(if $(1),,$(call math-error,Argument missing)) \
+ $(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
$(if $(filter $(1),$(__MATH_NUMBERS)),true))
endef
-#$(warning true == $(call math_is_number,2))
-#$(warning == $(call math_is_number,foo))
-#$(call math_is_number,1 2)
-#$(call math_is_number,no 2)
+define math_is_zero
+$(strip \
+ $(if $(word 2,$(1)),$(call math-error,Multiple words in a single argument: $(1))) \
+ $(if $(filter 0,$(1)),true))
+endef
+
+$(call math-expect-true,(call math_is_number,0))
+$(call math-expect-true,(call math_is_number,2))
+$(call math-expect-false,(call math_is_number,foo))
+$(call math-expect-false,(call math_is_number,-1))
+$(call math-expect-error,(call math_is_number,1 2),Multiple words in a single argument: 1 2)
+$(call math-expect-error,(call math_is_number,no 2),Multiple words in a single argument: no 2)
+
+$(call math-expect-true,(call math_is_zero,0))
+$(call math-expect-false,(call math_is_zero,1))
+$(call math-expect-false,(call math_is_zero,foo))
+$(call math-expect-error,(call math_is_zero,1 2),Multiple words in a single argument: 1 2)
+$(call math-expect-error,(call math_is_zero,no 2),Multiple words in a single argument: no 2)
define _math_check_valid
-$(if $(call math_is_number,$(1)),,$(error Only positive integers <= 100 are supported (not $(1))))
+$(if $(call math_is_number,$(1)),,$(call math-error,Only non-negative integers <= 100 are supported (not $(1))))
endef
+$(call math-expect,(call _math_check_valid,0))
+$(call math-expect,(call _math_check_valid,1))
+$(call math-expect,(call _math_check_valid,100))
+$(call math-expect-error,(call _math_check_valid,-1),Only non-negative integers <= 100 are supported (not -1))
+$(call math-expect-error,(call _math_check_valid,101),Only non-negative integers <= 100 are supported (not 101))
+$(call math-expect-error,(call _math_check_valid,),Argument missing)
+$(call math-expect-error,(call _math_check_valid,1 2),Multiple words in a single argument: 1 2)
+
# return a list containing integers ranging from [$(1),$(2)]
define int_range_list
-$(call _math_check_valid,$(1))$(call _math_check_valid,$(2))$(wordlist $(1),$(2),$(__MATH_NUMBERS))
+$(strip \
+ $(call _math_check_valid,$(1))$(call _math_check_valid,$(2)) \
+ $(if $(call math_is_zero,$(1)),0)\
+ $(wordlist $(if $(call math_is_zero,$(1)),1,$(1)),$(2),$(__MATH_POS_NUMBERS)))
endef
-#$(call _math_check_valid,0)
-#$(call _math_check_valid,1)
-#$(call _math_check_valid,100)
-#$(call _math_check_valid,101)
-#$(call _math_check_valid,)
-#$(call _math_check_valid,1 2)
+$(call math-expect,(call int_range_list,0,1),0 1)
+$(call math-expect,(call int_range_list,1,1),1)
+$(call math-expect,(call int_range_list,1,2),1 2)
+$(call math-expect,(call int_range_list,2,1),)
+$(call math-expect-error,(call int_range_list,1,101),Only non-negative integers <= 100 are supported (not 101))
+
# Returns the greater of $1 or $2.
# If $1 or $2 is not a positive integer <= 100, then an error is generated.
@@ -61,12 +121,14 @@
$(lastword $(filter $(1) $(2),$(__MATH_NUMBERS))))
endef
-#$(call math_max)
-#$(call math_max,1)
-#$(call math_max,1 2,3)
-#$(warning 1 == $(call math_max,1,1))
-#$(warning 42 == $(call math_max,5,42))
-#$(warning 42 == $(call math_max,42,5))
+$(call math-expect-error,(call math_max),Argument missing)
+$(call math-expect-error,(call math_max,1),Argument missing)
+$(call math-expect-error,(call math_max,1 2,3),Multiple words in a single argument: 1 2)
+$(call math-expect,(call math_max,0,1),1)
+$(call math-expect,(call math_max,1,0),1)
+$(call math-expect,(call math_max,1,1),1)
+$(call math-expect,(call math_max,5,42),42)
+$(call math-expect,(call math_max,42,5),42)
define math_gt_or_eq
$(if $(filter $(1),$(call math_max,$(1),$(2))),true)
@@ -76,15 +138,23 @@
$(if $(call math_gt_or_eq,$(1),$(2)),,true)
endef
-#$(warning $(call math_gt_or_eq, 2, 1))
-#$(warning $(call math_gt_or_eq, 1, 1))
-#$(warning $(if $(call math_gt_or_eq, 1, 2),false,true))
+$(call math-expect-true,(call math_gt_or_eq, 2, 1))
+$(call math-expect-true,(call math_gt_or_eq, 1, 1))
+$(call math-expect-false,(call math_gt_or_eq, 1, 2))
# $1 is the variable name to increment
define inc_and_print
$(strip $(eval $(1) := $($(1)) .)$(words $($(1))))
endef
+ifdef RUN_MATH_TESTS
+a :=
+$(call math-expect,(call inc_and_print,a),1)
+$(call math-expect,(call inc_and_print,a),2)
+$(call math-expect,(call inc_and_print,a),3)
+$(call math-expect,(call inc_and_print,a),4)
+endif
+
# Returns the words in $2 that are numbers and are less than $1
define numbers_less_than
$(strip \
@@ -94,12 +164,19 @@
$(n)))))
endef
+$(call math-expect,(call numbers_less_than,0,0 1 2 3),)
+$(call math-expect,(call numbers_less_than,1,0 2 1 3),0)
+$(call math-expect,(call numbers_less_than,2,0 2 1 3),0 1)
+$(call math-expect,(call numbers_less_than,3,0 2 1 3),0 2 1)
+$(call math-expect,(call numbers_less_than,4,0 2 1 3),0 2 1 3)
+$(call math-expect,(call numbers_less_than,3,0 2 1 3 2),0 2 1 2)
+
_INT_LIMIT_WORDS := $(foreach a,x x,$(foreach b,x x x x x x x x x x x x x x x x,\
$(foreach c,x x x x x x x x x x x x x x x x,x x x x x x x x x x x x x x x x)))
define _int_encode
$(if $(filter $(words x $(_INT_LIMIT_WORDS)),$(words $(wordlist 1,$(1),x $(_INT_LIMIT_WORDS)))),\
- $(call pretty-error,integer greater than $(words $(_INT_LIMIT_WORDS)) is not supported!),\
+ $(call math-error,integer greater than $(words $(_INT_LIMIT_WORDS)) is not supported!),\
$(wordlist 1,$(1),$(_INT_LIMIT_WORDS)))
endef
@@ -135,18 +212,59 @@
$(words $(call _int_encode,$(1)) $(call _int_encode,$(2)))
endef
+$(call math-expect,(call int_plus,0,0),0)
+$(call math-expect,(call int_plus,0,1),1)
+$(call math-expect,(call int_plus,1,0),1)
+$(call math-expect,(call int_plus,1,100),101)
+$(call math-expect,(call int_plus,100,100),200)
+
define int_subtract
-$(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))),\
+$(strip \
+ $(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))),\
$(words $(filter-out xx,$(join $(call _int_encode,$(1)),$(call _int_encode,$(2))))),\
- $(call pretty-error,$(1) subtract underflow $(2)))
+ $(call math-error,subtract underflow $(1) - $(2))))
endef
+$(call math-expect,(call int_subtract,0,0),0)
+$(call math-expect,(call int_subtract,1,0),1)
+$(call math-expect,(call int_subtract,1,1),0)
+$(call math-expect,(call int_subtract,100,1),99)
+$(call math-expect,(call int_subtract,200,100),100)
+$(call math-expect-error,(call int_subtract,0,1),subtract underflow 0 - 1)
+
define int_multiply
$(words $(foreach a,$(call _int_encode,$(1)),$(call _int_encode,$(2))))
endef
+$(call math-expect,(call int_multiply,0,0),0)
+$(call math-expect,(call int_multiply,1,0),0)
+$(call math-expect,(call int_multiply,1,1),1)
+$(call math-expect,(call int_multiply,100,1),100)
+$(call math-expect,(call int_multiply,1,100),100)
+$(call math-expect,(call int_multiply,4,100),400)
+$(call math-expect,(call int_multiply,100,4),400)
+
define int_divide
-$(if $(filter 0,$(2)),$(call pretty-error,division by zero is not allowed!),$(strip \
+$(if $(filter 0,$(2)),$(call math-error,division by zero is not allowed!),$(strip \
$(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))), \
$(call int_plus,$(call int_divide,$(call int_subtract,$(1),$(2)),$(2)),1),0)))
endef
+
+$(call math-expect,(call int_divide,1,1),1)
+$(call math-expect,(call int_divide,200,1),200)
+$(call math-expect,(call int_divide,200,3),66)
+$(call math-expect,(call int_divide,1,2),0)
+$(call math-expect-error,(call int_divide,0,0),division by zero is not allowed!)
+$(call math-expect-error,(call int_divide,1,0),division by zero is not allowed!)
+
+ifdef RUN_MATH_TESTS
+ ifdef MATH_TEST_FAILURE
+ math-tests:
+ @echo FAIL
+ @false
+ else
+ math-tests:
+ @echo PASS
+ endif
+ .PHONY: math-tests
+endif
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 9dce2b3..08778c5 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -40,6 +40,10 @@
ifdef notice_file
+ifdef my_register_name
+ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
+endif
+
# This relies on the name of the directory in PRODUCT_OUT matching where
# it's installed on the target - i.e. system, data, etc. This does
# not work for root and isn't exact, but it's probably good enough for
diff --git a/core/pack_dyn_relocs_setup.mk b/core/pack_dyn_relocs_setup.mk
new file mode 100644
index 0000000..2147f44
--- /dev/null
+++ b/core/pack_dyn_relocs_setup.mk
@@ -0,0 +1,33 @@
+#############################################################
+## Set up my_pack_module_relocations
+## Input variables:
+## DISABLE_RELOCATION_PACKER,
+## LOCAL_PACK_MODULE_RELOCATIONS*,
+## *TARGET_PACK_MODULE_RELOCATIONS,
+## LOCAL_MODULE_CLASS, HOST_OS
+## Output variables:
+## my_pack_module_relocations, if false skip relocation_packer
+#############################################################
+
+my_pack_module_relocations := false
+ifneq ($(DISABLE_RELOCATION_PACKER),true)
+ my_pack_module_relocations := $(firstword \
+ $(LOCAL_PACK_MODULE_RELOCATIONS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
+ $(LOCAL_PACK_MODULE_RELOCATIONS))
+endif
+
+ifeq ($(my_pack_module_relocations),)
+ my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
+endif
+
+# Do not pack relocations for executables. Because packing results in
+# non-zero p_vaddr which causes kernel to load executables to lower
+# address (starting at 0x8000) http://b/20665974
+ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
+ my_pack_module_relocations := false
+endif
+
+# TODO (dimitry): Relocation packer is not yet available for darwin
+ifneq ($(HOST_OS),linux)
+ my_pack_module_relocations := false
+endif
diff --git a/core/package_internal.mk b/core/package_internal.mk
index ac4b53c..637a135 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -87,6 +87,11 @@
LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d)))
endif
+include $(BUILD_SYSTEM)/force_aapt2.mk
+
+# Process Support Library dependencies.
+include $(BUILD_SYSTEM)/support_libraries.mk
+
package_resource_overlays := $(strip \
$(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
@@ -153,13 +158,13 @@
endif
my_res_package :=
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
# In aapt2 the last takes precedence.
my_resource_dirs := $(call reverse-list,$(LOCAL_RESOURCE_DIR))
my_res_dir :=
my_overlay_res_dirs :=
-ifneq ($(LOCAL_STATIC_ANDROID_LIBRARIES),)
+ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
# If we are using static android libraries, every source file becomes an overlay.
# This is to emulate old AAPT behavior which simulated library support.
my_res_dir :=
@@ -354,9 +359,9 @@
###############################
## AAPT/AAPT2
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
- ifneq (,$(renderscript_target_api))
+ ifneq (,$(filter-out current,$(renderscript_target_api)))
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
my_generated_res_zips := $(rs_generated_res_zip)
endif # renderscript_target_api < 21
@@ -411,7 +416,7 @@
$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
- $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
+ $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT)
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
@@ -506,7 +511,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
$(my_res_package) : $(all_library_res_package_export_deps)
endif
@@ -590,7 +595,7 @@
$(LOCAL_BUILT_MODULE): PRIVATE_FULL_CLASSES_JAR := $(full_classes_jar)
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE) : $(JAR_ARGS)
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
else
@@ -601,7 +606,7 @@
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
endif
@echo "target Package: $(PRIVATE_MODULE) ($@)"
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
$(call copy-file-to-new-target)
else # ! LOCAL_USE_AAPT2
$(if $(PRIVATE_SOURCE_ARCHIVE),\
@@ -617,7 +622,7 @@
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else # full_classes_jar
$(add-dex-to-package)
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
$(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
endif
endif # full_classes_jar
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 8aa5b96..d5b7877 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -508,10 +508,13 @@
endif # LOCAL_DEX_PREOPT
else # ! prebuilt_module_is_dex_javalib
+ifneq ($(filter init%rc,$(notdir $(LOCAL_INSTALLED_MODULE)))$(filter %/etc/init,$(dir $(LOCAL_INSTALLED_MODULE))),)
+ $(eval $(call copy-init-script-file-checked,$(my_prebuilt_src_file),$(built_module)))
+else ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(built_module) : $(my_prebuilt_src_file)
-ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(transform-prebuilt-to-target-strip-comments)
else
+$(built_module) : $(my_prebuilt_src_file)
$(transform-prebuilt-to-target)
endif
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
@@ -581,15 +584,23 @@
# This is .aar file, archive of classes.jar and Android resources.
my_src_jar := $(intermediates.COMMON)/aar/classes.jar
my_src_proguard_options := $(intermediates.COMMON)/aar/proguard.txt
+my_src_android_manifest := $(intermediates.COMMON)/aar/AndroidManifest.xml
$(my_src_jar) : .KATI_IMPLICIT_OUTPUTS := $(my_src_proguard_options)
+$(my_src_jar) : .KATI_IMPLICIT_OUTPUTS += $(my_src_android_manifest)
$(my_src_jar) : $(my_src_aar)
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(dir $@)/res
$(hide) unzip -qo -d $(dir $@) $<
# Make sure the extracted classes.jar has a new timestamp.
$(hide) touch $@
- # Make sure the proguard file exists and has a new timestamp.
+ # Make sure the proguard and AndroidManifest.xml files exist
+ # and have a new timestamp.
$(hide) touch $(dir $@)/proguard.txt
+ $(hide) touch $(dir $@)/AndroidManifest.xml
+
+my_prebuilt_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
+$(eval $(call copy-one-file,$(my_src_android_manifest),$(my_prebuilt_android_manifest)))
+$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_prebuilt_android_manifest))
endif
@@ -607,11 +618,13 @@
$(common_javalib_jar) : $(common_classes_jar)
$(transform-prebuilt-to-target)
+include $(BUILD_SYSTEM)/force_aapt2.mk
+
ifdef LOCAL_AAPT2_ONLY
LOCAL_USE_AAPT2 := true
endif
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
ifneq ($(my_src_aar),)
$(intermediates.COMMON)/export_proguard_flags : $(my_src_proguard_options)
@@ -639,7 +652,7 @@
# We needed only very few PRIVATE variables and aapt2.mk input variables. Reset the unnecessary ones.
$(my_res_package): PRIVATE_AAPT2_CFLAGS :=
$(my_res_package): PRIVATE_AAPT_FLAGS := --static-lib --no-static-lib-packages --auto-add-overlay
-$(my_res_package): PRIVATE_ANDROID_MANIFEST := $(intermediates.COMMON)/aar/AndroidManifest.xml
+$(my_res_package): PRIVATE_ANDROID_MANIFEST := $(my_src_android_manifest)
$(my_res_package): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
$(my_res_package): PRIVATE_SOURCE_INTERMEDIATES_DIR :=
$(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE :=
@@ -649,6 +662,7 @@
$(my_res_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS :=
$(my_res_package) : $(framework_res_package_export)
+$(my_res_package) : $(my_src_android_manifest)
full_android_manifest :=
my_res_resources :=
@@ -667,6 +681,15 @@
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar)
+my_exported_sdk_libs_file := $(intermediates.COMMON)/exported-sdk-libs
+$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS := $(LOCAL_EXPORT_SDK_LIBRARIES)
+$(my_exported_sdk_libs_file):
+ @echo "Export SDK libs $@"
+ $(hide) mkdir -p $(dir $@) && rm -f $@
+ $(if $(PRIATE_EXPORTED_SDK_LIBS),\
+ $(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
+ $(hide) touch $@)
+
endif # ! prebuilt_module_is_dex_javalib
endif # LOCAL_IS_HOST_MODULE is not set
diff --git a/core/product-graph.mk b/core/product-graph.mk
index 576d14d..4133bd9 100644
--- a/core/product-graph.mk
+++ b/core/product-graph.mk
@@ -18,7 +18,7 @@
define gather-all-products
$(sort $(foreach p, \
$(eval _all_products_visited := )
- $(call all-products-inner, $(ALL_PRODUCTS)) \
+ $(call all-products-inner, $(PARENT_PRODUCT_FILES)) \
, $(if $(strip $(p)),$(strip $(p)),)) \
)
endef
@@ -49,7 +49,7 @@
endif
endif
-really_all_products := $(call gather-all-products)
+all_products := $(call gather-all-products)
open_parethesis := (
close_parenthesis := )
@@ -66,7 +66,7 @@
endef
-$(products_graph): PRIVATE_PRODUCTS := $(really_all_products)
+$(products_graph): PRIVATE_PRODUCTS := $(all_products)
$(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list)
$(products_graph): $(this_makefile)
@@ -130,7 +130,7 @@
endef
product_debug_files:=
-$(foreach p,$(really_all_products), \
+$(foreach p,$(all_products), \
$(eval $(call transform-product-debug, $(p))) \
$(eval product_debug_files += $(call product-debug-filename, $(p))) \
)
diff --git a/core/product.mk b/core/product.mk
index 976c939..375fb72 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -197,6 +197,9 @@
PRODUCT_CFI_EXCLUDE_PATHS \
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \
+ PRODUCT_USE_LOGICAL_PARTITIONS \
+ PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \
+ PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST \
define dump-product
$(info ==== $(1) ====)\
@@ -212,10 +215,14 @@
#
# $(1): product to inherit
#
-# Does three things:
+# To be called from product makefiles, and is later evaluated during the import-nodes
+# call below. It does three things:
# 1. Inherits all of the variables from $1.
# 2. Records the inheritance in the .INHERITS_FROM variable
-# 3. Records that we've visited this node, in ALL_PRODUCTS
+# 3. Records the calling makefile in PARENT_PRODUCT_FILES
+#
+# (2) and (3) can be used together to reconstruct the include hierarchy
+# See e.g. product-graph.mk for an example of this.
#
define inherit-product
$(if $(findstring ../,$(1)),\
@@ -223,13 +230,22 @@
$(eval np := $(strip $(1))))\
$(foreach v,$(_product_var_list), \
$(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
- $(eval inherit_var := \
- PRODUCTS.$(strip $(word 1,$(_include_stack))).INHERITS_FROM) \
+ $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
+ $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
$(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
- $(eval inherit_var:=) \
- $(eval ALL_PRODUCTS := $(sort $(ALL_PRODUCTS) $(word 1,$(_include_stack))))
+ $(eval PARENT_PRODUCT_FILES := $(sort $(PARENT_PRODUCT_FILES) $(current_mk)))
endef
+# Specifies a number of path prefixes, relative to PRODUCT_OUT, where the
+# product makefile hierarchy rooted in the current node places its artifacts.
+# Creating artifacts outside the specified paths will cause a build-time error.
+define require-artifacts-in-path
+ $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
+ $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENTS := $(strip $(1))) \
+ $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_WHITELIST := $(strip $(2))) \
+ $(eval ARTIFACT_PATH_REQUIREMENT_PRODUCTS := \
+ $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
+endef
#
# Do inherit-product only if $(1) exists
@@ -360,6 +376,13 @@
WITH_DEXPREOPT \
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY
+# Logical partitions related variables.
+_product_stash_var_list += \
+ BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \
+ BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
+ BOARD_SUPER_PARTITION_SIZE \
+ BOARD_SUPER_PARTITION_PARTITION_LIST \
+
#
# Mark the variables in _product_stash_var_list as readonly
#
diff --git a/core/product_config.mk b/core/product_config.mk
index 6449b9f..8425b09 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -234,6 +234,12 @@
$(call import-products, $(current_product_makefile))
endif # Import all or just the current product makefile
+# Import all the products that have made artifact path requirements, so that we can verify
+# the artifacts they produce.
+$(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
+ $(if $(filter-out $(makefile),$(PRODUCTS)),$(eval $(call import-products,$(makefile))))\
+)
+
# Sanity check
$(check-all-products)
@@ -500,3 +506,8 @@
# Whether the whitelist of actionable compatible properties should be disabled or not
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE))
+
+# Logical and Resizable Partitions feature flag.
+PRODUCT_USE_LOGICAL_PARTITIONS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_LOGICAL_PARTITIONS))
+.KATI_READONLY := PRODUCT_USE_LOGICAL_PARTITIONS
diff --git a/core/project_definitions.mk b/core/project_definitions.mk
new file mode 100644
index 0000000..5728b67
--- /dev/null
+++ b/core/project_definitions.mk
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+#
+# Allow projects to define their own globally-available variables.
+#
+
+#
+# Include definitions for prebuilt SDK, if present.
+#
+-include prebuilts/sdk/current/definitions.mk
diff --git a/core/setup_one_odex.mk b/core/setup_one_odex.mk
index e0d9926..92f58b2 100644
--- a/core/setup_one_odex.mk
+++ b/core/setup_one_odex.mk
@@ -25,17 +25,85 @@
my_dex_preopt_image_location := $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)
endif
my_dex_preopt_image_filename := $(call get-image-file-path,$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location))
+
+# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
+# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
+ifeq (,$(LOCAL_ENFORCE_USES_LIBRARIES))
+# Will change the default to true unconditionally in the future.
+ifneq (,$(LOCAL_OPTIONAL_USES_LIBRARIES))
+LOCAL_ENFORCE_USES_LIBRARIES := true
+endif
+ifneq (,$(LOCAL_USES_LIBRARIES))
+LOCAL_ENFORCE_USES_LIBRARIES := true
+endif
+endif
+
+my_uses_libraries := $(LOCAL_USES_LIBRARIES)
+my_optional_uses_libraries := $(LOCAL_OPTIONAL_USES_LIBRARIES)
+my_missing_uses_libraries := $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES)
+
+# If we have either optional or required uses-libraries, set up the class loader context
+# accordingly.
+my_lib_names :=
+my_optional_lib_names :=
+my_filtered_optional_uses_libraries :=
+my_system_dependencies :=
+my_stored_preopt_class_loader_context_libs :=
+my_conditional_uses_libraries_host :=
+my_conditional_uses_libraries_target :=
+
+ifneq (true,$(LOCAL_ENFORCE_USES_LIBRARIES))
+ # Pass special class loader context to skip the classpath and collision check.
+ # This will get removed once LOCAL_USES_LIBRARIES is enforced.
+ # Right now LOCAL_USES_LIBRARIES is opt in, for the case where it's not specified we still default
+ # to the &.
+ my_dex_preopt_class_loader_context := \&
+else
+ # Compute the filtered optional uses libraries by removing ones that are not supposed to exist.
+ my_filtered_optional_uses_libraries := \
+ $(filter-out $(my_missing_uses_libraries), $(my_optional_uses_libraries))
+ my_filtered_uses_libraries := $(my_uses_libraries) $(my_filtered_optional_uses_libraries)
+
+ # These are the ones we are verifying in the make rule, use the unfiltered libraries.
+ my_lib_names := $(my_uses_libraries)
+ my_optional_lib_names := $(my_optional_uses_libraries)
+
+ # Calculate system build dependencies based on the filtered libraries.
+ my_intermediate_libs := $(foreach lib_name, $(my_lib_names) $(my_filtered_optional_uses_libraries), \
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib_name),,COMMON)/javalib.jar)
+ my_dex_preopt_system_dependencies := $(my_intermediate_libs)
+ my_dex_preopt_class_loader_context := $(call normalize-path-list,$(my_intermediate_libs))
+
+ # The class loader context checksums are filled in by dex2oat.
+ my_stored_preopt_class_loader_context_libs := $(call normalize-path-list, \
+ $(foreach lib_name,$(my_filtered_uses_libraries),/system/framework/$(lib_name).jar))
+
+ # Fix up org.apache.http.legacy.impl since it should be org.apache.http.legacy in the manifest.
+ my_lib_names := $(patsubst org.apache.http.legacy.impl,org.apache.http.legacy,$(my_lib_names))
+ my_optional_lib_names := $(patsubst org.apache.http.legacy.impl,org.apache.http.legacy,$(my_optional_lib_names))
+ ifeq (,$(filter org.apache.http.legacy,$(my_lib_names) $(my_optional_lib_names)))
+ my_conditional_uses_libraries_host := $(call intermediates-dir-for,JAVA_LIBRARIES,org.apache.http.legacy.impl,,COMMON)/javalib.jar
+ my_conditional_uses_libraries_target := /system/framework/org.apache.http.legacy.impl.jar
+ endif
+endif
+
+$(my_built_odex): $(AAPT)
+$(my_built_odex): $(my_conditional_uses_libraries_host)
+$(my_built_odex): $(my_dex_preopt_system_dependencies)
+$(my_built_odex): PRIVATE_ENFORCE_USES_LIBRARIES := $(LOCAL_ENFORCE_USES_LIBRARIES)
+$(my_built_odex): PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST := $(my_conditional_uses_libraries_host)
+$(my_built_odex): PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET := $(my_conditional_uses_libraries_target)
+$(my_built_odex): PRIVATE_USES_LIBRARY_NAMES := $(my_lib_names)
+$(my_built_odex): PRIVATE_OPTIONAL_USES_LIBRARY_NAMES := $(my_optional_lib_names)
$(my_built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
$(my_built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
$(my_built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location)
+$(my_built_odex): PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT := $(my_dex_preopt_class_loader_context)
+$(my_built_odex): PRIVATE_DEX2OAT_STORED_CLASS_LOADER_CONTEXT_LIBS := $(my_stored_preopt_class_loader_context_libs)
$(my_built_odex) : $($(my_2nd_arch_prefix)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \
$(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \
$(my_dex_preopt_image_filename)
-# Pass special class loader context to skip the classpath and collision check.
-# Should modify build system to pass used libraries properly later.
-$(my_built_odex): PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT := \&
-
my_installed_odex := $(call get-odex-installed-file-path,$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE))
my_built_vdex := $(patsubst %.odex,%.vdex,$(my_built_odex))
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 4d502ec..355f414 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -45,6 +45,7 @@
$(call add_json_str, BuildId, $(BUILD_ID))
$(call add_json_str, BuildNumberFromFile, $$$(BUILD_NUMBER_FROM_FILE))
+$(call add_json_str, Platform_version_name, $(PLATFORM_VERSION))
$(call add_json_val, Platform_sdk_version, $(PLATFORM_SDK_VERSION))
$(call add_json_str, Platform_sdk_codename, $(PLATFORM_VERSION_CODENAME))
$(call add_json_bool, Platform_sdk_final, $(filter REL,$(PLATFORM_VERSION_CODENAME)))
@@ -101,7 +102,7 @@
$(call add_json_list, CFIIncludePaths, $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
-$(call add_json_bool, UseClangLld, $(filter 1 true,$(USE_CLANG_LLD)))
+$(call add_json_bool, UseClangLld, $(call invert_bool,$(filter 0 false,$(USE_CLANG_LLD))))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
$(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS))
@@ -140,6 +141,11 @@
$(call add_json_list, PgoAdditionalProfileDirs, $(PGO_ADDITIONAL_PROFILE_DIRS))
+$(call add_json_list, BoardVendorSepolicyDirs, $(BOARD_SEPOLICY_DIRS))
+$(call add_json_list, BoardOdmSepolicyDirs, $(BOARD_ODM_SEPOLICY_DIRS))
+$(call add_json_list, BoardPlatPublicSepolicyDirs, $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
+$(call add_json_list, BoardPlatPrivateSepolicyDirs, $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
+
_contents := $(_contents) "VendorVars": {$(newline)
$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
$(eval _contents := $$(_contents) "$(namespace)": {$$(newline)) \
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 58735cd..0ba2c7a 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -64,6 +64,10 @@
my_static_library_extra_packages := $(intermediates.COMMON)/extra_packages
$(eval $(call copy-one-file,$(LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES),$(my_static_library_extra_packages)))
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_extra_packages))
+
+ my_static_library_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
+ $(eval $(call copy-one-file,$(LOCAL_FULL_MANIFEST_FILE),$(my_static_library_android_manifest)))
+ $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_static_library_android_manifest))
endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
ifneq ($(TURBINE_ENABLED),false)
@@ -144,3 +148,13 @@
my_common := COMMON
include $(BUILD_SYSTEM)/link_type.mk
endif # !LOCAL_IS_HOST_MODULE
+
+# LOCAL_EXPORT_SDK_LIBRARIES set by soong is written to exported-sdk-libs file
+my_exported_sdk_libs_file := $(intermediates.COMMON)/exported-sdk-libs
+$(my_exported_sdk_libs_file): PRIVATE_EXPORTED_SDK_LIBS := $(LOCAL_EXPORT_SDK_LIBRARIES)
+$(my_exported_sdk_libs_file):
+ @echo "Export SDK libs $@"
+ $(hide) mkdir -p $(dir $@) && rm -f $@
+ $(if $(PRIVATE_EXPORTED_SDK_LIBS),\
+ $(hide) echo $(PRIVATE_EXPORTED_SDK_LIBS) | tr ' ' '\n' > $@,\
+ $(hide) touch $@)
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index a3f560c..2a87705 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -28,6 +28,11 @@
my_res_package :=
+# Process Support Library dependencies.
+include $(BUILD_SYSTEM)/support_libraries.mk
+
+include $(BUILD_SYSTEM)/force_aapt2.mk
+
ifdef LOCAL_AAPT2_ONLY
LOCAL_USE_AAPT2 := true
endif
@@ -41,8 +46,8 @@
need_compile_res := true
LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d)))
endif
-ifdef LOCAL_USE_AAPT2
-ifneq ($(LOCAL_STATIC_ANDROID_LIBRARIES),)
+ifeq ($(LOCAL_USE_AAPT2),true)
+ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
need_compile_res := true
endif
endif
@@ -79,7 +84,7 @@
R_file_stamp := $(intermediates.COMMON)/src/R.stamp
LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
# For library we treat all the resource equal with no overlay.
my_res_resources := $(all_resources)
my_overlay_resources :=
@@ -114,8 +119,8 @@
endif
endif
-ifdef LOCAL_USE_AAPT2
-import_proguard_flag_files := $(strip $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
+ifeq ($(LOCAL_USE_AAPT2),true)
+import_proguard_flag_files := $(strip $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags))
$(intermediates.COMMON)/export_proguard_flags: $(import_proguard_flag_files) $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES))
@echo "Export proguard flags: $@"
@@ -137,7 +142,7 @@
# add --non-constant-id to prevent inlining constants.
# AAR needs text symbol file R.txt.
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --static-lib --output-text-symbols $(intermediates.COMMON)/R.txt
ifndef LOCAL_AAPT_NAMESPACES
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
@@ -165,10 +170,10 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR :=
-ifdef LOCAL_USE_AAPT2
+ifeq ($(LOCAL_USE_AAPT2),true)
# One more level with name res so we can zip up the flat resources that can be linked by apps.
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
- ifneq (,$(renderscript_target_api))
+ ifneq (,$(filter-out current,$(renderscript_target_api)))
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
my_generated_res_zips := $(rs_generated_res_zip)
endif # renderscript_target_api < 21
diff --git a/core/support_libraries.mk b/core/support_libraries.mk
new file mode 100644
index 0000000..7538ce0
--- /dev/null
+++ b/core/support_libraries.mk
@@ -0,0 +1,53 @@
+#
+# 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.
+#
+
+###########################################################
+## Rules for resolving Support Library dependencies.
+##
+## The following variables may be modified:
+## - LOCAL_JAVA_LIBRARIES
+## - LOCAL_STATIC_JAVA_LIBRARIES
+## - LOCAL_SHARED_ANDROID_LIBRARIES
+## - LOCAL_STATIC_ANDROID_LIBRARIES
+###########################################################
+
+# Some projects don't work correctly yet. Allow them to skip resolution.
+ifndef LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES
+
+# Aggregate all requested Support Library modules.
+requested_support_libs := $(filter $(SUPPORT_LIBRARIES_JARS) $(SUPPORT_LIBRARIES_AARS), \
+ $(LOCAL_JAVA_LIBRARIES) $(LOCAL_STATIC_JAVA_LIBRARIES) \
+ $(LOCAL_SHARED_ANDROID_LIBRARIES) $(LOCAL_STATIC_ANDROID_LIBRARIES))
+
+# Filter the Support Library modules out of the library variables. We don't
+# trust developers to get these right, so they will be added back by the
+# build system based on the output of this file and the type of build.
+LOCAL_JAVA_LIBRARIES := $(filter-out $(requested_support_libs), \
+ $(LOCAL_JAVA_LIBRARIES))
+LOCAL_STATIC_JAVA_LIBRARIES := $(filter-out $(requested_support_libs), \
+ $(LOCAL_STATIC_JAVA_LIBRARIES))
+LOCAL_SHARED_ANDROID_LIBRARIES := $(filter-out $(requested_support_libs), \
+ $(LOCAL_SHARED_ANDROID_LIBRARIES))
+LOCAL_STATIC_ANDROID_LIBRARIES := $(filter-out $(requested_support_libs), \
+ $(LOCAL_STATIC_ANDROID_LIBRARIES))
+
+LOCAL_STATIC_ANDROID_LIBRARIES := $(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) \
+ $(filter $(SUPPORT_LIBRARIES_AARS),$(requested_support_libs)))
+LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) \
+ $(filter $(SUPPORT_LIBRARIES_JARS),$(requested_support_libs)))
+
+endif #LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES
+LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES :=
diff --git a/core/tasks/apicheck.mk b/core/tasks/apicheck.mk
deleted file mode 100644
index 1d867d1..0000000
--- a/core/tasks/apicheck.mk
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright (C) 2008 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.
-
-#
-# Rules for running apicheck to confirm that you haven't broken
-# api compatibility or added apis illegally.
-#
-
-# skip api check for PDK buid
-ifeq (,$(filter true, $(WITHOUT_CHECK_API) $(TARGET_BUILD_PDK)))
-
-.PHONY: checkapi
-
-# Run the checkapi rules by default.
-droidcore: checkapi
-
-last_released_sdk_version := $(lastword $(call numerically_sort, \
- $(filter-out current, \
- $(patsubst $(SRC_API_DIR)/%.txt,%, $(wildcard $(SRC_API_DIR)/*.txt)) \
- )\
- ))
-
-.PHONY: check-public-api
-checkapi : check-public-api
-
-.PHONY: update-api
-
-# INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
-# Note that since INTERNAL_PLATFORM_API_FILE is the byproduct of api-stubs module,
-# (See frameworks/base/Android.mk)
-# we need to add api-stubs as additional dependency of the api check.
-
-# Check that the API we're building hasn't broken the last-released
-# SDK version.
-$(eval $(call check-api, \
- checkpublicapi-last, \
- $(SRC_API_DIR)/$(last_released_sdk_version).txt, \
- $(INTERNAL_PLATFORM_API_FILE), \
- frameworks/base/api/removed.txt, \
- $(INTERNAL_PLATFORM_REMOVED_API_FILE), \
- -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
- -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
- -error 16 -error 17 -error 18 , \
- cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
- check-public-api, \
- $(OUT_DOCS)/api-stubs-docs-stubs.srcjar \
- ))
-
-# Check that the API we're building hasn't changed from the not-yet-released
-# SDK version.
-$(eval $(call check-api, \
- checkpublicapi-current, \
- frameworks/base/api/current.txt, \
- $(INTERNAL_PLATFORM_API_FILE), \
- frameworks/base/api/removed.txt, \
- $(INTERNAL_PLATFORM_REMOVED_API_FILE), \
- -error 2 -error 3 -error 4 -error 5 -error 6 \
- -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
- -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
- -error 25 -error 26 -error 27, \
- cat $(BUILD_SYSTEM)/apicheck_msg_current.txt, \
- check-public-api, \
- $(OUT_DOCS)/api-stubs-docs-stubs.srcjar \
- ))
-
-.PHONY: update-public-api
-update-public-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP)
- @echo Copying current.txt
- $(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) frameworks/base/api/current.txt
- @echo Copying removed.txt
- $(hide) $(ACP) $(INTERNAL_PLATFORM_REMOVED_API_FILE) frameworks/base/api/removed.txt
-
-update-api : update-public-api
-
-#####################Check System API#####################
-.PHONY: check-system-api
-checkapi : check-system-api
-
-# Check that the System API we're building hasn't broken the last-released
-# SDK version.
-$(eval $(call check-api, \
- checksystemapi-last, \
- $(SRC_SYSTEM_API_DIR)/$(last_released_sdk_version).txt, \
- $(INTERNAL_PLATFORM_SYSTEM_API_FILE), \
- frameworks/base/api/system-removed.txt, \
- $(INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE), \
- -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
- -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
- -error 16 -error 17 -error 18 , \
- cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
- check-system-api, \
- $(OUT_DOCS)/system-api-stubs-docs-stubs.srcjar \
- ))
-
-# Check that the System API we're building hasn't changed from the not-yet-released
-# SDK version.
-$(eval $(call check-api, \
- checksystemapi-current, \
- frameworks/base/api/system-current.txt, \
- $(INTERNAL_PLATFORM_SYSTEM_API_FILE), \
- frameworks/base/api/system-removed.txt, \
- $(INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE), \
- -error 2 -error 3 -error 4 -error 5 -error 6 \
- -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
- -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
- -error 25 -error 26 -error 27, \
- cat $(BUILD_SYSTEM)/apicheck_msg_current.txt, \
- check-system-api, \
- $(OUT_DOCS)/system-api-stubs-docs-stubs.srcjar \
- ))
-
-.PHONY: update-system-api
-update-api : update-system-api
-
-update-system-api: $(INTERNAL_PLATFORM_SYSTEM_API_FILE) | $(ACP)
- @echo Copying system-current.txt
- $(hide) $(ACP) $(INTERNAL_PLATFORM_SYSTEM_API_FILE) frameworks/base/api/system-current.txt
- @echo Copying system-removed.txt
- $(hide) $(ACP) $(INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE) frameworks/base/api/system-removed.txt
-
-#####################Check Test API#####################
-.PHONY: check-test-api
-checkapi : check-test-api
-
-# Check that the Test API we're building hasn't changed from the not-yet-released
-# SDK version. Note that we don't check that we haven't broken the previous
-# SDK's API because the test API is meant only for CTS which is always
-# associated with the current release.
-$(eval $(call check-api, \
- checktestapi-current, \
- frameworks/base/api/test-current.txt, \
- $(INTERNAL_PLATFORM_TEST_API_FILE), \
- frameworks/base/api/test-removed.txt, \
- $(INTERNAL_PLATFORM_TEST_REMOVED_API_FILE), \
- -error 2 -error 3 -error 4 -error 5 -error 6 \
- -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
- -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
- -error 25 -error 26 -error 27, \
- cat $(BUILD_SYSTEM)/apicheck_msg_current.txt, \
- check-test-api, \
- $(OUT_DOCS)/test-api-stubs-docs-stubs.srcjar \
- ))
-
-.PHONY: update-test-api
-update-api : update-test-api
-
-update-test-api: $(INTERNAL_PLATFORM_TEST_API_FILE) | $(ACP)
- @echo Copying test-current.txt
- $(hide) $(ACP) $(INTERNAL_PLATFORM_TEST_API_FILE) frameworks/base/api/test-current.txt
- @echo Copying test-removed.txt
- $(hide) $(ACP) $(INTERNAL_PLATFORM_TEST_REMOVED_API_FILE) frameworks/base/api/test-removed.txt
-
-
-endif
diff --git a/core/tasks/collect_gpl_sources.mk b/core/tasks/collect_gpl_sources.mk
index 70f0afe..fdbf6c9 100644
--- a/core/tasks/collect_gpl_sources.mk
+++ b/core/tasks/collect_gpl_sources.mk
@@ -22,7 +22,7 @@
# FORCE since we can't know whether any of the sources changed
$(gpl_source_tgz): PRIVATE_PATHS := $(sort $(patsubst %/, %, $(dir $(ALL_GPL_MODULE_LICENSE_FILES))))
$(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES)
- @echo Package gpl sources: $@
+ @echo Package GPL sources: $@
$(hide) tar cfz $@ --exclude ".git*" $(PRIVATE_PATHS)
# Dist the tgz only if we are doing a full build
diff --git a/core/tasks/oem_image.mk b/core/tasks/oem_image.mk
index 66eec22..e9c506a 100644
--- a/core/tasks/oem_image.mk
+++ b/core/tasks/oem_image.mk
@@ -33,7 +33,7 @@
$(call pretty,"Target oem fs image: $@")
@mkdir -p $(TARGET_OUT_OEM)
@mkdir -p $(oemimage_intermediates) && rm -rf $(oemimage_intermediates)/oem_image_info.txt
- $(call generate-userimage-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt, skip_fsck=true)
+ $(call generate-image-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt,oem,skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@ $(TARGET_OUT)
diff --git a/core/tasks/vndk.mk b/core/tasks/vndk.mk
index 3604aed..ba48df7 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -36,38 +36,38 @@
)
endef
-# Returns list of file paths of the intermediate objs
+# Returns list of src:dest paths of the intermediate objs
#
# Args:
# $(1): list of module and filename pairs (e.g., ld.config.txt:ld.config.27.txt ...)
-# $(2): target class (e.g., SHARED_LIBRARIES, STATIC_LIBRARIES, ETC)
-# $(3): if not empty, evaluates for TARGET_2ND_ARCH
+# $(2): if not empty, evaluates for TARGET_2ND_ARCH
define paths-of-intermediates
$(strip \
$(foreach pair,$(1), \
- $(eval split_pair := $(subst :,$(space),$(pair))) \
- $(eval module := $(word 1,$(split_pair))) \
- $(eval filename := $(word 2,$(split_pair))) \
- $(eval dir := $(call intermediates-dir-for,$(2),$(module),,,$(3))) \
- $(call append-path,$(dir),$(filename)) \
+ $(eval module := $(call word-colon,1,$(pair))$(if $(2),$(TARGET_2ND_ARCH_MODULE_SUFFIX))) \
+ $(eval built := $(ALL_MODULES.$(module).BUILT_INSTALLED)) \
+ $(eval filename := $(call word-colon,2,$(pair))) \
+ $(if $(wordlist 2,100,$(built)), \
+ $(error Unable to handle multiple built files ($(module)): $(built))) \
+ $(if $(built),$(call word-colon,1,$(built)):$(filename)) \
) \
)
endef
-# Returns paths of notice files under $(TARGET_OUT_NOTICE_FILES)
+# Returns src:dest list of notice files
#
# Args:
# $(1): list of lib names (e.g., libfoo.vendor)
-# $(2): vndk lib type, one of 'vndk' or 'vndk-sp'
define paths-of-notice-files
$(strip \
- $(eval lib_dir := lib$(if $(TARGET_IS_64BIT),64,)) \
- $(eval vndk_dir := $(2)-$(PLATFORM_VNDK_VERSION)) \
$(foreach lib,$(1), \
- $(eval notice_file_name := $(patsubst %.vendor,%.so.txt,$(lib))) \
- $(TARGET_OUT_NOTICE_FILES)/src/system/$(lib_dir)/$(vndk_dir)/$(notice_file_name) \
- ) \
-)
+ $(eval notice := $(sort \
+ $(ALL_MODULES.$(lib).NOTICES) \
+ $(if $(TARGET_2ND_ARCH),
+ $(ALL_MODULES.$(lib)$(TARGET_2ND_ARCH_MODULE_SUFFIX).NOTICES)))) \
+ $(if $(wordlist 2,100,$(notice)), \
+ $(error Unable to handle multiple notice files ($(lib)): $(notice))) \
+ $(if $(notice),$(notice):$(subst .vendor,,$(lib)).so.txt)))
endef
# If in the future libclang_rt.ubsan* is removed from the VNDK-core list,
@@ -103,34 +103,37 @@
#######################################
# vndkcore.libraries.txt
vndkcore.libraries.txt := $(vndk_snapshot_configs_out)/vndkcore.libraries.txt
-$(vndkcore.libraries.txt): $(vndk_core_libs)
+$(vndkcore.libraries.txt): PRIVATE_LIBS := $(vndk_core_libs)
+$(vndkcore.libraries.txt):
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
- $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
+ $(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
#######################################
# vndkprivate.libraries.txt
vndkprivate.libraries.txt := $(vndk_snapshot_configs_out)/vndkprivate.libraries.txt
-$(vndkprivate.libraries.txt): $(vndk_private_libs)
+$(vndkprivate.libraries.txt): PRIVATE_LIBS := $(vndk_private_libs)
+$(vndkprivate.libraries.txt):
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
- $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
+ $(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
#######################################
# module_paths.txt
module_paths.txt := $(vndk_snapshot_configs_out)/module_paths.txt
-$(module_paths.txt): $(vndk_snapshot_libs)
+$(module_paths.txt): PRIVATE_LIBS := $(vndk_snapshot_libs)
+$(module_paths.txt):
@echo 'Generating: $@'
@rm -f $@
@mkdir -p $(dir $@)
$(hide) echo -n > $@
- $(hide) $(foreach lib,$^,echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
+ $(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
vndk_snapshot_configs := \
@@ -141,76 +144,86 @@
#######################################
# vndk_snapshot_zip
vndk_snapshot_variant := $(vndk_snapshot_out)/$(TARGET_ARCH)
-vndk_lib_dir := $(vndk_snapshot_variant)/arch-$(TARGET_ARCH)-$(TARGET_ARCH_VARIANT)
-vndk_lib_dir_2nd := $(vndk_snapshot_variant)/arch-$(TARGET_2ND_ARCH)-$(TARGET_2ND_ARCH_VARIANT)
-vndk_snapshot_zip := $(PRODUCT_OUT)/android-vndk-$(TARGET_ARCH).zip
+binder :=
+ifneq ($(TARGET_USES_64_BIT_BINDER), true)
+ binder := binder32
+endif
+vndk_lib_dir := $(subst $(space),/,$(strip $(vndk_snapshot_variant) $(binder) arch-$(TARGET_ARCH)-$(TARGET_ARCH_VARIANT)))
+vndk_lib_dir_2nd := $(subst $(space),/,$(strip $(vndk_snapshot_variant) $(binder) arch-$(TARGET_2ND_ARCH)-$(TARGET_2ND_ARCH_VARIANT)))
+vndk_snapshot_zip := $(PRODUCT_OUT)/android-vndk-$(TARGET_PRODUCT).zip
$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_OUT := $(vndk_snapshot_out)
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(subst .vendor,,$(lib)).so))
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT := $(vndk_lib_dir)/shared/vndk-core
-$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(lib).so),SHARED_LIBRARIES)
+$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(subst .vendor,,$(lib)).so))
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT := $(vndk_lib_dir)/shared/vndk-sp
-$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(lib).so),SHARED_LIBRARIES)
+$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+deps := $(call paths-of-intermediates,$(foreach txt,$(vndk_prebuilt_txts), \
+ $(txt):$(patsubst %.txt,%.$(PLATFORM_VNDK_VERSION).txt,$(txt)))) \
+ $(foreach config,$(vndk_snapshot_configs),$(config):$(notdir $(config)))
$(vndk_snapshot_zip): PRIVATE_CONFIGS_OUT := $(vndk_snapshot_variant)/configs
-$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := \
- $(call paths-of-intermediates,$(foreach txt,$(vndk_prebuilt_txts), \
- $(txt):$(patsubst %.txt,%.$(PLATFORM_VNDK_VERSION).txt,$(txt))),ETC) \
- $(vndk_snapshot_configs)
+$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+notices := $(call paths-of-notice-files,$(vndk_core_libs) $(vndk_sp_libs))
$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_OUT := $(vndk_snapshot_variant)/NOTICE_FILES
-$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_INTERMEDIATES := \
- $(call paths-of-notice-files,$(vndk_core_libs),vndk) \
- $(call paths-of-notice-files,$(vndk_sp_libs),vndk-sp)
+$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_INTERMEDIATES := $(notices)
+$(vndk_snapshot_zip): $(foreach n,$(notices),$(call word-colon,1,$(n)))
+notices :=
ifdef TARGET_2ND_ARCH
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(subst .vendor,,$(lib)).so),true)
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT_2ND := $(vndk_lib_dir_2nd)/shared/vndk-core
-$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_2ND := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(lib).so),SHARED_LIBRARIES,true)
+$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_2ND := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
+deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(subst .vendor,,$(lib)).so),true)
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT_2ND := $(vndk_lib_dir_2nd)/shared/vndk-sp
-$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_2ND := \
- $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(lib).so),SHARED_LIBRARIES,true)
+$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_2ND := $(deps)
+$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
+deps :=
endif
# Args
# $(1): destination directory
-# $(2): list of files to copy
-$(vndk_snapshot_zip): private-copy-vndk-intermediates = \
+# $(2): list of files (src:dest) to copy
+$(vndk_snapshot_zip): private-copy-intermediates = \
$(if $(2),$(strip \
- @mkdir -p $(1); \
+ @mkdir -p $(1) && \
$(foreach file,$(2), \
- if [ -e $(file) ]; then \
- cp -p $(file) $(call append-path,$(1),$(subst .vendor,,$(notdir $(file)))); \
- fi; \
+ cp $(call word-colon,1,$(file)) $(call append-path,$(1),$(call word-colon,2,$(file))) && \
) \
+ true \
))
-vndk_snapshot_dependencies := \
- $(vndk_snapshot_libs) \
- $(vndk_prebuilt_txts) \
- $(vndk_snapshot_configs)
-$(vndk_snapshot_zip): $(vndk_snapshot_dependencies) $(SOONG_ZIP)
+$(vndk_snapshot_zip): $(SOONG_ZIP)
@echo 'Generating VNDK snapshot: $@'
@rm -f $@
@rm -rf $(PRIVATE_VNDK_SNAPSHOT_OUT)
@mkdir -p $(PRIVATE_VNDK_SNAPSHOT_OUT)
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_CORE_OUT),$(PRIVATE_VNDK_CORE_INTERMEDIATES))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_SP_OUT),$(PRIVATE_VNDK_SP_INTERMEDIATES))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_NOTICE_FILES_OUT),$(PRIVATE_NOTICE_FILES_INTERMEDIATES))
ifdef TARGET_2ND_ARCH
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_CORE_OUT_2ND),$(PRIVATE_VNDK_CORE_INTERMEDIATES_2ND))
- $(call private-copy-vndk-intermediates, \
+ $(call private-copy-intermediates, \
$(PRIVATE_VNDK_SP_OUT_2ND),$(PRIVATE_VNDK_SP_INTERMEDIATES_2ND))
endif
$(hide) $(SOONG_ZIP) -o $@ -C $(PRIVATE_VNDK_SNAPSHOT_OUT) -D $(PRIVATE_VNDK_SNAPSHOT_OUT)
@@ -233,9 +246,9 @@
vndk_snapshot_out :=
vndk_snapshot_configs_out :=
vndk_snapshot_variant :=
+binder :=
vndk_lib_dir :=
vndk_lib_dir_2nd :=
-vndk_snapshot_dependencies :=
else # BOARD_VNDK_RUNTIME_DISABLE is set to 'true'
error_msg := "CANNOT generate VNDK snapshot. BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'."
diff --git a/core/use_lld_setup.mk b/core/use_lld_setup.mk
index 17a9e27..d00a5d3 100644
--- a/core/use_lld_setup.mk
+++ b/core/use_lld_setup.mk
@@ -4,12 +4,17 @@
## Output variables: my_use_clang_lld
#############################################################
-# Use LLD only if it's not disabled by LOCAL_USE_CLANG_LLD,
-# and enabled by LOCAL_USE_CLANG_LLD or USE_CLANG_LLD.
-my_use_clang_lld := false
-ifeq (,$(filter 0 false,$(LOCAL_USE_CLANG_LLD)))
- ifneq (,$(filter 1 true,$(LOCAL_USE_CLANG_LLD) $(USE_CLANG_LLD)))
- my_use_clang_lld := true
+# Use LLD by default.
+# Do not use LLD if LOCAL_USE_CLANG_LLD is false or 0,
+# of if LOCAL_USE_CLANG_LLD is not set and USE_CLANG_LLD is 0 or false.
+my_use_clang_lld := true
+ifneq (,$(LOCAL_USE_CLANG_LLD))
+ ifneq (,$(filter 0 false,$(LOCAL_USE_CLANG_LLD)))
+ my_use_clang_lld := false
+ endif
+else
+ ifneq (,$(filter 0 false,$(USE_CLANG_LLD)))
+ my_use_clang_lld := false
endif
endif
diff --git a/core/verify_uses_libraries.sh b/core/verify_uses_libraries.sh
new file mode 100755
index 0000000..dde0447
--- /dev/null
+++ b/core/verify_uses_libraries.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# 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.
+
+
+# apt_binary is $(AAPT) in the build.
+
+# Parse sdk, targetSdk, and uses librares in the APK, then cross reference against build specified ones.
+
+set -e
+local_apk=$1
+badging=$(${aapt_binary} dump badging "${local_apk}")
+export sdk_version=$(echo "${badging}" | grep "sdkVersion" | sed -n "s/sdkVersion:'\(.*\)'/\1/p")
+# Export target_sdk_version to the caller.
+export target_sdk_version=$(echo "${badging}" | grep "targetSdkVersion" | sed -n "s/targetSdkVersion:'\(.*\)'/\1/p")
+uses_libraries=$(echo "${badging}" | grep "uses-library" | sed -n "s/uses-library:'\(.*\)'/\1/p")
+optional_uses_libraries=$(echo "${badging}" | grep "uses-library-not-required" | sed -n "s/uses-library-not-required:'\(.*\)'/\1/p")
+
+# Verify that the uses libraries match exactly.
+# Currently we validate the ordering of the libraries since it matters for resolution.
+single_line_libs=$(echo "${uses_libraries}" | tr '\n' ' ' | awk '{$1=$1}1')
+if [[ "${single_line_libs}" != "${uses_library_names}" ]]; then
+ echo "LOCAL_USES_LIBRARIES (${uses_library_names})" \
+ "do not match (${single_line_libs}) in manifest for ${local_apk}"
+ exit 1
+fi
+
+# Verify that the optional uses libraries match exactly.
+single_line_optional_libs=$(echo "${optional_uses_libraries}" | tr '\n' ' ' | awk '{$1=$1}1')
+if [[ "${single_line_optional_libs}" != "${optional_uses_library_names}" ]]; then
+ echo "LOCAL_OPTIONAL_USES_LIBRARIES (${optional_uses_library_names}) " \
+ "do not match (${single_line_optional_libs}) in manifest for ${local_apk}"
+ exit 1
+fi
+
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 8c36359..ec0bfcd 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -258,6 +258,16 @@
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
+ifndef PLATFORM_SECURITY_PATCH_TIMESTAMP
+ # Used to indicate the matching timestamp for the security patch string in PLATFORM_SECURITY_PATCH.
+ ifneq (,$(findstring Darwin,$(UNAME)))
+ PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -jf '%Y-%m-%d %T %Z' '$(PLATFORM_SECURITY_PATCH) 00:00:00 GMT' +%s)
+ else
+ PLATFORM_SECURITY_PATCH_TIMESTAMP := $(shell date -d 'TZ="GMT" $(PLATFORM_SECURITY_PATCH)' +%s)
+ endif
+endif
+.KATI_READONLY := PLATFORM_SECURITY_PATCH_TIMESTAMP
+
ifndef PLATFORM_BASE_OS
# Used to indicate the base os applied to the device.
# Can be an arbitrary string, but must be a single word.
diff --git a/envsetup.sh b/envsetup.sh
index 5182253..12168e1 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -301,7 +301,6 @@
function set_stuff_for_environment()
{
- settitle
setpaths
set_sequence_number
@@ -316,24 +315,15 @@
export BUILD_ENV_SEQUENCE_NUMBER=13
}
-function settitle()
-{
- # This used to be opt-out with STAY_OFF_MY_LAWN, but this breaks folks
- # actually using PROMPT_COMMAND (https://issuetracker.google.com/38402256),
- # and the attempt to set the title doesn't do anything for the default
- # window manager in debian right now, so switch it to opt-in for anyone
- # who actually wants this.
- if [ "$ANDROID_BUILD_SET_WINDOW_TITLE" = "true" ]; then
- local arch=$(gettargetarch)
- local product=$TARGET_PRODUCT
- local variant=$TARGET_BUILD_VARIANT
- local apps=$TARGET_BUILD_APPS
- if [ -z "$apps" ]; then
- export PROMPT_COMMAND="echo -ne \"\033]0;[${arch}-${product}-${variant}] ${USER}@${HOSTNAME}: ${PWD}\007\""
- else
- export PROMPT_COMMAND="echo -ne \"\033]0;[$arch $apps $variant] ${USER}@${HOSTNAME}: ${PWD}\007\""
- fi
- fi
+# Takes a command name, and check if it's in ENVSETUP_NO_COMPLETION or not.
+function should_add_completion() {
+ local cmd="$1"
+ case :"$ENVSETUP_NO_COMPLETION": in
+ *:"$cmd":*)
+ return 1
+ ;;
+ esac
+ return 0
}
function addcompletions()
@@ -350,14 +340,19 @@
return
fi
+ # Completion can be disabled selectively to allow users to use non-standard completion.
+ # e.g.
+ # ENVSETUP_NO_COMPLETION=adb # -> disable adb completion
+ # ENVSETUP_NO_COMPLETION=adb:bit # -> disable adb and bit completion
for f in system/core/adb/adb.bash system/core/fastboot/fastboot.bash; do
- if [ -f $f ]; then
- echo "including $f"
+ if [ -f "$f" ] && should_add_completion $(basename "$f" .bash) ; then
. $f
fi
done
- complete -C "bit --tab" bit
+ if should_add_completion bit ; then
+ complete -C "bit --tab" bit
+ fi
}
function choosetype()
@@ -764,6 +759,7 @@
\cd ..
done
\cd $HERE
+ return 1
}
function mm()
@@ -891,7 +887,7 @@
echo "Couldn't locate the top of the tree. Try setting TOP."
return 1
fi
- local M=$(findmakefile)
+ local M=$(findmakefile || echo $(realpath $PWD)/Android.mk)
# Remove the path to top as the makefilepath needs to be relative
local M=`echo $M|sed 's:'$T'/::'`
local MODULES_IN_PATHS=MODULES-IN-$(dirname ${M})
@@ -996,28 +992,6 @@
fi
}
-function pid()
-{
- local prepend=''
- local append=''
- if [ "$1" = "--exact" ]; then
- prepend=' '
- append='$'
- shift
- fi
- local EXE="$1"
- if [ "$EXE" ] ; then
- local PID=`adb shell ps \
- | tr -d '\r' \
- | \grep "$prepend$EXE$append" \
- | sed -e 's/^[^ ]* *\([0-9]*\).*$/\1/'`
- echo "$PID"
- else
- echo "usage: pid [--exact] <process name>"
- return 255
- fi
-}
-
# coredump_setup - enable core dumps globally for any process
# that has the core-file-size limit set correctly
#
@@ -1104,53 +1078,6 @@
stacks system_server
}
-function stacks()
-{
- if [[ $1 =~ ^[0-9]+$ ]] ; then
- local PID="$1"
- elif [ "$1" ] ; then
- local PIDLIST="$(pid $1)"
- if [[ $PIDLIST =~ ^[0-9]+$ ]] ; then
- local PID="$PIDLIST"
- elif [ "$PIDLIST" ] ; then
- echo "more than one process: $1"
- else
- echo "no such process: $1"
- fi
- else
- echo "usage: stacks [pid|process name]"
- fi
-
- if [ "$PID" ] ; then
- # Determine whether the process is native
- if adb shell ls -l /proc/$PID/exe | grep -q /system/bin/app_process ; then
- # Dump stacks of Dalvik process
- local TRACES=/data/anr/traces.txt
- local ORIG=/data/anr/traces.orig
- local TMP=/data/anr/traces.tmp
-
- # Keep original traces to avoid clobbering
- adb shell mv $TRACES $ORIG
-
- # Make sure we have a usable file
- adb shell touch $TRACES
- adb shell chmod 666 $TRACES
-
- # Dump stacks and wait for dump to finish
- adb shell kill -3 $PID
- adb shell notify $TRACES >/dev/null
-
- # Restore original stacks, and show current output
- adb shell mv $TRACES $TMP
- adb shell mv $ORIG $TRACES
- adb shell cat $TMP
- else
- # Dump stacks of native process
- adb shell debuggerd -b $PID
- fi
- fi
-}
-
# Read the ELF header from /proc/$PID/exe to determine if the process is
# 64-bit.
function is64bit()
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index ee1bde5..812b7e4 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -8,18 +8,31 @@
TARGET_NO_KERNEL := true
TARGET_ARCH := arm
-# Note: we build the platform images for ARMv7-A _without_ NEON.
+# Note: Before Pi, we built the platform images for ARMv7-A _without_ NEON.
#
-# Technically, the emulator supports ARMv7-A _and_ NEON instructions, but
-# emulated NEON code paths typically ends up 2x slower than the normal C code
-# it is supposed to replace (unlike on real devices where it is 2x to 3x
-# faster).
+ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk,$(MAKECMDGOALS)),)
+# DO NOT USE
#
-# What this means is that the platform image will not use NEON code paths
-# that are slower to emulate. On the other hand, it is possible to emulate
-# application code generated with the NDK that uses NEON in the emulator.
+# This architecture variant should NOT be used for 32 bit arm platform
+# builds. It is the lowest common denominator required to build
+# an unbundled application for all supported 32 platforms.
+# cts for 32 bit arm is built using aosp_arm64 product.
#
+# If you are building a 32 bit platform (and not an application),
+# you should set the following as 2nd arch variant:
+#
+# TARGET_ARCH_VARIANT := armv7-a-neon
+#
+# DO NOT USE
TARGET_ARCH_VARIANT := armv7-a
+# DO NOT USE
+else
+# Starting from Pi, System image of aosp_arm products is the new GSI
+# for real devices newly launched for Pi. These devices are usualy not
+# as performant as the mainstream 64-bit devices and the performance
+# provided by NEON is important for them to pass related CTS tests.
+TARGET_ARCH_VARIANT := armv7-a-neon
+endif
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
@@ -56,13 +69,13 @@
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
-BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
# GSI is always userdebug and needs a couple of properties taking precedence
# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/treble_system.prop
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
endif
BOARD_VNDK_VERSION := current
diff --git a/target/board/generic/sepolicy/OWNERS b/target/board/generic/sepolicy/OWNERS
deleted file mode 100644
index 3828988..0000000
--- a/target/board/generic/sepolicy/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-jeffv@google.com
-dcashman@google.com
-jbires@google.com
-sspatil@google.com
diff --git a/target/board/generic/sepolicy/adbd.te b/target/board/generic/sepolicy/adbd.te
deleted file mode 100644
index 9546c1a..0000000
--- a/target/board/generic/sepolicy/adbd.te
+++ /dev/null
@@ -1 +0,0 @@
-set_prop(adbd, ctl_mdnsd_prop);
diff --git a/target/board/generic/sepolicy/audioserver.te b/target/board/generic/sepolicy/audioserver.te
deleted file mode 100644
index c3c4a3a..0000000
--- a/target/board/generic/sepolicy/audioserver.te
+++ /dev/null
@@ -1 +0,0 @@
-allow audioserver bootanim:binder call;
diff --git a/target/board/generic/sepolicy/bootanim.te b/target/board/generic/sepolicy/bootanim.te
deleted file mode 100644
index e4f7c73..0000000
--- a/target/board/generic/sepolicy/bootanim.te
+++ /dev/null
@@ -1,8 +0,0 @@
-allow bootanim self:process execmem;
-allow bootanim ashmem_device:chr_file execute;
-#TODO: This can safely be ignored until b/62954877 is fixed
-dontaudit bootanim system_data_file:dir read;
-
-allow bootanim graphics_device:chr_file { read ioctl open };
-
-set_prop(bootanim, qemu_prop)
diff --git a/target/board/generic/sepolicy/cameraserver.te b/target/board/generic/sepolicy/cameraserver.te
deleted file mode 100644
index 6cf5d6a..0000000
--- a/target/board/generic/sepolicy/cameraserver.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow cameraserver system_file:dir { open read };
-allow cameraserver hal_allocator:fd use;
diff --git a/target/board/generic/sepolicy/device.te b/target/board/generic/sepolicy/device.te
deleted file mode 100644
index d129441..0000000
--- a/target/board/generic/sepolicy/device.te
+++ /dev/null
@@ -1 +0,0 @@
-type qemu_device, dev_type, mlstrustedobject;
diff --git a/target/board/generic/sepolicy/domain.te b/target/board/generic/sepolicy/domain.te
deleted file mode 100644
index 3706dba..0000000
--- a/target/board/generic/sepolicy/domain.te
+++ /dev/null
@@ -1,3 +0,0 @@
-allow domain qemu_device:chr_file rw_file_perms;
-
-get_prop(domain, qemu_prop)
diff --git a/target/board/generic/sepolicy/file_contexts b/target/board/generic/sepolicy/file_contexts
deleted file mode 100644
index 521c65e..0000000
--- a/target/board/generic/sepolicy/file_contexts
+++ /dev/null
@@ -1,35 +0,0 @@
-# goldfish
-/dev/block/mtdblock0 u:object_r:system_block_device:s0
-/dev/block/mtdblock1 u:object_r:userdata_block_device:s0
-/dev/block/mtdblock2 u:object_r:cache_block_device:s0
-
-# ranchu
-/dev/block/vda u:object_r:system_block_device:s0
-/dev/block/vdb u:object_r:cache_block_device:s0
-/dev/block/vdc u:object_r:userdata_block_device:s0
-/dev/block/vdd u:object_r:metadata_block_device:s0
-/dev/block/vde u:object_r:system_block_device:s0
-
-/dev/goldfish_pipe u:object_r:qemu_device:s0
-/dev/goldfish_sync u:object_r:qemu_device:s0
-/dev/qemu_.* u:object_r:qemu_device:s0
-/dev/ttyGF[0-9]* u:object_r:serial_device:s0
-/dev/ttyS2 u:object_r:console_device:s0
-/vendor/bin/init\.ranchu-core\.sh u:object_r:goldfish_setup_exec:s0
-/vendor/bin/init\.ranchu-net\.sh u:object_r:goldfish_setup_exec:s0
-/vendor/bin/qemu-props u:object_r:qemu_props_exec:s0
-
-/vendor/bin/hw/android\.hardware\.drm@1\.0-service\.widevine u:object_r:hal_drm_widevine_exec:s0
-
-/vendor/lib(64)?/hw/gralloc\.ranchu\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/hw/gralloc\.goldfish\.default\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libEGL_emulation\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv1_CM_emulation\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv2_emulation\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libEGL_swiftshader\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv1_CM_swiftshader\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv2_swiftshader\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libOpenglSystemCommon\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/lib_renderControl_enc\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv1_enc\.so u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libGLESv2_enc\.so u:object_r:same_process_hal_file:s0
diff --git a/target/board/generic/sepolicy/genfs_contexts b/target/board/generic/sepolicy/genfs_contexts
deleted file mode 100644
index 91cedf1..0000000
--- a/target/board/generic/sepolicy/genfs_contexts
+++ /dev/null
@@ -1,17 +0,0 @@
-# On the emulator, device tree dir is configured to be
-# /sys/bus/platform/devices/ANDR0001:00/properties/android/ which is a symlink to
-# /sys/devices/platform/ANDR0001:00/properties/android/
-genfscon sysfs /devices/platform/ANDR0001:00/properties/android u:object_r:sysfs_dt_firmware_android:s0
-
-# We expect /sys/class/power_supply/* and everything it links to to be labeled
-# as sysfs_batteryinfo.
-genfscon sysfs /devices/platform/GFSH0001:00/power_supply u:object_r:sysfs_batteryinfo:s0
-
-# /sys/class/rtc
-genfscon sysfs /devices/pnp0/00:00/rtc u:object_r:sysfs_rtc:s0
-genfscon sysfs /devices/platform/GFSH0007:00/rtc u:object_r:sysfs_rtc:s0
-
-# /sys/class/net
-genfscon sysfs /devices/pci0000:00/0000:00:08.0/virtio5/net u:object_r:sysfs_net:s0
-genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim0/net u:object_r:sysfs_net:s0
-genfscon sysfs /devices/virtual/mac80211_hwsim/hwsim1/net u:object_r:sysfs_net:s0
diff --git a/target/board/generic/sepolicy/goldfish_setup.te b/target/board/generic/sepolicy/goldfish_setup.te
deleted file mode 100644
index eb913e9..0000000
--- a/target/board/generic/sepolicy/goldfish_setup.te
+++ /dev/null
@@ -1,13 +0,0 @@
-# goldfish-setup service: runs init.goldfish.sh script
-type goldfish_setup, domain;
-type goldfish_setup_exec, vendor_file_type, exec_type, file_type;
-
-init_daemon_domain(goldfish_setup)
-
-set_prop(goldfish_setup, debug_prop);
-allow goldfish_setup self:capability { net_admin net_raw };
-allow goldfish_setup self:udp_socket { create ioctl };
-allow goldfish_setup vendor_toolbox_exec:file execute_no_trans;
-allowxperm goldfish_setup self:udp_socket ioctl priv_sock_ioctls;
-wakelock_use(goldfish_setup);
-allow goldfish_setup vendor_shell_exec:file { rx_file_perms };
diff --git a/target/board/generic/sepolicy/hal_camera_default.te b/target/board/generic/sepolicy/hal_camera_default.te
deleted file mode 100644
index eb88c36..0000000
--- a/target/board/generic/sepolicy/hal_camera_default.te
+++ /dev/null
@@ -1,3 +0,0 @@
-vndbinder_use(hal_camera_default);
-allow hal_camera_default hal_graphics_mapper_hwservice:hwservice_manager find;
-hal_client_domain(hal_camera_default, hal_graphics_composer)
diff --git a/target/board/generic/sepolicy/hal_cas_default.te b/target/board/generic/sepolicy/hal_cas_default.te
deleted file mode 100644
index 3ed3bee..0000000
--- a/target/board/generic/sepolicy/hal_cas_default.te
+++ /dev/null
@@ -1 +0,0 @@
-vndbinder_use(hal_cas_default);
diff --git a/target/board/generic/sepolicy/hal_drm_default.te b/target/board/generic/sepolicy/hal_drm_default.te
deleted file mode 100644
index 5a07433..0000000
--- a/target/board/generic/sepolicy/hal_drm_default.te
+++ /dev/null
@@ -1,2 +0,0 @@
-vndbinder_use(hal_drm_default);
-hal_client_domain(hal_drm_default, hal_graphics_composer)
diff --git a/target/board/generic/sepolicy/hal_drm_widevine.te b/target/board/generic/sepolicy/hal_drm_widevine.te
deleted file mode 100644
index 42d462a..0000000
--- a/target/board/generic/sepolicy/hal_drm_widevine.te
+++ /dev/null
@@ -1,12 +0,0 @@
-# define SELinux domain
-type hal_drm_widevine, domain;
-hal_server_domain(hal_drm_widevine, hal_drm)
-
-type hal_drm_widevine_exec, exec_type, vendor_file_type, file_type;
-init_daemon_domain(hal_drm_widevine)
-
-allow hal_drm mediacodec:fd use;
-allow hal_drm { appdomain -isolated_app }:fd use;
-
-vndbinder_use(hal_drm_widevine);
-hal_client_domain(hal_drm_widevine, hal_graphics_composer);
diff --git a/target/board/generic/sepolicy/hal_fingerprint_default.te b/target/board/generic/sepolicy/hal_fingerprint_default.te
deleted file mode 100644
index e5b06f1..0000000
--- a/target/board/generic/sepolicy/hal_fingerprint_default.te
+++ /dev/null
@@ -1,5 +0,0 @@
-# TODO(b/36644492): Remove data_between_core_and_vendor_violators once
-# hal_fingerprint no longer directly accesses fingerprintd_data_file.
-typeattribute hal_fingerprint_default data_between_core_and_vendor_violators;
-allow hal_fingerprint_default fingerprintd_data_file:file create_file_perms;
-allow hal_fingerprint_default fingerprintd_data_file:dir rw_dir_perms;
diff --git a/target/board/generic/sepolicy/hal_gnss_default.te b/target/board/generic/sepolicy/hal_gnss_default.te
deleted file mode 100644
index ddc68cc..0000000
--- a/target/board/generic/sepolicy/hal_gnss_default.te
+++ /dev/null
@@ -1 +0,0 @@
-vndbinder_use(hal_gnss_default);
diff --git a/target/board/generic/sepolicy/hal_graphics_allocator_default.te b/target/board/generic/sepolicy/hal_graphics_allocator_default.te
deleted file mode 100644
index 0c8e27d..0000000
--- a/target/board/generic/sepolicy/hal_graphics_allocator_default.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow hal_graphics_allocator_default graphics_device:dir search;
-allow hal_graphics_allocator_default graphics_device:chr_file { ioctl open read write };
diff --git a/target/board/generic/sepolicy/hal_graphics_composer_default.te b/target/board/generic/sepolicy/hal_graphics_composer_default.te
deleted file mode 100644
index 40ecda6..0000000
--- a/target/board/generic/sepolicy/hal_graphics_composer_default.te
+++ /dev/null
@@ -1 +0,0 @@
-vndbinder_use(hal_graphics_composer_default);
diff --git a/target/board/generic/sepolicy/healthd.te b/target/board/generic/sepolicy/healthd.te
deleted file mode 100644
index ced6704..0000000
--- a/target/board/generic/sepolicy/healthd.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# Allow to read /sys/class/power_supply directory
-allow healthd sysfs:dir r_dir_perms;
diff --git a/target/board/generic/sepolicy/init.te b/target/board/generic/sepolicy/init.te
deleted file mode 100644
index 84a4e8d..0000000
--- a/target/board/generic/sepolicy/init.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow init tmpfs:lnk_file create_file_perms;
-dontaudit init kernel:system module_request;
diff --git a/target/board/generic/sepolicy/logpersist.te b/target/board/generic/sepolicy/logpersist.te
deleted file mode 100644
index 3fc0250..0000000
--- a/target/board/generic/sepolicy/logpersist.te
+++ /dev/null
@@ -1,13 +0,0 @@
-# goldfish logcat service: runs logcat -Q in logpersist domain
-
-# See global logcat.te/logpersist.te, only set for eng & userdebug,
-# allow for all builds in a non-conflicting manner.
-
-domain_auto_trans(init, logcat_exec, logpersist)
-
-# Read from logd.
-unix_socket_connect(logpersist, logdr, logd)
-
-# Write to /dev/ttyS2 and /dev/ttyGF2.
-allow logpersist serial_device:chr_file { write open };
-get_prop(logpersist, qemu_cmdline)
diff --git a/target/board/generic/sepolicy/mediacodec.te b/target/board/generic/sepolicy/mediacodec.te
deleted file mode 100644
index acf4e59..0000000
--- a/target/board/generic/sepolicy/mediacodec.te
+++ /dev/null
@@ -1 +0,0 @@
-allow mediacodec system_file:dir { open read };
diff --git a/target/board/generic/sepolicy/netd.te b/target/board/generic/sepolicy/netd.te
deleted file mode 100644
index 09a28b9..0000000
--- a/target/board/generic/sepolicy/netd.te
+++ /dev/null
@@ -1,3 +0,0 @@
-dontaudit netd self:capability sys_module;
-#TODO: This can safely be ignored until b/62954877 is fixed
-dontaudit netd kernel:system module_request;
diff --git a/target/board/generic/sepolicy/priv_app.te b/target/board/generic/sepolicy/priv_app.te
deleted file mode 100644
index 3d16f32..0000000
--- a/target/board/generic/sepolicy/priv_app.te
+++ /dev/null
@@ -1,5 +0,0 @@
-#TODO: b/62908025
-dontaudit priv_app firstboot_prop:file { getattr open };
-dontaudit priv_app device:dir { open read };
-dontaudit priv_app proc_interrupts:file { getattr open read };
-dontaudit priv_app proc_modules:file { getattr open read };
diff --git a/target/board/generic/sepolicy/property.te b/target/board/generic/sepolicy/property.te
deleted file mode 100644
index 56e02ef..0000000
--- a/target/board/generic/sepolicy/property.te
+++ /dev/null
@@ -1,3 +0,0 @@
-type qemu_prop, property_type;
-type qemu_cmdline, property_type;
-type radio_noril_prop, property_type;
diff --git a/target/board/generic/sepolicy/property_contexts b/target/board/generic/sepolicy/property_contexts
deleted file mode 100644
index 3a61b6b..0000000
--- a/target/board/generic/sepolicy/property_contexts
+++ /dev/null
@@ -1,5 +0,0 @@
-qemu. u:object_r:qemu_prop:s0
-qemu.cmdline u:object_r:qemu_cmdline:s0
-ro.emu. u:object_r:qemu_prop:s0
-ro.emulator. u:object_r:qemu_prop:s0
-ro.radio.noril u:object_r:radio_noril_prop:s0
diff --git a/target/board/generic/sepolicy/qemu_props.te b/target/board/generic/sepolicy/qemu_props.te
deleted file mode 100644
index 0f5ec8c..0000000
--- a/target/board/generic/sepolicy/qemu_props.te
+++ /dev/null
@@ -1,9 +0,0 @@
-# qemu-props service: Sets system properties on boot.
-type qemu_props, domain;
-type qemu_props_exec, vendor_file_type, exec_type, file_type;
-
-init_daemon_domain(qemu_props)
-
-set_prop(qemu_props, qemu_prop)
-set_prop(qemu_props, dalvik_prop)
-set_prop(qemu_props, qemu_cmdline)
diff --git a/target/board/generic/sepolicy/shell.te b/target/board/generic/sepolicy/shell.te
deleted file mode 100644
index b246d7e..0000000
--- a/target/board/generic/sepolicy/shell.te
+++ /dev/null
@@ -1 +0,0 @@
-allow shell serial_device:chr_file rw_file_perms;
diff --git a/target/board/generic/sepolicy/surfaceflinger.te b/target/board/generic/sepolicy/surfaceflinger.te
deleted file mode 100644
index e03d07e..0000000
--- a/target/board/generic/sepolicy/surfaceflinger.te
+++ /dev/null
@@ -1,4 +0,0 @@
-allow surfaceflinger self:process execmem;
-allow surfaceflinger ashmem_device:chr_file execute;
-
-set_prop(surfaceflinger, qemu_prop)
diff --git a/target/board/generic/sepolicy/system_server.te b/target/board/generic/sepolicy/system_server.te
deleted file mode 100644
index dd70b12..0000000
--- a/target/board/generic/sepolicy/system_server.te
+++ /dev/null
@@ -1 +0,0 @@
-get_prop(system_server, radio_noril_prop)
diff --git a/target/board/generic/sepolicy/vold.te b/target/board/generic/sepolicy/vold.te
deleted file mode 100644
index 5f3bdd4..0000000
--- a/target/board/generic/sepolicy/vold.te
+++ /dev/null
@@ -1 +0,0 @@
-dontaudit vold kernel:system module_request;
diff --git a/target/board/generic/sepolicy/zygote.te b/target/board/generic/sepolicy/zygote.te
deleted file mode 100644
index e97d895..0000000
--- a/target/board/generic/sepolicy/zygote.te
+++ /dev/null
@@ -1,4 +0,0 @@
-set_prop(zygote, qemu_prop)
-# TODO (b/63631799) fix this access
-# Suppress denials to storage. Webview zygote should not be accessing.
-dontaudit webview_zygote mnt_expand_file:dir getattr;
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index ee4103d..4f6a10c 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -86,12 +86,12 @@
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
# GSI is always userdebug and needs a couple of properties taking precedence
# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/treble_system.prop
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
endif
BOARD_VNDK_VERSION := current
diff --git a/target/board/generic_arm64_ab/sepolicy/OWNERS b/target/board/generic_arm64_ab/sepolicy/OWNERS
index 3828988..ff29677 100644
--- a/target/board/generic_arm64_ab/sepolicy/OWNERS
+++ b/target/board/generic_arm64_ab/sepolicy/OWNERS
@@ -1,4 +1,8 @@
-jeffv@google.com
-dcashman@google.com
+alanstokes@google.com
+bowgotsai@google.com
jbires@google.com
+jeffv@google.com
+jgalenson@google.com
sspatil@google.com
+tomcherry@google.com
+trong@google.com
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 3760cc4..f50a84c 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -58,9 +58,14 @@
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += \
- build/target/board/generic/sepolicy \
- build/target/board/generic_x86/sepolicy
+ device/generic/goldfish/sepolicy/common \
+ device/generic/goldfish/sepolicy/x86
+ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+# GSI is always userdebug and needs a couple of properties taking precedence
+# over those set by the vendor.
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
+endif
BOARD_VNDK_VERSION := current
BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/generic_x86/sepolicy/OWNERS b/target/board/generic_x86/sepolicy/OWNERS
deleted file mode 100644
index 3828988..0000000
--- a/target/board/generic_x86/sepolicy/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-jeffv@google.com
-dcashman@google.com
-jbires@google.com
-sspatil@google.com
diff --git a/target/board/generic_x86/sepolicy/domain.te b/target/board/generic_x86/sepolicy/domain.te
deleted file mode 100644
index 0bc8d87..0000000
--- a/target/board/generic_x86/sepolicy/domain.te
+++ /dev/null
@@ -1 +0,0 @@
-allow domain cpuctl_device:dir search;
diff --git a/target/board/generic_x86/sepolicy/healthd.te b/target/board/generic_x86/sepolicy/healthd.te
deleted file mode 100644
index 95fa807..0000000
--- a/target/board/generic_x86/sepolicy/healthd.te
+++ /dev/null
@@ -1 +0,0 @@
-allow healthd self:capability sys_nice;
diff --git a/target/board/generic_x86/sepolicy/init.te b/target/board/generic_x86/sepolicy/init.te
deleted file mode 100644
index 3aa81d1..0000000
--- a/target/board/generic_x86/sepolicy/init.te
+++ /dev/null
@@ -1 +0,0 @@
-allow init tmpfs:lnk_file create_file_perms;
diff --git a/target/board/generic_x86/sepolicy/installd.te b/target/board/generic_x86/sepolicy/installd.te
deleted file mode 100644
index 7a558b1..0000000
--- a/target/board/generic_x86/sepolicy/installd.te
+++ /dev/null
@@ -1 +0,0 @@
-allow installd self:process execmem;
diff --git a/target/board/generic_x86/sepolicy/zygote.te b/target/board/generic_x86/sepolicy/zygote.te
deleted file mode 100644
index 93993a4..0000000
--- a/target/board/generic_x86/sepolicy/zygote.te
+++ /dev/null
@@ -1,2 +0,0 @@
-allow zygote self:process execmem;
-allow zygote self:capability sys_nice;
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index ec7a51e..fa9f5ec 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -57,9 +57,14 @@
DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
BOARD_SEPOLICY_DIRS += \
- build/target/board/generic/sepolicy \
- build/target/board/generic_x86/sepolicy
+ device/generic/goldfish/sepolicy/common \
+ device/generic/goldfish/sepolicy/x86
+ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+# GSI is always userdebug and needs a couple of properties taking precedence
+# over those set by the vendor.
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
+endif
BOARD_VNDK_VERSION := current
# Enable A/B update
diff --git a/target/board/generic_x86_arm/BoardConfig.mk b/target/board/generic_x86_arm/BoardConfig.mk
index 131c001..d1e4884 100644
--- a/target/board/generic_x86_arm/BoardConfig.mk
+++ b/target/board/generic_x86_arm/BoardConfig.mk
@@ -31,6 +31,8 @@
# Tell the build system this isn't a typical 64bit+32bit multilib configuration.
TARGET_TRANSLATE_2ND_ARCH := true
+BUILD_BROKEN_DUP_RULES := true
+
# no hardware camera
USE_CAMERA_STUB := true
@@ -61,4 +63,4 @@
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
diff --git a/target/board/gsi_system.prop b/target/board/gsi_system.prop
new file mode 100644
index 0000000..4b54aaf
--- /dev/null
+++ b/target/board/gsi_system.prop
@@ -0,0 +1,5 @@
+# GSI always generate dex pre-opt in system image
+ro.cp_system_other_odex=0
+
+# GSI always disables adb authentication
+ro.adb.secure=0
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 89b66d3..f445a80 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -42,7 +42,6 @@
$(LOCAL_DIR)/aosp_x86_64.mk
else
PRODUCT_MAKEFILES := \
- $(LOCAL_DIR)/core.mk \
$(LOCAL_DIR)/generic.mk \
$(LOCAL_DIR)/generic_x86.mk \
$(LOCAL_DIR)/aosp_arm.mk \
diff --git a/target/product/base.mk b/target/product/base.mk
index e778e76..d65f124 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -18,71 +18,154 @@
PRODUCT_PACKAGES += \
20-dns.conf \
95-configured \
- org.apache.http.legacy.boot \
- appwidget \
- appops \
+ adb \
+ adbd \
+ adbd.recovery \
am \
+ android.hardware.cas@1.0-service \
+ android.hardware.configstore@1.0-service \
+ android.hardware.media.omx@1.0-service \
+ android.hidl.allocator@1.0-service \
+ android.hidl.base-V1.0-java \
+ android.hidl.manager-V1.0-java \
+ android.hidl.memory@1.0-impl \
+ android.hidl.memory@1.0-impl.vendor \
android.policy \
android.test.mock \
android.test.runner \
- app_process \
applypatch \
+ appops \
+ app_process \
+ appwidget \
+ atrace \
audioserver \
+ BackupRestoreConfirmation \
+ bcc \
bit \
+ blank_screen \
blkid \
bmgr \
+ bootanimation \
+ bootstat \
bpfloader \
+ bu \
bugreport \
bugreportz \
cameraserver \
+ charger \
+ cmd \
+ com.android.location.provider \
+ ContactsProvider \
content \
+ crash_dump \
+ CtsShimPrebuilt \
+ CtsShimPrivPrebuilt \
+ debuggerd\
dnsmasq \
+ DefaultContainerService \
+ DownloadProvider \
dpm \
+ dumpstate \
+ dumpsys \
+ e2fsck \
+ ExtServices \
+ ExtShared \
+ fastboot \
framework \
+ framework-res \
framework-sysconfig.xml \
fsck_msdos \
+ gatekeeperd \
+ gralloc.default \
+ healthd \
hid \
+ hwservicemanager \
+ idmap \
ime \
- incidentd \
+ ims-common \
incident \
+ incidentd \
incident_report \
+ init \
+ init.environ.rc \
+ init.rc \
input \
+ installd \
+ ip \
+ ip6tables \
+ iptables \
+ ip-up-vpn \
javax.obex \
+ keystore \
+ ld.config.recovery.txt \
+ ld.config.txt \
+ ld.mc \
+ libaaudio \
libandroid \
libandroid_runtime \
libandroid_servers \
libaudioeffect_jni \
libaudioflinger \
- libaudiopolicyservice \
libaudiopolicymanager \
+ libaudiopolicyservice \
+ libbinder \
libbundlewrapper \
+ libc \
+ libcamera2ndk \
libcamera_client \
libcameraservice \
- libcamera2ndk \
- libdl \
- libdrmclearkeyplugin \
libclearkeycasplugin \
+ libc_malloc_debug \
+ libc_malloc_hooks \
+ libcutils \
+ libdl \
+ libdownmix \
+ libdrmclearkeyplugin \
+ libdrmframework \
+ libdrmframework_jni \
libeffectproxy \
libeffects \
+ libEGL \
+ libETC1 \
+ libFFTEm \
+ libfilterfw \
+ libgatekeeper \
+ libGLESv1_CM \
+ libGLESv2 \
+ libGLESv3 \
+ libgui \
+ libhardware \
+ libhardware_legacy \
libinput \
libinputflinger \
libiprouteutil \
libjnigraphics \
+ libjpeg \
+ libkeystore \
libldnhncr \
+ liblog \
+ libm \
libmedia \
libmedia_jni \
+ libmediandk \
libmediaplayerservice \
libmtp \
libnetd_client \
libnetlink \
libnetutils \
+ libneuralnetworks \
+ libOpenMAXAL \
+ libOpenSLES \
libpdfium \
+ libpixelflinger \
+ libpower \
libradio_metadata \
libreference-ril \
libreverbwrapper \
libril \
librtp_jni \
libsensorservice \
+ libsigchain \
libskia \
libsonic \
libsonivox \
@@ -97,61 +180,127 @@
libstagefright_foundation \
libstagefright_omx \
libstagefright_yuv \
+ libstdc++ \
+ libsurfaceflinger \
+ libsurfaceflinger_ddmconnection \
+ libsysutils \
+ libui \
libusbhost \
libutils \
libvisualizer \
libvorbisidec \
- libmediandk \
libvulkan \
libwifi-service \
+ libwilhelm \
+ linker \
+ linker.recovery \
+ lmkd \
locksettings \
+ logcat \
+ logd \
+ lshal \
+ mdnsd \
media \
media_cmd \
mediadrmserver \
- mediaserver \
- mediametrics \
mediaextractor \
+ mediametrics \
+ media_profiles_V1_0.dtd \
+ MediaProvider \
+ mediaserver \
+ mke2fs \
monkey \
mtpd \
ndc \
netd \
+ org.apache.http.legacy \
perfetto \
ping \
ping6 \
platform.xml \
- privapp-permissions-platform.xml \
- pppd \
pm \
+ pppd \
+ privapp-permissions-platform.xml \
racoon \
+ recovery \
+ resize2fs \
run-as \
schedtest \
+ screencap \
sdcard \
secdiscard \
+ selinux_policy \
+ sensorservice \
+ service \
+ servicemanager \
services \
settings \
+ SettingsProvider \
sgdisk \
+ Shell \
+ shell_and_utilities \
sm \
+ storaged \
+ surfaceflinger \
svc \
tc \
telecom \
+ telephony-common \
+ thermalserviced \
+ tombstoned \
traced \
traced_probes \
+ tune2fs \
+ tzdatacheck \
+ uiautomator \
+ uncrypt \
+ usbd \
vdc \
+ vndservice \
+ vndservicemanager \
+ voip-common \
vold \
- wm
+ WallpaperBackup \
+ wificond \
+ wifi-service \
+ wm \
-# Essential HAL modules
-PRODUCT_PACKAGES += \
- android.hardware.cas@1.0-service \
- android.hardware.media.omx@1.0-service
-# XML schema files
+# VINTF data
PRODUCT_PACKAGES += \
- media_profiles_V1_0.dtd
+ device_compatibility_matrix.xml \
+ device_manifest.xml \
+ framework_manifest.xml \
+ framework_compatibility_matrix.xml \
+
+# AID Generation for
+# <pwd.h> and <grp.h>
+PRODUCT_PACKAGES += \
+ passwd \
+ group \
+ fs_config_files \
+ fs_config_dirs
+
+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
+
+# 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
# Packages included only for eng or userdebug builds, previously debug tagged
PRODUCT_PACKAGES_DEBUG := \
+ adb_keys \
+ iotop \
logpersist.start \
+ micro_bench \
perfprofd \
sqlite3 \
strace
@@ -159,7 +308,7 @@
# Packages included only for eng/userdebug builds, when building with SANITIZE_TARGET=address
PRODUCT_PACKAGES_DEBUG_ASAN :=
-PRODUCT_COPY_FILES := $(call add-to-product-copy-files-if-exists,\
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/config/preloaded-classes:system/etc/preloaded-classes)
# Note: it is acceptable to not have a dirty-image-objects file. In that case, the special bin
@@ -167,4 +316,9 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/config/dirty-image-objects:system/etc/dirty-image-objects)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk)
+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/core.mk b/target/product/core.mk
deleted file mode 100644
index bbc2b75..0000000
--- a/target/product/core.mk
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# Copyright (C) 2007 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.
-#
-
-# Base configuration for communication-oriented android devices
-# (phones, tablets, etc.). If you want a change to apply to ALMOST ALL
-# devices (including non-phones and non-tablets), modify
-# core_minimal.mk instead. If you care about wearables, you need to modify
-# core_tiny.mk in addition to core_minimal.mk.
-
-PRODUCT_PACKAGES += \
- BasicDreams \
- BlockedNumberProvider \
- BookmarkProvider \
- Browser2 \
- BuiltInPrintService \
- Calendar \
- CalendarProvider \
- CaptivePortalLogin \
- CertInstaller \
- Contacts \
- DeskClock \
- DocumentsUI \
- DownloadProviderUi \
- Email \
- ExactCalculator \
- ExternalStorageProvider \
- FusedLocation \
- InputDevices \
- KeyChain \
- Keyguard \
- LatinIME \
- Launcher2 \
- ManagedProvisioning \
- MtpDocumentsProvider \
- PacProcessor \
- libpac \
- PrintSpooler \
- PrintRecommendationService \
- ProxyHandler \
- QuickSearchBox \
- Settings \
- SharedStorageBackup \
- StorageManager \
- Telecom \
- TeleService \
- Traceur \
- VpnDialogs \
- vr \
- MmsService
-
-# The set of packages whose code can be loaded by the system server.
-PRODUCT_SYSTEM_SERVER_APPS += \
- FusedLocation \
- InputDevices \
- KeyChain \
- Telecom \
-
-# The set of packages we want to force 'speed' compilation on.
-PRODUCT_DEXPREOPT_SPEED_APPS += \
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk)
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index 7dc0010..575bd60 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -13,53 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# Note that components added here will be also shared in PDK. Components
-# that should not be in PDK should be added in lower level like core.mk.
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.notification_sound=OnTheHunt.ogg \
ro.config.alarm_alert=Alarm_Classic.ogg
PRODUCT_PACKAGES += \
- ContactsProvider \
- DefaultContainerService \
Home \
TelephonyProvider \
UserDictionaryProvider \
- atrace \
libandroidfw \
- libaudiopreprocessing \
libaudioutils \
- libfilterpack_imageproc \
- libgabi++ \
libmdnssd \
libnfc_ndef \
libpowermanager \
libspeexresampler \
- 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 \
libvariablespeed \
libwebrtc_audio_preprocessing \
- mdnsd \
- requestsync \
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 16599cb..baa297c 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -16,84 +16,57 @@
# Base configuration for most consumer android devices. Do not put
# things that are specific to communication devices (phones, tables,
-# etc.) here -- for that, use core.mk.
+# etc.) here -- for that, use generic_no_telephony.mk.
PRODUCT_BRAND := generic
PRODUCT_DEVICE := generic
PRODUCT_NAME := core
PRODUCT_PACKAGES += \
- BackupRestoreConfirmation \
- CompanionDeviceManager \
- CtsShimPrebuilt \
- CtsShimPrivPrebuilt \
- DownloadProvider \
- ExtShared \
- ExtServices \
- HTMLViewer \
- MediaProvider \
- PackageInstaller \
- SettingsProvider \
- Shell \
- StatementService \
- WallpaperBackup \
- android.hidl.base-V1.0-java \
- android.hidl.manager-V1.0-java \
- bcc \
- bu \
com.android.future.usb.accessory \
- com.android.location.provider \
- com.android.location.provider.xml \
+ com.android.mediadrm.signer \
com.android.media.remotedisplay \
com.android.media.remotedisplay.xml \
- com.android.mediadrm.signer \
- com.android.mediadrm.signer.xml \
+ CompanionDeviceManager \
drmserver \
ethernet-service \
- framework-res \
- idmap \
- installd \
- ims-common \
- ip \
- ip-up-vpn \
- ip6tables \
- iptables \
- gatekeeperd \
- keystore \
- ld.config.txt \
- ld.mc \
- libaaudio \
- libOpenMAXAL \
- libOpenSLES \
- libdownmix \
- libdrmframework \
- libdrmframework_jni \
- libfilterfw \
- libkeystore \
- libgatekeeper \
- libneuralnetworks \
+ fsck.f2fs \
+ HTMLViewer \
+ libaudiopreprocessing \
+ libfilterpack_imageproc \
+ libgabi++ \
+ 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 \
- libwilhelm \
logd \
- mke2fs \
- e2fsck \
- resize2fs \
- tune2fs \
- screencap \
- sensorservice \
- telephony-common \
- uiautomator \
- uncrypt \
+ make_f2fs \
+ PackageInstaller \
+ requestsync \
+ StatementService \
vndk_snapshot_package \
- voip-common \
webview \
webview_zygote \
-# Wifi modules
-PRODUCT_PACKAGES += \
- wifi-service \
- wificond \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.webview.xml:system/etc/permissions/android.software.webview.xml
@@ -116,7 +89,7 @@
telephony-common \
voip-common \
ims-common \
- org.apache.http.legacy.boot \
+ org.apache.http.legacy.impl \
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java
@@ -132,18 +105,6 @@
SettingsProvider \
WallpaperBackup
-# Adoptable external storage supports both ext4 and f2fs
-PRODUCT_PACKAGES += \
- e2fsck \
- mke2fs \
- fsck.f2fs \
- make_f2fs \
-
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- ro.zygote=zygote32
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
-
PRODUCT_COPY_FILES += \
system/core/rootdir/etc/public.libraries.android.txt:system/etc/public.libraries.txt
@@ -165,5 +126,4 @@
ro.logd.size.stats=64K \
log.tag.stats_log=I
-$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
deleted file mode 100644
index 122f5c7..0000000
--- a/target/product/core_tiny.mk
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-# Copyright (C) 2013 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.
-#
-# Tiny configuration for small devices such as wearables. Includes base and embedded.
-# No telephony
-
-PRODUCT_PACKAGES := \
- Bluetooth \
- CalendarProvider \
- ContactsProvider \
- CertInstaller \
- FusedLocation \
- InputDevices
-
-PRODUCT_PACKAGES += \
- clatd \
- clatd.conf \
- pppd
-
-PRODUCT_PACKAGES += \
- audio.primary.default \
- local_time.default \
- power.default
-
-PRODUCT_PACKAGES += \
- BackupRestoreConfirmation \
- CtsShimPrebuilt \
- CtsShimPrivPrebuilt \
- DefaultContainerService \
- ExtShared \
- ExtServices \
- SettingsProvider \
- Shell \
- WallpaperBackup \
- android.hidl.base-V1.0-java \
- android.hidl.manager-V1.0-java \
- bcc \
- bu \
- com.android.location.provider \
- com.android.location.provider.xml \
- framework-res \
- installd \
- ims-common \
- ip \
- ip-up-vpn \
- ip6tables \
- iptables \
- gatekeeperd \
- keystore \
- ld.config.txt \
- ld.mc \
- libaaudio \
- libOpenMAXAL \
- libOpenSLES \
- libdownmix \
- libfilterfw \
- libgatekeeper \
- libkeystore \
- libwilhelm \
- libdrmframework_jni \
- libdrmframework \
- mke2fs \
- e2fsck \
- resize2fs \
- tune2fs \
- nullwebview \
- screencap \
- sensorservice \
- uiautomator \
- uncrypt \
- telephony-common \
- voip-common \
- logd \
-
-# Wifi modules
-PRODUCT_PACKAGES += \
- wifi-service \
- wificond \
-
-ifeq ($(TARGET_CORE_JARS),)
-$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
-endif
-
-# The order matters
-PRODUCT_BOOT_JARS := \
- $(TARGET_CORE_JARS) \
- legacy-test \
- ext \
- framework \
- telephony-common \
- voip-common \
- ims-common \
- nullwebview \
- org.apache.http.legacy.boot \
- 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 \
- wifi-service
-
-# The set of packages whose code can be loaded by the system server.
-PRODUCT_SYSTEM_SERVER_APPS += \
- FusedLocation \
- InputDevices \
- SettingsProvider \
- WallpaperBackup \
-
-# The set of packages we want to force 'speed' compilation on.
-PRODUCT_DEXPREOPT_SPEED_APPS := \
-
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- ro.zygote=zygote32
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
-
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.carrier=unknown
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
-$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
-$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk)
-
-# Overrides
-PRODUCT_BRAND := tiny
-PRODUCT_DEVICE := tiny
-PRODUCT_NAME := core_tiny
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
deleted file mode 100644
index 6ddc07e..0000000
--- a/target/product/embedded.mk
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# Copyright (C) 2009 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 is a build configuration for a very minimal build of the
-# Open-Source part of the tree.
-
-PRODUCT_PACKAGES += \
- adb \
- adbd \
- usbd \
- android.hardware.configstore@1.0-service \
- android.hidl.allocator@1.0-service \
- android.hidl.memory@1.0-impl \
- android.hidl.memory@1.0-impl.vendor \
- atrace \
- blank_screen \
- bootanimation \
- bootstat \
- charger \
- cmd \
- crash_dump \
- debuggerd\
- dumpstate \
- dumpsys \
- fastboot \
- gralloc.default \
- healthd \
- hwservicemanager \
- init \
- init.environ.rc \
- init.rc \
- libEGL \
- libETC1 \
- libFFTEm \
- libGLESv1_CM \
- libGLESv2 \
- libGLESv3 \
- libbinder \
- libc \
- libc_malloc_debug \
- libc_malloc_hooks \
- libcutils \
- libdl \
- libgui \
- libhardware \
- libhardware_legacy \
- libjpeg \
- liblog \
- libm \
- libpixelflinger \
- libpower \
- libsigchain \
- libstdc++ \
- libsurfaceflinger \
- libsurfaceflinger_ddmconnection \
- libsysutils \
- libui \
- libutils \
- linker \
- lmkd \
- logcat \
- lshal \
- recovery \
- service \
- servicemanager \
- shell_and_utilities \
- storaged \
- surfaceflinger \
- thermalserviced \
- tombstoned \
- tzdatacheck \
- vndservice \
- vndservicemanager \
-
-# VINTF data
-PRODUCT_PACKAGES += \
- device_compatibility_matrix.xml \
- device_manifest.xml \
- framework_manifest.xml \
- framework_compatibility_matrix.xml \
-
-# SELinux packages are added as dependencies of the selinux_policy
-# phony package.
-PRODUCT_PACKAGES += \
- selinux_policy \
-
-# AID Generation for
-# <pwd.h> and <grp.h>
-PRODUCT_PACKAGES += \
- passwd \
- group \
- fs_config_files \
- fs_config_dirs
-
-# If there are product-specific adb keys defined, install them on debuggable
-# builds.
-PRODUCT_PACKAGES_DEBUG += \
- adb_keys
-
-# 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_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
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 190a889..5e6957a 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -18,39 +18,80 @@
# It includes the base Android platform.
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 \
+ InputDevices \
+ KeyChain \
+ Keyguard \
+ LatinIME \
+ Launcher3QuickStep \
+ librs_jni \
+ libvideoeditor_core \
+ libvideoeditor_jni \
+ libvideoeditor_osal \
+ libvideoeditorplayer \
+ libvideoeditor_videofilters \
+ local_time.default \
+ ManagedProvisioning \
+ MmsService \
+ MtpDocumentsProvider \
Music \
MusicFX \
NfcNci \
OneTimeInitializer \
+ PacProcessor \
+ power.default \
+ PrintRecommendationService \
+ PrintSpooler \
Provision \
+ ProxyHandler \
+ QuickSearchBox \
+ screenrecord \
+ SecureElement \
+ Settings \
+ SettingsIntelligence \
+ SharedStorageBackup \
+ SimAppDialog \
+ StorageManager \
SystemUI \
SysuiDarkThemeOverlay \
- EasterEgg \
- WallpaperCropper
-
-PRODUCT_PACKAGES += \
- clatd \
- clatd.conf \
- pppd \
- screenrecord
-
-PRODUCT_PACKAGES += \
- librs_jni \
- libvideoeditor_jni \
- libvideoeditor_core \
- libvideoeditor_osal \
- libvideoeditor_videofilters \
- libvideoeditorplayer \
-
-PRODUCT_PACKAGES += \
- audio.primary.default \
- local_time.default \
+ Telecom \
+ TeleService \
+ Traceur \
vibrator.default \
- power.default
+ 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
@@ -68,7 +109,7 @@
$(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.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk)
# Overrides
PRODUCT_BRAND := generic
diff --git a/target/product/sdk_base.mk b/target/product/sdk_base.mk
deleted file mode 100644
index b79b8c6..0000000
--- a/target/product/sdk_base.mk
+++ /dev/null
@@ -1,178 +0,0 @@
-#
-# Copyright (C) 2007 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.
-#
-
-PRODUCT_PROPERTY_OVERRIDES :=
-
-PRODUCT_PACKAGES := \
- CellBroadcastReceiver \
- CubeLiveWallpapers \
- CustomLocale \
- Development \
- Dialer \
- EmulatorSmokeTests \
- Gallery2 \
- Launcher3 \
- Camera2 \
- librs_jni \
- libwnndict \
- libWnnEngDic \
- libWnnJpnDic \
- LiveWallpapersPicker \
- Mms \
- Music \
- OpenWnn \
- Protips \
- rild \
- screenrecord \
- SdkSetup \
- SoftKeyboard \
- sqlite3 \
- SystemUI \
- SysuiDarkThemeOverlay \
- EasterEgg \
- WallpaperPicker \
- WidgetPreview
-
-# Define the host tools and libs that are parts of the SDK.
--include sdk/build/product_sdk.mk
--include development/build/product_sdk.mk
-
-# audio libraries.
-PRODUCT_PACKAGES += \
- audio.primary.goldfish \
- audio.r_submix.default \
- local_time.default
-
-# CDD mandates following codecs
-PRODUCT_PACKAGES += \
- libstagefright_soft_aacdec \
- libstagefright_soft_aacenc \
- libstagefright_soft_amrdec \
- libstagefright_soft_amrnbenc \
- libstagefright_soft_amrwbenc \
- libstagefright_soft_avcdec \
- libstagefright_soft_avcenc \
- 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
-
-PRODUCT_PACKAGE_OVERLAYS := development/sdk_overlay
-
-PRODUCT_COPY_FILES := \
- device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
- device/sample/etc/old-apns-conf.xml:system/etc/old-apns-conf.xml \
- frameworks/base/data/sounds/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
- frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
- frameworks/base/data/sounds/effects/VideoStop.ogg:system/media/audio/ui/VideoStop.ogg \
- device/generic/goldfish/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \
- device/generic/goldfish/camera/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles.xml \
- frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
- frameworks/av/media/libstagefright/data/media_codecs_google_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_telephony.xml \
- device/generic/goldfish/camera/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
- device/generic/goldfish/camera/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
- device/generic/goldfish/camera/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
- frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
- frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
- frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \
- frameworks/native/data/etc/android.software.autofill.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.autofill.xml \
- frameworks/av/media/libeffects/data/audio_effects.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.conf \
- device/generic/goldfish/audio_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy.conf
-
-include $(SRC_TARGET_DIR)/product/emulator.mk
-
-$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.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, frameworks/base/data/keyboards/keyboards.mk)
-$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
-
-# locale. en_US is both first and in alphabetical order to
-# ensure this is the default locale.
-PRODUCT_LOCALES := \
- en_US \
- ar_EG \
- ar_IL \
- bg_BG \
- ca_ES \
- cs_CZ \
- da_DK \
- de_AT \
- de_CH \
- de_DE \
- de_LI \
- el_GR \
- en_AU \
- en_CA \
- en_GB \
- en_IE \
- en_IN \
- en_NZ \
- en_SG \
- en_US \
- en_ZA \
- es_ES \
- es_US \
- fi_FI \
- fr_BE \
- fr_CA \
- fr_CH \
- fr_FR \
- he_IL \
- hi_IN \
- hr_HR \
- hu_HU \
- id_ID \
- it_CH \
- it_IT \
- ja_JP \
- ko_KR \
- lt_LT \
- lv_LV \
- nb_NO \
- nl_BE \
- nl_NL \
- pl_PL \
- pt_BR \
- pt_PT \
- ro_RO \
- ru_RU \
- sk_SK \
- sl_SI \
- sr_RS \
- sv_SE \
- th_TH \
- tl_PH \
- tr_TR \
- uk_UA \
- vi_VN \
- zh_CN \
- zh_TW
diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk
index 56eb8c7..96f0bfd 100644
--- a/target/product/sdk_phone_arm64.mk
+++ b/target/product/sdk_phone_arm64.mk
@@ -14,31 +14,15 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib64/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm64.mk)
-# This is a build configuration for a full-featured build of the
-# Open-Source part of the tree. It's geared toward a US-centric
-# build quite specifically for the emulator, and might not be
-# entirely appropriate to inherit from for on-device configurations.
+# Define the host tools and libs that are parts of the SDK.
+$(call inherit-product, sdk/build/product_sdk.mk)
+$(call inherit-product, development/build/product_sdk.mk)
-# Note: the following lines need to stay at the beginning so that it can
-# take priority and override the rules it inherit from other mk files
-# see copy file rules in core/Makefile
-PRODUCT_COPY_FILES += \
- development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \
- prebuilts/qemu-kernel/arm64/3.18/kernel-qemu2:kernel-ranchu \
- device/generic/goldfish/fstab.ranchu.arm:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/sdk_phone_armv7.mk b/target/product/sdk_phone_armv7.mk
index 73c42c3..04d8d6a 100644
--- a/target/product/sdk_phone_armv7.mk
+++ b/target/product/sdk_phone_armv7.mk
@@ -14,24 +14,16 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm.mk)
-# Note: the following lines need to stay at the beginning so that it can
-# take priority and override the rules it inherit from other mk files
-# see copy file rules in core/Makefile
-PRODUCT_COPY_FILES += \
- development/sys-img/advancedFeatures.ini.arm:advancedFeatures.ini \
- prebuilts/qemu-kernel/arm64/3.18/kernel-qemu2:kernel-ranchu-64 \
- device/generic/goldfish/fstab.ranchu.arm:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.ranchu
+# Define the host tools and libs that are parts of the SDK.
+$(call inherit-product, sdk/build/product_sdk.mk)
+$(call inherit-product, development/build/product_sdk.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
+
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index 32d71eb..abb46ac 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -14,25 +14,15 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86.mk)
-# This is a build configuration for a full-featured build of the
-# Open-Source part of the tree. It's geared toward a US-centric
-# build quite specifically for the emulator, and might not be
-# entirely appropriate to inherit from for on-device configurations.
-PRODUCT_COPY_FILES += \
- development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
- device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
- prebuilts/qemu-kernel/x86_64/4.4/kernel-qemu2:kernel-ranchu-64
+# Define the host tools and libs that are parts of the SDK.
+-include sdk/build/product_sdk.mk
+-include development/build/product_sdk.mk
-$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk
index e40ebb5..828b744 100644
--- a/target/product/sdk_phone_x86_64.mk
+++ b/target/product/sdk_phone_x86_64.mk
@@ -14,27 +14,15 @@
# limitations under the License.
#
-PRODUCT_PROPERTY_OVERRIDES += \
- rild.libpath=/vendor/lib64/libreference-ril.so
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_x86_64.mk)
-# This is a build configuration for a full-featured build of the
-# Open-Source part of the tree. It's geared toward a US-centric
-# build quite specifically for the emulator, and might not be
-# entirely appropriate to inherit from for on-device configurations.
+# Define the host tools and libs that are parts of the SDK.
+-include sdk/build/product_sdk.mk
+-include development/build/product_sdk.mk
-PRODUCT_COPY_FILES += \
- development/sys-img/advancedFeatures.ini:advancedFeatures.ini \
- device/generic/goldfish/data/etc/encryptionkey.img:encryptionkey.img \
- prebuilts/qemu-kernel/x86_64/4.4/kernel-qemu2:kernel-ranchu
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk_base.mk)
-
-# AOSP emulator images build the AOSP messaging app.
-# Google API images override with the Google API app.
-# See vendor/google/products/sdk_google_phone_*.mk
+# keep this apk for sdk targets for now
PRODUCT_PACKAGES += \
- messaging
+ EmulatorSmokeTests
# Overrides
PRODUCT_BRAND := Android
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index 5352e77..7e0e2ae 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -76,15 +76,11 @@
PRODUCT_COPY_FILES += \
device/generic/common/nfc/libnfc-nci.conf:system/etc/libnfc-nci.conf
-# Support for the devices with no VNDK enforcing
+# Support for the O-MR1 devices
PRODUCT_COPY_FILES += \
build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc \
- build/make/target/product/vndk/init.noenforce.rc:system/etc/init/gsi/init.noenforce.rc
+ build/make/target/product/vndk/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc
# Name space configuration file for non-enforcing VNDK
PRODUCT_PACKAGES += \
- ld.config.noenforce.txt
-
-# Set current VNDK version for GSI
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
- ro.gsi.vndk.version=$(PLATFORM_VNDK_VERSION)
+ ld.config.vndk_lite.txt
diff --git a/target/product/vndk/Android.mk b/target/product/vndk/Android.mk
index 768cb80..5d009f9 100644
--- a/target/product/vndk/Android.mk
+++ b/target/product/vndk/Android.mk
@@ -1,4 +1,3 @@
-ifneq ($(BOARD_VNDK_VERSION),)
LOCAL_PATH:= $(call my-dir)
#####################################################################
@@ -39,7 +38,13 @@
droidcore: check-vndk-list
check-vndk-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-list-timestamp
+
+ifeq ($(TARGET_IS_64_BIT)|$(TARGET_2ND_ARCH),true|)
+# TODO(b/110429754) remove this condition when we support 64-bit-only device
+check-vndk-list: ;
+else
check-vndk-list: $(check-vndk-list-timestamp)
+endif
_vndk_check_failure_message := " error: VNDK library list has been changed.\n"
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
@@ -86,6 +91,8 @@
endif
@chmod a+x $@
+ifneq ($(BOARD_VNDK_VERSION),)
+
include $(CLEAR_VARS)
LOCAL_MODULE := vndk_package
LOCAL_REQUIRED_MODULES := \
@@ -98,8 +105,15 @@
include $(CLEAR_VARS)
LOCAL_MODULE := vndk_snapshot_package
+_binder32 :=
+ifneq ($(TARGET_USES_64_BIT_BINDER),true)
+ifneq ($(TARGET_IS_64_BIT),true)
+_binder32 := _binder32
+endif
+endif
LOCAL_REQUIRED_MODULES := \
- $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),vndk_v$(vndk_ver)_$(TARGET_ARCH))
+ $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),vndk_v$(vndk_ver)_$(TARGET_ARCH)$(_binder32))
+_binder32 :=
include $(BUILD_PHONY_PACKAGE)
endif # BOARD_VNDK_VERSION is set
diff --git a/target/product/vndk/init.gsi.rc b/target/product/vndk/init.gsi.rc
index 3e6b1fb..0150b1a 100644
--- a/target/product/vndk/init.gsi.rc
+++ b/target/product/vndk/init.gsi.rc
@@ -1,2 +1,2 @@
-# If ro.vndk.version is not defined, import init.noenforce.rc
-import /system/etc/init/gsi/init.${ro.vndk.version:-noenforce}.rc
+# If ro.vndk.version is not defined, import init.vndk-27.rc.
+import /system/etc/init/gsi/init.vndk-${ro.vndk.version:-27}.rc
diff --git a/target/product/vndk/init.noenforce.rc b/target/product/vndk/init.noenforce.rc
deleted file mode 100644
index 6cf1df7..0000000
--- a/target/product/vndk/init.noenforce.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-on early-init
- # If ro.vndk.version is not set, use ld.config.nonenforce.txt
- export LD_CONFIG_FILE /system/etc/ld.config.noenforce.txt
- # To use current VNDK libs, set ro.vndk.version to system vndk version
- setprop ro.vndk.version ${ro.gsi.vndk.version}
diff --git a/target/product/vndk/init.vndk-27.rc b/target/product/vndk/init.vndk-27.rc
new file mode 100644
index 0000000..d464a2f
--- /dev/null
+++ b/target/product/vndk/init.vndk-27.rc
@@ -0,0 +1,3 @@
+on early-init
+ # Set ro.vndk.version to 27 so that O-MR1-VENDOR can run latest GSI.
+ setprop ro.vndk.version 27
diff --git a/tools/apicheck/Android.bp b/tools/apicheck/Android.bp
new file mode 100644
index 0000000..8fe20e9
--- /dev/null
+++ b/tools/apicheck/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2008 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.
+
+java_binary_host {
+ name: "apicheck",
+ wrapper: "etc/apicheck",
+ static_libs: [
+ "doclava",
+ "jsilver",
+ ],
+}
diff --git a/tools/apicheck/Android.mk b/tools/apicheck/Android.mk
deleted file mode 100644
index ab3493d..0000000
--- a/tools/apicheck/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2007-2008 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.
-
-LOCAL_PATH := $(call my-dir)
-
-# the hat script
-# ============================================================
-include $(CLEAR_VARS)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE := apicheck
-LOCAL_SRC_FILES := etc/apicheck
-LOCAL_REQUIRED_MODULES := doclava
-include $(BUILD_PREBUILT)
-
-# Apicheck is now part of Doclava -- See external/doclava.
diff --git a/tools/checkowners.py b/tools/checkowners.py
index 1190d30..54198a7 100755
--- a/tools/checkowners.py
+++ b/tools/checkowners.py
@@ -30,12 +30,11 @@
def find_address(address):
if address not in checked_addresses:
- request = (gerrit_server + '/accounts/?n=1&o=ALL_EMAILS&q=email:'
+ request = (gerrit_server + '/accounts/?n=1&q=email:'
+ urllib.quote(address))
echo('Checking email address: ' + address)
result = urllib2.urlopen(request).read()
- checked_addresses[address] = (
- result.find('"email":') >= 0 and result.find('"_account_id":') >= 0)
+ checked_addresses[address] = result.find('"_account_id":') >= 0
return checked_addresses[address]
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index f946303..8a8eca9 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -63,6 +63,8 @@
my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
endif
+system_android_filesystem_config := system/core/include/private/android_filesystem_config.h
+
##################################
include $(CLEAR_VARS)
LOCAL_SRC_FILES := fs_config_generate.c
@@ -72,8 +74,6 @@
LOCAL_CFLAGS := -Werror -Wno-error=\#warnings
ifneq ($(TARGET_FS_CONFIG_GEN),)
-system_android_filesystem_config := system/core/include/private/android_filesystem_config.h
-
# Generate the "generated_oem_aid.h" file
oem := $(local-generated-sources-dir)/generated_oem_aid.h
$(oem): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
@@ -239,22 +239,20 @@
endif
-# The newer passwd/group targets are only generated if you
-# use the new TARGET_FS_CONFIG_GEN method.
-ifneq ($(TARGET_FS_CONFIG_GEN),)
-
##################################
# Build the oemaid header library when fs config files are present.
# Intentionally break build if you require generated AIDs
# header file, but are not using any fs config files.
+ifneq ($(TARGET_FS_CONFIG_GEN),)
include $(CLEAR_VARS)
LOCAL_MODULE := oemaids_headers
LOCAL_EXPORT_C_INCLUDE_DIRS := $(dir $(my_gen_oem_aid))
LOCAL_EXPORT_C_INCLUDE_DEPS := $(my_gen_oem_aid)
include $(BUILD_HEADER_LIBRARY)
+endif
##################################
-# Generate the system/etc/passwd text file for the target
+# Generate the vendor/etc/passwd text file for the target
# This file may be empty if no AIDs are defined in
# TARGET_FS_CONFIG_GEN files.
include $(CLEAR_VARS)
@@ -265,15 +263,18 @@
include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+ifneq ($(TARGET_FS_CONFIG_GEN),)
$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
+else
+$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := /dev/null
+endif
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
@mkdir -p $(dir $@)
- $(hide) $< passwd --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+ $(hide) $< passwd --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
##################################
-# Generate the system/etc/group text file for the target
+# Generate the vendor/etc/group text file for the target
# This file may be empty if no AIDs are defined in
# TARGET_FS_CONFIG_GEN files.
include $(CLEAR_VARS)
@@ -284,15 +285,17 @@
include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+ifneq ($(TARGET_FS_CONFIG_GEN),)
$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
+else
+$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := /dev/null
+endif
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
@mkdir -p $(dir $@)
- $(hide) $< group --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+ $(hide) $< group --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
system_android_filesystem_config :=
-endif
ANDROID_FS_CONFIG_H :=
my_fs_config_h :=
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index d51d075..cd534ec 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -138,13 +138,13 @@
'media_codec': 'mediacodec'
}
- def __init__(self, identifier, value, found):
+ def __init__(self, identifier, value, found, login_shell):
"""
Args:
identifier: The identifier name for a #define <identifier>.
value: The value of the AID, aka the uid.
found (str): The file found in, not required to be specified.
-
+ login_shell (str): The shell field per man (5) passwd file.
Raises:
ValueError: if the friendly name is longer than 31 characters as
that is bionic's internal buffer size for name.
@@ -154,6 +154,8 @@
self.identifier = identifier
self.value = value
self.found = found
+ self.login_shell = login_shell
+
try:
self.normalized_value = str(int(value, 0))
except ValueException:
@@ -171,7 +173,8 @@
return self.identifier == other.identifier \
and self.value == other.value and self.found == other.found \
- and self.normalized_value == other.normalized_value
+ and self.normalized_value == other.normalized_value \
+ and self.login_shell == other.login_shell
@staticmethod
def is_friendly(name):
@@ -336,7 +339,7 @@
ValueError: With message set to indicate the error.
"""
- aid = AID(identifier, value, self._aid_header)
+ aid = AID(identifier, value, self._aid_header, '/system/bin/sh')
# duplicate name
if aid.friendly in self._aid_name_to_value:
@@ -647,7 +650,7 @@
sys.exit(error_message('Found specified but unset "value"'))
try:
- aid = AID(section_name, value, file_name)
+ aid = AID(section_name, value, file_name, '/vendor/bin/sh')
except ValueError as exception:
sys.exit(error_message(exception))
@@ -1216,10 +1219,6 @@
class PasswdGen(BaseGenerator):
"""Generates the /etc/passwd file per man (5) passwd."""
- _GENERATED = ('#\n# THIS IS AN AUTOGENERATED FILE! DO NOT MODIFY!\n#')
-
- _FILE_COMMENT = '# Defined in file: \"%s\"'
-
def __init__(self):
self._old_file = None
@@ -1235,22 +1234,31 @@
help='An android_filesystem_config.h file'
'to parse AIDs and OEM Ranges from')
+ opt_group.add_argument(
+ '--required-prefix',
+ required=False,
+ help='A prefix that the names are required to contain.')
+
def __call__(self, args):
hdr_parser = AIDHeaderParser(args['aid_header'])
parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
+ required_prefix = args['required_prefix']
+
aids = parser.aids
# nothing to do if no aids defined
if len(aids) == 0:
return
- print PasswdGen._GENERATED
-
for aid in aids:
- self._print_formatted_line(aid)
+ if required_prefix is None or aid.friendly.startswith(required_prefix):
+ self._print_formatted_line(aid)
+ else:
+ sys.exit("%s: AID '%s' must start with '%s'" %
+ (args['fsconfig'], aid.friendly, required_prefix))
def _print_formatted_line(self, aid):
"""Prints the aid to stdout in the passwd format. Internal use only.
@@ -1269,14 +1277,13 @@
"""
if self._old_file != aid.found:
self._old_file = aid.found
- print PasswdGen._FILE_COMMENT % aid.found
try:
logon, uid = Utils.get_login_and_uid_cleansed(aid)
except ValueError as exception:
sys.exit(exception)
- print "%s::%s:%s::/:/system/bin/sh" % (logon, uid, uid)
+ print "%s::%s:%s::/:%s" % (logon, uid, uid, aid.login_shell)
@generator('group')
@@ -1295,7 +1302,6 @@
"""
if self._old_file != aid.found:
self._old_file = aid.found
- print PasswdGen._FILE_COMMENT % aid.found
try:
logon, uid = Utils.get_login_and_uid_cleansed(aid)
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 2406f4a..8e20859 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -18,8 +18,10 @@
Builds output_image from the given input_directory, properties_file,
and writes the image to target_output_directory.
+If argument generated_prop_file exists, write additional properties to the file.
+
Usage: build_image.py input_directory properties_file output_image \\
- target_output_directory
+ target_output_directory [generated_prop_file]
"""
from __future__ import print_function
@@ -40,22 +42,29 @@
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
BLOCK_SIZE = 4096
+BYTES_IN_MB = 1024 * 1024
-def RunCommand(cmd, verbose=None):
+def RunCommand(cmd, verbose=None, env=None):
"""Echo and run the given command.
Args:
cmd: the command represented as a list of strings.
verbose: show commands being executed.
+ env: a dictionary of additional environment variables.
Returns:
A tuple of the output and the exit code.
"""
+ env_copy = None
+ if env is not None:
+ env_copy = os.environ.copy()
+ env_copy.update(env)
if verbose is None:
verbose = OPTIONS.verbose
if verbose:
print("Running: " + " ".join(cmd))
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ env=env_copy)
output, _ = p.communicate()
if verbose:
@@ -103,6 +112,24 @@
return verity_size
+def GetDiskUsage(path):
+ """Return number of bytes that "path" occupies on host.
+
+ Args:
+ path: The directory or file to calculate size on
+ Returns:
+ True and the number of bytes if successful,
+ False and 0 otherwise.
+ """
+ env = {"POSIXLY_CORRECT": "1"}
+ cmd = ["du", "-s", path]
+ output, exit_code = RunCommand(cmd, verbose=False, env=env)
+ if exit_code != 0:
+ return False, 0
+ # POSIX du returns number of blocks with block size 512
+ return True, int(output.split()[0]) * 512
+
+
def GetSimgSize(image_file):
simg = sparse_img.SparseImage(image_file, build_map=False)
return simg.blocksize * simg.total_blocks
@@ -442,6 +469,8 @@
def BuildImage(in_dir, prop_dict, out_file, target_out=None):
"""Build an image to out_file from in_dir with property prop_dict.
+ After the function call, values in prop_dict is updated with
+ computed values.
Args:
in_dir: path of input directory.
@@ -486,6 +515,21 @@
verity_supported = prop_dict.get("verity") == "true"
verity_fec_supported = prop_dict.get("verity_fec") == "true"
+ if (prop_dict.get("use_logical_partitions") == "true" and
+ "partition_size" not in prop_dict):
+ # if partition_size is not defined, use output of `du' + reserved_size
+ success, size = GetDiskUsage(origin_in)
+ if not success:
+ return False
+ if OPTIONS.verbose:
+ print("The tree size of %s is %d MB." % (origin_in, size // BYTES_IN_MB))
+ size += int(prop_dict.get("partition_reserved_size", 0))
+ # Round this up to a multiple of 4K so that avbtool works
+ size = common.RoundUpTo4K(size)
+ prop_dict["partition_size"] = str(size)
+ if OPTIONS.verbose:
+ print("Allocating %d MB for %s." % (size // BYTES_IN_MB, out_file))
+
# Adjust the partition size to make room for the hashes if this is to be
# verified.
if verity_supported and is_verity_partition:
@@ -613,6 +657,17 @@
if exit_code != 0:
print("Error: '%s' failed with exit code %d:\n%s" % (
build_command, exit_code, mkfs_output))
+ success, du = GetDiskUsage(origin_in)
+ du_str = ("%d bytes (%d MB)" % (du, du // BYTES_IN_MB)
+ ) if success else "unknown"
+ print("Out of space? The tree size of %s is %s." % (
+ origin_in, du_str))
+ print("The max is %d bytes (%d MB)." % (
+ int(prop_dict["partition_size"]),
+ int(prop_dict["partition_size"]) // BYTES_IN_MB))
+ print("Reserved space is %d bytes (%d MB)." % (
+ int(prop_dict.get("partition_reserved_size", 0)),
+ int(prop_dict.get("partition_reserved_size", 0)) // BYTES_IN_MB))
return False
# Check if there's enough headroom space available for ext4 image.
@@ -713,6 +768,7 @@
"avb_enable",
"avb_avbtool",
"avb_salt",
+ "use_logical_partitions",
)
for p in common_props:
copy_prop(p, p)
@@ -745,6 +801,7 @@
copy_prop("system_extfs_inode_count", "extfs_inode_count")
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("system_reserved_size", "partition_reserved_size")
elif mount_point == "system_other":
# We inherit the selinux policies of /system since we contain some of its
# files.
@@ -767,6 +824,7 @@
copy_prop("system_extfs_inode_count", "extfs_inode_count")
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("system_reserved_size", "partition_reserved_size")
elif mount_point == "data":
# Copy the generic fs type first, override with specific one if available.
copy_prop("fs_type", "fs_type")
@@ -797,6 +855,7 @@
copy_prop("vendor_extfs_inode_count", "extfs_inode_count")
if not copy_prop("vendor_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("vendor_reserved_size", "partition_reserved_size")
elif mount_point == "product":
copy_prop("avb_product_hashtree_enable", "avb_hashtree_enable")
copy_prop("avb_product_add_hashtree_footer_args",
@@ -842,8 +901,29 @@
return d
+def GlobalDictFromImageProp(image_prop, mount_point):
+ d = {}
+ def copy_prop(src_p, dest_p):
+ if src_p in image_prop:
+ d[dest_p] = image_prop[src_p]
+ return True
+ return False
+ if mount_point == "system":
+ copy_prop("partition_size", "system_size")
+ elif mount_point == "system_other":
+ copy_prop("partition_size", "system_size")
+ elif mount_point == "vendor":
+ copy_prop("partition_size", "vendor_size")
+ return d
+
+
+def SaveGlobalDict(filename, glob_dict):
+ with open(filename, "w") as f:
+ f.writelines(["%s=%s" % (key, value) for (key, value) in glob_dict.items()])
+
+
def main(argv):
- if len(argv) != 4:
+ if len(argv) < 4 or len(argv) > 5:
print(__doc__)
sys.exit(1)
@@ -851,6 +931,7 @@
glob_dict_file = argv[1]
out_file = argv[2]
target_out = argv[3]
+ prop_file_out = argv[4] if len(argv) >= 5 else None
glob_dict = LoadGlobalDict(glob_dict_file)
if "mount_point" in glob_dict:
@@ -885,6 +966,9 @@
file=sys.stderr)
sys.exit(1)
+ if prop_file_out:
+ glob_dict_out = GlobalDictFromImageProp(image_properties, mount_point)
+ SaveGlobalDict(prop_file_out, glob_dict_out)
if __name__ == '__main__':
try:
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index b6c26bf..a8c821f 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -24,12 +24,12 @@
--downgrade
Intentionally generate an incremental OTA that updates from a newer build
- to an older one (based on timestamp comparison). "post-timestamp" will be
- replaced by "ota-downgrade=yes" in the metadata file. A data wipe will
- always be enforced, so "ota-wipe=yes" will also be included in the
- metadata file. The update-binary in the source build will be used in the
- OTA package, unless --binary flag is specified. Please also check the doc
- for --override_timestamp below.
+ to an older one (e.g. downgrading from P preview back to O MR1).
+ "ota-downgrade=yes" will be set in the package metadata file. A data wipe
+ will always be enforced when using this flag, so "ota-wipe=yes" will also
+ be included in the metadata file. The update-binary in the source build
+ will be used in the OTA package, unless --binary flag is specified. Please
+ also check the comment for --override_timestamp below.
-i (--incremental_from) <file>
Generate an incremental OTA using the given target-files zip as the
@@ -46,14 +46,19 @@
--override_timestamp
Intentionally generate an incremental OTA that updates from a newer build
- to an older one (based on timestamp comparison), by overriding the
- timestamp in package metadata. This differs from --downgrade flag: we know
- for sure this is NOT an actual downgrade case, but two builds are cut in a
- reverse order. A legit use case is that we cut a new build C (after having
- A and B), but want to enfore an update path of A -> C -> B. Specifying
- --downgrade may not help since that would enforce a data wipe for C -> B
- update. The value of "post-timestamp" will be set to the newer timestamp
- plus one, so that the package can be pushed and applied.
+ to an older one (based on timestamp comparison), by setting the downgrade
+ flag in the package metadata. This differs from --downgrade flag, as we
+ don't enforce a data wipe with this flag. Because we know for sure this is
+ NOT an actual downgrade case, but two builds happen to be cut in a reverse
+ order (e.g. from two branches). A legit use case is that we cut a new
+ build C (after having A and B), but want to enfore an update path of A ->
+ C -> B. Specifying --downgrade may not help since that would enforce a
+ data wipe for C -> B update.
+
+ We used to set a fake timestamp in the package metadata for this flow. But
+ now we consolidate the two cases (i.e. an actual downgrade, or a downgrade
+ based on timestamp) with the same "ota-downgrade=yes" flag, with the
+ difference being whether "ota-wipe=yes" is set.
--wipe_user_data
Generate an OTA package that will wipe the user data partition when
@@ -184,7 +189,6 @@
OPTIONS.patch_threshold = 0.95
OPTIONS.wipe_user_data = False
OPTIONS.downgrade = False
-OPTIONS.timestamp = False
OPTIONS.extra_script = None
OPTIONS.worker_threads = multiprocessing.cpu_count() // 2
if OPTIONS.worker_threads == 0:
@@ -902,23 +906,16 @@
if OPTIONS.downgrade:
if not is_downgrade:
- raise RuntimeError("--downgrade specified but no downgrade detected: "
- "pre: %s, post: %s" % (pre_timestamp, post_timestamp))
+ raise RuntimeError(
+ "--downgrade or --override_timestamp specified but no downgrade "
+ "detected: pre: %s, post: %s" % (pre_timestamp, post_timestamp))
metadata["ota-downgrade"] = "yes"
- elif OPTIONS.timestamp:
- if not is_downgrade:
- raise RuntimeError("--override_timestamp specified but no timestamp hack "
- "needed: pre: %s, post: %s" % (pre_timestamp,
- post_timestamp))
- metadata["post-timestamp"] = str(long(pre_timestamp) + 1)
else:
if is_downgrade:
- raise RuntimeError("Downgrade detected based on timestamp check: "
- "pre: %s, post: %s. Need to specify "
- "--override_timestamp OR --downgrade to allow "
- "building the incremental." % (pre_timestamp,
- post_timestamp))
- metadata["post-timestamp"] = post_timestamp
+ raise RuntimeError(
+ "Downgrade detected based on timestamp check: pre: %s, post: %s. "
+ "Need to specify --override_timestamp OR --downgrade to allow "
+ "building the incremental." % (pre_timestamp, post_timestamp))
def GetPackageMetadata(target_info, source_info=None):
@@ -926,7 +923,7 @@
It generates a dict() that contains the info to be written into an OTA
package (META-INF/com/android/metadata). It also handles the detection of
- downgrade / timestamp override / data wipe based on the global options.
+ downgrade / data wipe based on the global options.
Args:
target_info: The BuildInfo instance that holds the target build info.
@@ -967,11 +964,12 @@
else:
metadata['pre-device'] = target_info.device
- # Detect downgrades, or fill in the post-timestamp.
+ # Use the actual post-timestamp, even for a downgrade case.
+ metadata['post-timestamp'] = target_info.GetBuildProp('ro.build.date.utc')
+
+ # Detect downgrades and set up downgrade flags accordingly.
if is_incremental:
HandleDowngradeMetadata(metadata, target_info, source_info)
- else:
- metadata['post-timestamp'] = target_info.GetBuildProp('ro.build.date.utc')
return metadata
@@ -1026,7 +1024,7 @@
A string with placeholders for the metadata offset/size info, e.g.
"payload.bin:679:343,payload_properties.txt:378:45,metadata: ".
"""
- return self._GetPropertyFilesString(input_zip, reserve_space=True)
+ return self.GetPropertyFilesString(input_zip, reserve_space=True)
class InsufficientSpaceException(Exception):
pass
@@ -1055,7 +1053,7 @@
InsufficientSpaceException: If the reserved length is insufficient to hold
the final string.
"""
- result = self._GetPropertyFilesString(input_zip, reserve_space=False)
+ result = self.GetPropertyFilesString(input_zip, reserve_space=False)
if len(result) > reserved_length:
raise self.InsufficientSpaceException(
'Insufficient reserved space: reserved={}, actual={}'.format(
@@ -1074,12 +1072,22 @@
Raises:
AssertionError: On finding a mismatch.
"""
- actual = self._GetPropertyFilesString(input_zip)
+ actual = self.GetPropertyFilesString(input_zip)
assert actual == expected, \
"Mismatching streaming metadata: {} vs {}.".format(actual, expected)
- def _GetPropertyFilesString(self, zip_file, reserve_space=False):
- """Constructs the property-files string per request."""
+ def GetPropertyFilesString(self, zip_file, reserve_space=False):
+ """
+ Constructs the property-files string per request.
+
+ Args:
+ zip_file: The input ZIP file.
+ reserved_length: The reserved length of the property-files string.
+
+ Returns:
+ A property-files string including the metadata offset/size info, e.g.
+ "payload.bin:679:343,payload_properties.txt:378:45,metadata: ".
+ """
def ComputeEntryOffsetSize(name):
"""Computes the zip entry offset and size."""
@@ -1509,10 +1517,16 @@
common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
+ # TODO(b/110106408): Remove after properly handling the SHA-1 embedded in
+ # the filename argument in updater code. Prior to that, explicitly list
+ # the SHA-1 of the source image, in case the updater tries to find a
+ # matching backup from /cache. Similarly for the call to
+ # script.ApplyPatch() below.
script.PatchCheck("%s:%s:%d:%s:%d:%s" %
(boot_type, boot_device,
source_boot.size, source_boot.sha1,
- target_boot.size, target_boot.sha1))
+ target_boot.size, target_boot.sha1),
+ source_boot.sha1)
size.append(target_boot.size)
if size:
@@ -1786,7 +1800,7 @@
OPTIONS.downgrade = True
OPTIONS.wipe_user_data = True
elif o == "--override_timestamp":
- OPTIONS.timestamp = True
+ OPTIONS.downgrade = True
elif o in ("-o", "--oem_settings"):
OPTIONS.oem_source = a.split(',')
elif o == "--oem_no_mount":
@@ -1864,19 +1878,12 @@
sys.exit(1)
if OPTIONS.downgrade:
- # Sanity check to enforce a data wipe.
- if not OPTIONS.wipe_user_data:
- raise ValueError("Cannot downgrade without a data wipe")
-
# We should only allow downgrading incrementals (as opposed to full).
# Otherwise the device may go back from arbitrary build with this full
# OTA package.
if OPTIONS.incremental_source is None:
raise ValueError("Cannot generate downgradable full OTAs")
- assert not (OPTIONS.downgrade and OPTIONS.timestamp), \
- "Cannot have --downgrade AND --override_timestamp both"
-
# Load the build info dicts from the zip directly or the extracted input
# directory. We don't need to unzip the entire target-files zips, because they
# won't be needed for A/B OTAs (brillo_update_payload does that on its own).
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index fa62c8f..393c33d 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -27,6 +27,12 @@
in the apkcerts.txt file. Option may be repeated to give
multiple extra packages.
+ --skip_apks_with_path_prefix <prefix>
+ Skip signing an APK if it has the matching prefix in its path. The prefix
+ should be matching the entry name, which has partition names in upper
+ case, e.g. "VENDOR/app/", or "SYSTEM_OTHER/preloads/". Option may be
+ repeated to give multiple prefixes.
+
-k (--key_mapping) <src_key=dest_key>
Add a mapping from the key name as specified in apkcerts.txt (the
src_key) to the real key you wish to sign the package with
@@ -118,6 +124,7 @@
OPTIONS = common.OPTIONS
OPTIONS.extra_apks = {}
+OPTIONS.skip_apks_with_path_prefix = set()
OPTIONS.key_map = {}
OPTIONS.rebuild_recovery = False
OPTIONS.replace_ota_keys = False
@@ -144,28 +151,83 @@
return certmap
+def GetApkFileInfo(filename, compressed_extension, skipped_prefixes):
+ """Returns the APK info based on the given filename.
+
+ Checks if the given filename (with path) looks like an APK file, by taking the
+ compressed extension into consideration. If it appears to be an APK file,
+ further checks if the APK file should be skipped when signing, based on the
+ given path prefixes.
+
+ Args:
+ filename: Path to the file.
+ compressed_extension: The extension string of compressed APKs (e.g. ".gz"),
+ or None if there's no compressed APKs.
+ skipped_prefixes: A set/list/tuple of the path prefixes to be skipped.
+
+ Returns:
+ (is_apk, is_compressed, should_be_skipped): is_apk indicates whether the
+ given filename is an APK file. is_compressed indicates whether the APK file
+ is compressed (only meaningful when is_apk is True). should_be_skipped
+ indicates whether the filename matches any of the given prefixes to be
+ skipped.
+
+ Raises:
+ AssertionError: On invalid compressed_extension or skipped_prefixes inputs.
+ """
+ assert compressed_extension is None or compressed_extension.startswith('.'), \
+ "Invalid compressed_extension arg: '{}'".format(compressed_extension)
+
+ # skipped_prefixes should be one of set/list/tuple types. Other types such as
+ # str shouldn't be accepted.
+ assert (isinstance(skipped_prefixes, tuple) or
+ isinstance(skipped_prefixes, set) or
+ isinstance(skipped_prefixes, list)), \
+ "Invalid skipped_prefixes input type: {}".format(
+ type(skipped_prefixes))
+
+ compressed_apk_extension = (
+ ".apk" + compressed_extension if compressed_extension else None)
+ is_apk = (filename.endswith(".apk") or
+ (compressed_apk_extension and
+ filename.endswith(compressed_apk_extension)))
+ if not is_apk:
+ return (False, False, False)
+
+ is_compressed = (compressed_apk_extension and
+ filename.endswith(compressed_apk_extension))
+ should_be_skipped = filename.startswith(tuple(skipped_prefixes))
+ return (True, is_compressed, should_be_skipped)
+
+
def CheckAllApksSigned(input_tf_zip, apk_key_map, compressed_extension):
- """Check that all the APKs we want to sign have keys specified, and
- error out if they don't."""
+ """Checks that all the APKs have keys specified, otherwise errors out.
+
+ Args:
+ input_tf_zip: An open target_files zip file.
+ apk_key_map: A dict of known signing keys key'd by APK names.
+ compressed_extension: The extension string of compressed APKs, such as
+ ".gz", or None if there's no compressed APKs.
+
+ Raises:
+ AssertionError: On finding unknown APKs.
+ """
unknown_apks = []
- compressed_apk_extension = None
- if compressed_extension:
- compressed_apk_extension = ".apk" + compressed_extension
for info in input_tf_zip.infolist():
- if (info.filename.endswith(".apk") or
- (compressed_apk_extension and
- info.filename.endswith(compressed_apk_extension))):
- name = os.path.basename(info.filename)
- if compressed_apk_extension and name.endswith(compressed_apk_extension):
- name = name[:-len(compressed_extension)]
- if name not in apk_key_map:
- unknown_apks.append(name)
- if unknown_apks:
- print("ERROR: no key specified for:\n")
- print(" " + "\n ".join(unknown_apks))
- print("\nUse '-e <apkname>=' to specify a key (which may be an empty "
- "string to not sign this apk).")
- sys.exit(1)
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ info.filename, compressed_extension, OPTIONS.skip_apks_with_path_prefix)
+ if not is_apk or should_be_skipped:
+ continue
+ name = os.path.basename(info.filename)
+ if is_compressed:
+ name = name[:-len(compressed_extension)]
+ if name not in apk_key_map:
+ unknown_apks.append(name)
+
+ assert not unknown_apks, \
+ ("No key specified for:\n {}\n"
+ "Use '-e <apkname>=' to specify a key (which may be an empty string to "
+ "not sign this apk).".format("\n ".join(unknown_apks)))
def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map,
@@ -235,32 +297,33 @@
apk_key_map, key_passwords, platform_api_level,
codename_to_api_level_map,
compressed_extension):
-
- compressed_apk_extension = None
- if compressed_extension:
- compressed_apk_extension = ".apk" + compressed_extension
-
+ # maxsize measures the maximum filename length, including the ones to be
+ # skipped.
maxsize = max(
[len(os.path.basename(i.filename)) for i in input_tf_zip.infolist()
- if (i.filename.endswith('.apk') or
- (compressed_apk_extension and
- i.filename.endswith(compressed_apk_extension)))])
+ if GetApkFileInfo(i.filename, compressed_extension, [])[0]])
system_root_image = misc_info.get("system_root_image") == "true"
for info in input_tf_zip.infolist():
- if info.filename.startswith("IMAGES/"):
+ filename = info.filename
+ if filename.startswith("IMAGES/"):
continue
- data = input_tf_zip.read(info.filename)
+ data = input_tf_zip.read(filename)
out_info = copy.copy(info)
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ filename, compressed_extension, OPTIONS.skip_apks_with_path_prefix)
+
+ if is_apk and should_be_skipped:
+ # Copy skipped APKs verbatim.
+ print(
+ "NOT signing: %s\n"
+ " (skipped due to matching prefix)" % (filename,))
+ common.ZipWriteStr(output_tf_zip, out_info, data)
# Sign APKs.
- if (info.filename.endswith(".apk") or
- (compressed_apk_extension and
- info.filename.endswith(compressed_apk_extension))):
- is_compressed = (compressed_extension and
- info.filename.endswith(compressed_apk_extension))
- name = os.path.basename(info.filename)
+ elif is_apk:
+ name = os.path.basename(filename)
if is_compressed:
name = name[:-len(compressed_extension)]
@@ -272,19 +335,21 @@
common.ZipWriteStr(output_tf_zip, out_info, signed_data)
else:
# an APK we're not supposed to sign.
- print("NOT signing: %s" % (name,))
+ print(
+ "NOT signing: %s\n"
+ " (skipped due to special cert string)" % (name,))
common.ZipWriteStr(output_tf_zip, out_info, data)
# System properties.
- elif info.filename in ("SYSTEM/build.prop",
- "VENDOR/build.prop",
- "SYSTEM/etc/prop.default",
- "BOOT/RAMDISK/prop.default",
- "BOOT/RAMDISK/default.prop", # legacy
- "ROOT/default.prop", # legacy
- "RECOVERY/RAMDISK/prop.default",
- "RECOVERY/RAMDISK/default.prop"): # legacy
- print("Rewriting %s:" % (info.filename,))
+ elif filename in ("SYSTEM/build.prop",
+ "VENDOR/build.prop",
+ "SYSTEM/etc/prop.default",
+ "BOOT/RAMDISK/prop.default",
+ "BOOT/RAMDISK/default.prop", # legacy
+ "ROOT/default.prop", # legacy
+ "RECOVERY/RAMDISK/prop.default",
+ "RECOVERY/RAMDISK/default.prop"): # legacy
+ print("Rewriting %s:" % (filename,))
if stat.S_ISLNK(info.external_attr >> 16):
new_data = data
else:
@@ -293,20 +358,20 @@
# Replace the certs in *mac_permissions.xml (there could be multiple, such
# as {system,vendor}/etc/selinux/{plat,nonplat}_mac_permissions.xml).
- elif info.filename.endswith("mac_permissions.xml"):
- print("Rewriting %s with new keys." % (info.filename,))
+ elif filename.endswith("mac_permissions.xml"):
+ print("Rewriting %s with new keys." % (filename,))
new_data = ReplaceCerts(data)
common.ZipWriteStr(output_tf_zip, out_info, new_data)
# Ask add_img_to_target_files to rebuild the recovery patch if needed.
- elif info.filename in ("SYSTEM/recovery-from-boot.p",
- "SYSTEM/etc/recovery.img",
- "SYSTEM/bin/install-recovery.sh"):
+ elif filename in ("SYSTEM/recovery-from-boot.p",
+ "SYSTEM/etc/recovery.img",
+ "SYSTEM/bin/install-recovery.sh"):
OPTIONS.rebuild_recovery = True
# Don't copy OTA keys if we're replacing them.
elif (OPTIONS.replace_ota_keys and
- info.filename in (
+ filename in (
"BOOT/RAMDISK/res/keys",
"BOOT/RAMDISK/etc/update_engine/update-payload-key.pub.pem",
"RECOVERY/RAMDISK/res/keys",
@@ -315,22 +380,21 @@
pass
# Skip META/misc_info.txt since we will write back the new values later.
- elif info.filename == "META/misc_info.txt":
+ elif filename == "META/misc_info.txt":
pass
# Skip verity public key if we will replace it.
elif (OPTIONS.replace_verity_public_key and
- info.filename in ("BOOT/RAMDISK/verity_key",
- "ROOT/verity_key")):
+ filename in ("BOOT/RAMDISK/verity_key",
+ "ROOT/verity_key")):
pass
# Skip verity keyid (for system_root_image use) if we will replace it.
- elif (OPTIONS.replace_verity_keyid and
- info.filename == "BOOT/cmdline"):
+ elif OPTIONS.replace_verity_keyid and filename == "BOOT/cmdline":
pass
# Skip the care_map as we will regenerate the system/vendor images.
- elif info.filename == "META/care_map.txt":
+ elif filename == "META/care_map.txt":
pass
# A non-APK file; copy it verbatim.
@@ -763,6 +827,12 @@
names = names.split(",")
for n in names:
OPTIONS.extra_apks[n] = key
+ elif o == "--skip_apks_with_path_prefix":
+ # Sanity check the prefix, which must be in all upper case.
+ prefix = a.split('/')[0]
+ if not prefix or prefix != prefix.upper():
+ raise ValueError("Invalid path prefix '%s'" % (a,))
+ OPTIONS.skip_apks_with_path_prefix.add(a)
elif o in ("-d", "--default_key_mappings"):
key_mapping_options.append((None, a))
elif o in ("-k", "--key_mapping"):
@@ -822,6 +892,7 @@
extra_opts="e:d:k:ot:",
extra_long_opts=[
"extra_apks=",
+ "skip_apks_with_path_prefix=",
"default_key_mappings=",
"key_mapping=",
"replace_ota_keys",
diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py
index 0eb24b5..e472363 100644
--- a/tools/releasetools/test_ota_from_target_files.py
+++ b/tools/releasetools/test_ota_from_target_files.py
@@ -532,31 +532,7 @@
'post-build-incremental' : 'build-version-incremental-target',
'post-sdk-level' : '27',
'post-security-patch-level' : '2017-12-01',
- 'pre-device' : 'product-device',
- 'pre-build' : 'build-fingerprint-source',
- 'pre-build-incremental' : 'build-version-incremental-source',
- },
- metadata)
-
- def test_GetPackageMetadata_overrideTimestamp(self):
- target_info_dict = copy.deepcopy(self.TEST_TARGET_INFO_DICT)
- source_info_dict = copy.deepcopy(self.TEST_SOURCE_INFO_DICT)
- self._test_GetPackageMetadata_swapBuildTimestamps(
- target_info_dict, source_info_dict)
-
- target_info = BuildInfo(target_info_dict, None)
- source_info = BuildInfo(source_info_dict, None)
- common.OPTIONS.incremental_source = ''
- common.OPTIONS.timestamp = True
- metadata = GetPackageMetadata(target_info, source_info)
- self.assertDictEqual(
- {
- 'ota-type' : 'BLOCK',
- 'post-build' : 'build-fingerprint-target',
- 'post-build-incremental' : 'build-version-incremental-target',
- 'post-sdk-level' : '27',
- 'post-security-patch-level' : '2017-12-01',
- 'post-timestamp' : '1500000001',
+ 'post-timestamp' : '1400000000',
'pre-device' : 'product-device',
'pre-build' : 'build-fingerprint-source',
'pre-build-incremental' : 'build-version-incremental-source',
@@ -774,8 +750,7 @@
zip_file = self.construct_zip_package(entries)
property_files = TestPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
streaming_metadata = property_files.Finalize(zip_fp, len(raw_metadata))
tokens = self._parse_property_files_string(streaming_metadata)
@@ -798,8 +773,7 @@
property_files = TestPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
# First get the raw metadata string (i.e. without padding space).
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
raw_length = len(raw_metadata)
@@ -833,8 +807,7 @@
property_files = TestPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
# First get the raw metadata string (i.e. without padding space).
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
# Should pass the test if verification passes.
@@ -891,8 +864,7 @@
zip_file = self.construct_zip_package(entries)
property_files = StreamingPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
streaming_metadata = property_files.Finalize(zip_fp, len(raw_metadata))
tokens = self._parse_property_files_string(streaming_metadata)
@@ -915,8 +887,7 @@
property_files = StreamingPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
# First get the raw metadata string (i.e. without padding space).
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
# Should pass the test if verification passes.
@@ -1051,8 +1022,7 @@
zip_file = self.construct_zip_package_withValidPayload(with_metadata=True)
property_files = AbOtaPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files_string = property_files.Finalize(zip_fp, len(raw_metadata))
@@ -1067,8 +1037,7 @@
zip_file = self.construct_zip_package_withValidPayload(with_metadata=True)
property_files = AbOtaPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files.Verify(zip_fp, raw_metadata)
@@ -1101,8 +1070,7 @@
zip_file = self.construct_zip_package(entries)
property_files = NonAbOtaPropertyFiles()
with zipfile.ZipFile(zip_file) as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files_string = property_files.Finalize(zip_fp, len(raw_metadata))
tokens = self._parse_property_files_string(property_files_string)
@@ -1119,8 +1087,7 @@
zip_file = self.construct_zip_package(entries)
property_files = NonAbOtaPropertyFiles()
with zipfile.ZipFile(zip_file) as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files.Verify(zip_fp, raw_metadata)
diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py
index 26f9e10..ac1b567 100644
--- a/tools/releasetools/test_sign_target_files_apks.py
+++ b/tools/releasetools/test_sign_target_files_apks.py
@@ -24,7 +24,8 @@
import common
import test_utils
from sign_target_files_apks import (
- EditTags, ReplaceCerts, ReplaceVerityKeyId, RewriteProps)
+ CheckAllApksSigned, EditTags, GetApkFileInfo, ReplaceCerts,
+ ReplaceVerityKeyId, RewriteProps)
class SignTargetFilesApksTest(unittest.TestCase):
@@ -211,3 +212,141 @@
cert2_path[:-9] : 'non-existent',
}
self.assertEqual(output_xml, ReplaceCerts(input_xml))
+
+ def test_CheckAllApksSigned(self):
+ input_file = common.MakeTempFile(suffix='.zip')
+ with zipfile.ZipFile(input_file, 'w') as input_zip:
+ input_zip.writestr('SYSTEM/app/App1.apk', "App1-content")
+ input_zip.writestr('SYSTEM/app/App2.apk.gz', "App2-content")
+
+ apk_key_map = {
+ 'App1.apk' : 'key1',
+ 'App2.apk' : 'key2',
+ 'App3.apk' : 'key3',
+ }
+ with zipfile.ZipFile(input_file) as input_zip:
+ CheckAllApksSigned(input_zip, apk_key_map, None)
+ CheckAllApksSigned(input_zip, apk_key_map, '.gz')
+
+ # 'App2.apk.gz' won't be considered as an APK.
+ CheckAllApksSigned(input_zip, apk_key_map, None)
+ CheckAllApksSigned(input_zip, apk_key_map, '.xz')
+
+ del apk_key_map['App2.apk']
+ self.assertRaises(
+ AssertionError, CheckAllApksSigned, input_zip, apk_key_map, '.gz')
+
+ def test_GetApkFileInfo(self):
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/apps/Chats.apk", None, [])
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/apps/Chats.apk", None, [])
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/apps/Chats.dat", None, [])
+ self.assertFalse(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ def test_GetApkFileInfo_withCompressedApks(self):
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/apps/Chats.apk.gz", ".gz", [])
+ self.assertTrue(is_apk)
+ self.assertTrue(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/apps/Chats.apk.gz", ".xz", [])
+ self.assertFalse(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ self.assertRaises(
+ AssertionError, GetApkFileInfo, "PRODUCT/apps/Chats.apk", "", [])
+
+ self.assertRaises(
+ AssertionError, GetApkFileInfo, "PRODUCT/apps/Chats.apk", "apk", [])
+
+ def test_GetApkFileInfo_withSkippedPrefixes(self):
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/preloads/apps/Chats.apk", None, set())
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "PRODUCT/preloads/apps/Chats.apk",
+ None,
+ set(["PRODUCT/preloads/"]))
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertTrue(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "SYSTEM_OTHER/preloads/apps/Chats.apk",
+ None,
+ set(["SYSTEM/preloads/", "SYSTEM_OTHER/preloads/"]))
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertTrue(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "SYSTEM_OTHER/preloads/apps/Chats.apk.gz",
+ ".gz",
+ set(["PRODUCT/prebuilts/", "SYSTEM_OTHER/preloads/"]))
+ self.assertTrue(is_apk)
+ self.assertTrue(is_compressed)
+ self.assertTrue(should_be_skipped)
+
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "SYSTEM_OTHER/preloads/apps/Chats.dat",
+ None,
+ set(["SYSTEM_OTHER/preloads/"]))
+ self.assertFalse(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertFalse(should_be_skipped)
+
+ def test_GetApkFileInfo_checkSkippedPrefixesInput(self):
+ # set
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "SYSTEM_OTHER/preloads/apps/Chats.apk",
+ None,
+ set(["SYSTEM_OTHER/preloads/"]))
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertTrue(should_be_skipped)
+
+ # tuple
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "SYSTEM_OTHER/preloads/apps/Chats.apk",
+ None,
+ ("SYSTEM_OTHER/preloads/",))
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertTrue(should_be_skipped)
+
+ # list
+ (is_apk, is_compressed, should_be_skipped) = GetApkFileInfo(
+ "SYSTEM_OTHER/preloads/apps/Chats.apk",
+ None,
+ ["SYSTEM_OTHER/preloads/"])
+ self.assertTrue(is_apk)
+ self.assertFalse(is_compressed)
+ self.assertTrue(should_be_skipped)
+
+ # str is invalid.
+ self.assertRaises(
+ AssertionError, GetApkFileInfo, "SYSTEM_OTHER/preloads/apps/Chats.apk",
+ None, "SYSTEM_OTHER/preloads/")
+
+ # None is invalid.
+ self.assertRaises(
+ AssertionError, GetApkFileInfo, "SYSTEM_OTHER/preloads/apps/Chats.apk",
+ None, None)
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index e8cea29..886de26 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -66,7 +66,7 @@
file_name, actual_sha1, expected_sha1)
-def ValidateFileConsistency(input_zip, input_tmp):
+def ValidateFileConsistency(input_zip, input_tmp, info_dict):
"""Compare the files from image files and unpacked folders."""
def CheckAllFiles(which):
@@ -90,6 +90,12 @@
logging.warning('Skipping %s that has incomplete block list', entry)
continue
+ # TODO(b/79951650): Handle files with non-monotonic ranges.
+ if not ranges.monotonic:
+ logging.warning(
+ 'Skipping %s that has non-monotonic ranges: %s', entry, ranges)
+ continue
+
blocks_sha1 = image.RangeSha1(ranges)
# The filename under unpacked directory, such as SYSTEM/bin/sh.
@@ -103,6 +109,11 @@
logging.info('Validating file consistency.')
+ # TODO(b/79617342): Validate non-sparse images.
+ if info_dict.get('extfs_sparse_flag') != '-s':
+ logging.warning('Skipped due to target using non-sparse images')
+ return
+
# Verify IMAGES/system.img.
CheckAllFiles('system')
@@ -324,10 +335,10 @@
logging.info("Unzipping the input target_files.zip: %s", args.target_files)
input_tmp = common.UnzipTemp(args.target_files)
- with zipfile.ZipFile(args.target_files, 'r') as input_zip:
- ValidateFileConsistency(input_zip, input_tmp)
-
info_dict = common.LoadInfoDict(input_tmp)
+ with zipfile.ZipFile(args.target_files, 'r') as input_zip:
+ ValidateFileConsistency(input_zip, input_tmp, info_dict)
+
ValidateInstallRecoveryScript(input_tmp, info_dict)
ValidateVerifiedBootImages(input_tmp, info_dict, options)
diff --git a/tools/signapk/src/com/android/signapk/CountingOutputStream.java b/tools/signapk/src/com/android/signapk/CountingOutputStream.java
new file mode 100644
index 0000000..893a780
--- /dev/null
+++ b/tools/signapk/src/com/android/signapk/CountingOutputStream.java
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+package com.android.signapk;
+import java.io.OutputStream;
+import java.io.IOException;
+
+class CountingOutputStream extends OutputStream {
+ private final OutputStream mBase;
+ private long mWrittenBytes;
+
+ public CountingOutputStream(OutputStream base) {
+ mBase = base;
+ }
+
+ @Override
+ public void close() throws IOException {
+ mBase.close();
+ }
+
+ @Override
+ public void flush() throws IOException {
+ mBase.flush();
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ mBase.write(b);
+ mWrittenBytes += b.length;
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ mBase.write(b, off, len);
+ mWrittenBytes += len;
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ mBase.write(b);
+ mWrittenBytes += 1;
+ }
+
+ public long getWrittenBytes() {
+ return mWrittenBytes;
+ }
+}
diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
index fdf6283..57973ec 100644
--- a/tools/signapk/src/com/android/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -36,6 +36,7 @@
import com.android.apksig.ApkSignerEngine;
import com.android.apksig.DefaultApkSignerEngine;
+import com.android.apksig.Hints;
import com.android.apksig.apk.ApkUtils;
import com.android.apksig.apk.MinSdkVersionException;
import com.android.apksig.util.DataSink;
@@ -73,6 +74,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
@@ -80,6 +82,7 @@
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
import javax.crypto.Cipher;
import javax.crypto.EncryptedPrivateKeyInfo;
@@ -372,11 +375,16 @@
Pattern ignoredFilenamePattern,
ApkSignerEngine apkSigner,
JarOutputStream out,
+ CountingOutputStream outCounter,
long timestamp,
int defaultAlignment) throws IOException {
byte[] buffer = new byte[4096];
int num;
+ List<Pattern> pinPatterns = extractPinPatterns(in);
+ ArrayList<Hints.ByteRange> pinByteRanges = pinPatterns == null ? null : new ArrayList<>();
+ HashSet<String> namesToPin = new HashSet<>();
+
ArrayList<String> names = new ArrayList<String>();
for (Enumeration<JarEntry> e = in.entries(); e.hasMoreElements();) {
JarEntry entry = e.nextElement();
@@ -388,6 +396,16 @@
&& (ignoredFilenamePattern.matcher(entryName).matches())) {
continue;
}
+ if (Hints.PIN_BYTE_RANGE_ZIP_ENTRY_NAME.equals(entryName)) {
+ continue; // We regenerate it below.
+ }
+ if (pinPatterns != null) {
+ for (Pattern pinPattern : pinPatterns) {
+ if (pinPattern.matcher(entryName).matches()) {
+ namesToPin.add(entryName);
+ }
+ }
+ }
names.add(entryName);
}
Collections.sort(names);
@@ -460,6 +478,7 @@
outEntry.setExtra(extra);
offset += extra.length;
+ long entryHeaderStart = outCounter.getWrittenBytes();
out.putNextEntry(outEntry);
ApkSignerEngine.InspectJarEntryRequest inspectEntryRequest =
(apkSigner != null) ? apkSigner.outputJarEntry(name) : null;
@@ -475,10 +494,18 @@
offset += num;
}
}
+ out.closeEntry();
out.flush();
if (inspectEntryRequest != null) {
inspectEntryRequest.done();
}
+
+ if (namesToPin.contains(name)) {
+ pinByteRanges.add(
+ new Hints.ByteRange(
+ entryHeaderStart,
+ outCounter.getWrittenBytes()));
+ }
}
// Copy all the non-STORED entries. We don't attempt to
@@ -494,6 +521,7 @@
// Create a new entry so that the compressed len is recomputed.
JarEntry outEntry = new JarEntry(name);
outEntry.setTime(timestamp);
+ long entryHeaderStart = outCounter.getWrittenBytes();
out.putNextEntry(outEntry);
ApkSignerEngine.InspectJarEntryRequest inspectEntryRequest =
(apkSigner != null) ? apkSigner.outputJarEntry(name) : null;
@@ -507,11 +535,47 @@
entryDataSink.consume(buffer, 0, num);
}
}
+ out.closeEntry();
out.flush();
if (inspectEntryRequest != null) {
inspectEntryRequest.done();
}
+
+ if (namesToPin.contains(name)) {
+ pinByteRanges.add(
+ new Hints.ByteRange(
+ entryHeaderStart,
+ outCounter.getWrittenBytes()));
+ }
}
+
+ if (pinByteRanges != null) {
+ // Cover central directory
+ pinByteRanges.add(
+ new Hints.ByteRange(outCounter.getWrittenBytes(),
+ Long.MAX_VALUE));
+ addPinByteRanges(out, pinByteRanges, timestamp);
+ }
+ }
+
+ private static List<Pattern> extractPinPatterns(JarFile in) throws IOException {
+ ZipEntry pinMetaEntry = in.getEntry(Hints.PIN_HINT_ASSET_ZIP_ENTRY_NAME);
+ if (pinMetaEntry == null) {
+ return null;
+ }
+ InputStream pinMetaStream = in.getInputStream(pinMetaEntry);
+ byte[] patternBlob = new byte[(int) pinMetaEntry.getSize()];
+ pinMetaStream.read(patternBlob);
+ return Hints.parsePinPatterns(patternBlob);
+ }
+
+ private static void addPinByteRanges(JarOutputStream outputJar,
+ ArrayList<Hints.ByteRange> pinByteRanges,
+ long timestamp) throws IOException {
+ JarEntry je = new JarEntry(Hints.PIN_BYTE_RANGE_ZIP_ENTRY_NAME);
+ je.setTime(timestamp);
+ outputJar.putNextEntry(je);
+ outputJar.write(Hints.encodeByteRangeList(pinByteRanges));
}
private static boolean shouldOutputApkEntry(
@@ -679,9 +743,11 @@
public void write(OutputStream out) throws IOException {
try {
signer = new WholeFileSignerOutputStream(out, outputStream);
- JarOutputStream outputJar = new JarOutputStream(signer);
+ CountingOutputStream outputJarCounter = new CountingOutputStream(signer);
+ JarOutputStream outputJar = new JarOutputStream(outputJarCounter);
- copyFiles(inputJar, STRIP_PATTERN, null, outputJar, timestamp, 0);
+ copyFiles(inputJar, STRIP_PATTERN, null, outputJar,
+ outputJarCounter, timestamp, 0);
addOtacert(outputJar, publicKeyFile, timestamp);
signer.notifyClosing();
@@ -1065,11 +1131,14 @@
// Build the output APK in memory, by copying input APK's ZIP entries across
// and then signing the output APK.
ByteArrayOutputStream v1SignedApkBuf = new ByteArrayOutputStream();
- JarOutputStream outputJar = new JarOutputStream(v1SignedApkBuf);
+ CountingOutputStream outputJarCounter =
+ new CountingOutputStream(v1SignedApkBuf);
+ JarOutputStream outputJar = new JarOutputStream(outputJarCounter);
// Use maximum compression for compressed entries because the APK lives forever
// on the system partition.
outputJar.setLevel(9);
- copyFiles(inputJar, null, apkSigner, outputJar, timestamp, alignment);
+ copyFiles(inputJar, null, apkSigner, outputJar,
+ outputJarCounter, timestamp, alignment);
ApkSignerEngine.OutputJarSignatureRequest addV1SignatureRequest =
apkSigner.outputJarEntries();
if (addV1SignatureRequest != null) {
diff --git a/tools/warn.py b/tools/warn.py
index 01398be..89f4778 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -177,6 +177,9 @@
{'category': 'make', 'severity': Severity.MEDIUM,
'description': 'Invalid SDK/NDK linking',
'patterns': [r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"]},
+ {'category': 'make', 'severity': Severity.MEDIUM,
+ 'description': 'Duplicate header copy',
+ 'patterns': [r".*: warning: Duplicate header copy: .+"]},
{'category': 'C/C++', 'severity': Severity.HIGH, 'option': '-Wimplicit-function-declaration',
'description': 'Implicit function declaration',
'patterns': [r".*: warning: implicit declaration of function .+",
@@ -238,9 +241,11 @@
'description': 'Unused parameter',
'patterns': [r".*: warning: unused parameter '.*'"]},
{'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wunused',
- 'description': 'Unused function, variable or label',
+ 'description': 'Unused function, variable, label, comparison, etc.',
'patterns': [r".*: warning: '.+' defined but not used",
r".*: warning: unused function '.+'",
+ r".*: warning: unused label '.+'",
+ r".*: warning: relational comparison result unused",
r".*: warning: lambda capture .* is not used",
r".*: warning: private field '.+' is not used",
r".*: warning: unused variable '.+'"]},
@@ -494,18 +499,23 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: Use parameter comments to document ambiguous literals',
+ 'patterns': [r".*: warning: \[BooleanParameter\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Field name is CONSTANT_CASE, but field is not static and final',
+ 'patterns': [r".*: warning: \[ConstantField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
- 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
- 'patterns': [r".*: warning: \[UseBinds\] .+"]},
+ 'Java: This field is only assigned during initialization; consider making it final',
+ 'patterns': [r".*: warning: \[FieldCanBeFinal\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
@@ -514,41 +524,11 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
- 'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Methods that can return null should be annotated @Nullable',
- 'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Use parameter comments to document ambiguous literals',
- 'patterns': [r".*: warning: \[BooleanParameter\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Field name is CONSTANT CASE, but field is not static and final',
- 'patterns': [r".*: warning: \[ConstantField\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Deprecated item is not annotated with @Deprecated',
- 'patterns': [r".*: warning: \[DepAnn\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
+ r'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
'patterns': [r".*: warning: \[LambdaFunctionalInterface\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
- 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
'Java: A private method that does not reference the enclosing instance can be static',
'patterns': [r".*: warning: \[MethodCanBeStatic\] .+"]},
{'category': 'java',
@@ -584,6 +564,16 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: Method parameters that aren\'t checked for null shouldn\'t be annotated @Nullable',
+ 'patterns': [r".*: warning: \[ParameterNotNullable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
+ 'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModule\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]},
{'category': 'java',
@@ -594,6 +584,16 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: Methods that can return null should be annotated @Nullable',
+ 'patterns': [r".*: warning: \[ReturnMissingNullable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
+ 'Java: Scopes on modules have no function and will soon be an error.',
+ 'patterns': [r".*: warning: \[ScopeOnModule\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: The default case of a switch should appear at the end of the last statement group',
'patterns': [r".*: warning: \[SwitchDefault\] .+"]},
{'category': 'java',
@@ -624,78 +624,18 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
+ 'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
+ 'patterns': [r".*: warning: \[UseBinds\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.LOW,
+ 'description':
'Java: Wildcard imports, static or otherwise, should not be used',
'patterns': [r".*: warning: \[WildcardImport\] .+"]},
{'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: ',
- 'patterns': [r".*: warning: \[RemoveFieldPrefixes\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Prefer assertThrows to ExpectedException',
- 'patterns': [r".*: warning: \[ExpectedExceptionMigration\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Logger instances are not constants -- they are mutable and have side effects -- and should not be named using CONSTANT CASE',
- 'patterns': [r".*: warning: \[LoggerVariableCase\] .+"]},
- {'category': 'java',
- 'severity': Severity.LOW,
- 'description':
- 'Java: Prefer assertThrows to @Test(expected=...)',
- 'patterns': [r".*: warning: \[TestExceptionMigration\] .+"]},
- {'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Public fields must be final.',
- 'patterns': [r".*: warning: \[NonFinalPublicFields\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Private fields that are only assigned in the initializer should be made final.',
- 'patterns': [r".*: warning: \[PrivateFieldsNotAssigned\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Lists returned by methods should be immutable.',
- 'patterns': [r".*: warning: \[ReturnedListNotImmutable\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Parameters to log methods should not be generated by a call to String.format() or MessageFormat.format().',
- 'patterns': [r".*: warning: \[SaferLoggerFormat\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Parameters to log methods should not be generated by a call to toString(); see b/22986665.',
- 'patterns': [r".*: warning: \[SaferLoggerToString\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
- 'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
- 'patterns': [r".*: warning: \[FragmentInjection\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
- 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Hardcoded reference to /sdcard',
- 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
- 'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]},
+ 'Java: Method reference is ambiguous',
+ 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -709,81 +649,26 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: An equality test between objects with incompatible types always returns false',
- 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
- 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
- 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.',
- 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: This code declares a binding for a common value type without a Qualifier annotation.',
- 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
- 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
- 'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Double-checked locking on non-volatile fields is unsafe',
- 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Annotations should always be immutable',
- 'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Enums should always be immutable',
- 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Writes to static fields should not be guarded by instance locks',
- 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
- 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Method reference is ambiguous',
- 'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
'Java: Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead',
'patterns': [r".*: warning: \[AssertFalse\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: The lambda passed to assertThows should contain exactly one statement',
+ 'patterns': [r".*: warning: \[AssertThrowsMultipleStatements\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.',
'patterns': [r".*: warning: \[AssertionFailureIgnored\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
+ 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.',
'patterns': [r".*: warning: \[BadAnnotationImplementation\] .+"]},
{'category': 'java',
@@ -799,11 +684,26 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code.',
+ 'patterns': [r".*: warning: \[BinderIdentityRestoredDangerously\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: This code declares a binding for a common value type without a Qualifier annotation.',
+ 'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: valueOf or autoboxing provides better time and space performance',
'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: ByteBuffer.array() shouldn\'t be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().',
+ 'patterns': [r".*: warning: \[ByteBufferBackingArray\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Mockito cannot mock final classes',
'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
{'category': 'java',
@@ -864,11 +764,21 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Implicit use of the platform default charset, which can result in differing behavior between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
+ 'Java: Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn\'t match expectations.',
'patterns': [r".*: warning: \[DefaultCharset\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Prefer collection factory methods or builders to the double-brace initialization pattern.',
+ 'patterns': [r".*: warning: \[DoubleBraceInitialization\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Double-checked locking on non-volatile fields is unsafe',
+ 'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Empty top-level type declaration',
'patterns': [r".*: warning: \[EmptyTopLevelDeclaration\] .+"]},
{'category': 'java',
@@ -879,6 +789,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: An equality test between objects with incompatible types always returns false',
+ 'patterns': [r".*: warning: \[EqualsIncompatibleType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Calls to ExpectedException#expect should always be followed by exactly one statement.',
'patterns': [r".*: warning: \[ExpectedExceptionChecker\] .+"]},
{'category': 'java',
@@ -904,6 +819,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.',
+ 'patterns': [r".*: warning: \[FragmentInjection\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
+ 'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Overloads will be ambiguous when passing lambda arguments',
'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]},
{'category': 'java',
@@ -919,21 +844,51 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Hardcoded reference to /sdcard',
+ 'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Hiding fields of superclasses may cause confusion and errors',
'patterns': [r".*: warning: \[HidingField\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Annotations should always be immutable',
+ 'patterns': [r".*: warning: \[ImmutableAnnotationChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Enums should always be immutable',
+ 'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: It is confusing to have a field and a parameter under the same scope that differ only in capitalization.',
+ 'patterns': [r".*: warning: \[InconsistentCapitalization\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)',
+ 'patterns': [r".*: warning: \[InconsistentOverloads\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: This for loop increments the same variable in the header and in the body',
'patterns': [r".*: warning: \[IncrementInForLoopAndHeader\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
+ 'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]},
{'category': 'java',
@@ -1064,6 +1019,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Calling toString on Objects that don\'t override toString() doesn\'t provide useful information',
+ 'patterns': [r".*: warning: \[ObjectToString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Use grouping parenthesis to make the operator precedence explicit',
'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]},
{'category': 'java',
@@ -1089,6 +1049,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
+ 'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Detects `/* name= */`-style comments on actual parameters where the name doesn\'t match the formal parameter',
'patterns': [r".*: warning: \[ParameterName\] .+"]},
{'category': 'java',
@@ -1114,6 +1079,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Qualifiers/Scope annotations on @Inject methods don\'t have any effect. Move the qualifier annotation to the binding location.',
+ 'patterns': [r".*: warning: \[QualifierOrScopeOnInjectMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
+ 'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.',
+ 'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: reachabilityFence should always be called inside a finally block',
'patterns': [r".*: warning: \[ReachabilityFenceUsage\] .+"]},
{'category': 'java',
@@ -1134,11 +1109,16 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
+ r'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
'patterns': [r".*: warning: \[ShortCircuitBoolean\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Writes to static fields should not be guarded by instance locks',
+ 'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: A static variable or method should be qualified with a class name, not expression',
'patterns': [r".*: warning: \[StaticQualifiedUsingExpression\] .+"]},
{'category': 'java',
@@ -1154,13 +1134,13 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: String.split should never take only a single argument; it has surprising behavior',
- 'patterns': [r".*: warning: \[StringSplit\] .+"]},
+ 'Java: String.split(String) has surprising behavior',
+ 'patterns': [r".*: warning: \[StringSplitter\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Prefer Splitter to String.split',
- 'patterns': [r".*: warning: \[StringSplitter\] .+"]},
+ 'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
+ 'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
@@ -1189,6 +1169,11 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
+ 'Java: Argument is not compatible with the subject\'s type.',
+ 'patterns': [r".*: warning: \[TruthIncompatibleType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.MEDIUM,
+ 'description':
'Java: Type parameter declaration overrides another type parameter already declared',
'patterns': [r".*: warning: \[TypeParameterShadowing\] .+"]},
{'category': 'java',
@@ -1199,7 +1184,7 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Creation of a Set/HashSet/HashMap of java.net.URL. equals() and hashCode() of java.net.URL class make blocking internet connections.',
+ 'Java: Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.',
'patterns': [r".*: warning: \[URLEqualsHashCode\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
@@ -1234,208 +1219,13 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Pluggable Type checker internal error',
- 'patterns': [r".*: warning: \[PluggableTypeChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Invalid message format-style format specifier ({0}), expected printf-style (%s)',
- 'patterns': [r".*: warning: \[FloggerMessageFormat\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Logger level check is already implied in the log() call. An explicit at[Level]().isEnabled() check is redundant.',
- 'patterns': [r".*: warning: \[FloggerRedundantIsEnabled\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Calling withCause(Throwable) with an inline allocated Throwable is discouraged. Consider using withStackTrace(StackSize) instead, and specifying a reduced stack size (e.g. SMALL, MEDIUM or LARGE) instead of FULL, to improve performance.',
- 'patterns': [r".*: warning: \[FloggerWithCause\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Use withCause to associate Exceptions with log statements',
- 'patterns': [r".*: warning: \[FloggerWithoutCause\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: No bug exists to track an ignored test',
- 'patterns': [r".*: warning: \[IgnoredTestWithoutBug\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: @Ignore is preferred to @Suppress for JUnit4 tests. @Suppress may silently fail in JUnit4 (that is, tests may run anyway.)',
- 'patterns': [r".*: warning: \[JUnit4SuppressWithoutIgnore\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Medium and large test classes should document why they are medium or large',
- 'patterns': [r".*: warning: \[JUnit4TestAttributeMissing\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: java.net.IDN implements the older IDNA2003 standard. Prefer com.google.i18n.Idn, which implements the newer UTS #46 standard',
- 'patterns': [r".*: warning: \[JavaNetIdn\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Consider requiring strict parsing on JodaDurationFlag instances. Before adjusting existing flags, check the documentation and your existing configuration to avoid crashes!',
- 'patterns': [r".*: warning: \[JodaDurationFlagStrictParsing\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Logging an exception and throwing it (or a new exception) for the same exceptional situation is an anti-pattern.',
- 'patterns': [r".*: warning: \[LogAndThrow\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: FormattingLogger uses wrong or mismatched format string',
- 'patterns': [r".*: warning: \[MisusedFormattingLogger\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Flags should be final',
- 'patterns': [r".*: warning: \[NonFinalFlag\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Reading a flag from a static field or initializer block will cause it to always receive the default value and will cause an IllegalFlagStateException if the flag is ever set.',
- 'patterns': [r".*: warning: \[StaticFlagUsage\] .+"]},
- {'category': 'java',
- 'severity': Severity.MEDIUM,
- 'description':
- 'Java: Apps must use BuildCompat.isAtLeastO to check whether they\'re running on Android O',
- 'patterns': [r".*: warning: \[UnsafeSdkVersionCheck\] .+"]},
+ 'Java: A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
+ 'patterns': [r".*: warning: \[WakelockReleasedDangerously\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Logging tag cannot be longer than 23 characters.',
- 'patterns': [r".*: warning: \[LogTagLength\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Relative class name passed to ComponentName constructor',
- 'patterns': [r".*: warning: \[RelativeComponentName\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Explicitly enumerate all cases in switch statements for certain enum types.',
- 'patterns': [r".*: warning: \[EnumerateAllCasesInEnumSwitch\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Do not call assumeTrue(tester.getExperimentValueFor(...)). Use @RequireEndToEndTestExperiment instead.',
- 'patterns': [r".*: warning: \[JUnitAssumeExperiment\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: The accessed field or method is not visible here. Note that the default production visibility for @VisibleForTesting is Visibility.PRIVATE.',
- 'patterns': [r".*: warning: \[VisibleForTestingChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Detects errors encountered building Error Prone plugins',
- 'patterns': [r".*: warning: \[ErrorPronePluginCorrectness\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Parcelable CREATOR fields should be Creator\u003cT>',
- 'patterns': [r".*: warning: \[ParcelableCreatorType\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Enforce reflected Parcelables are kept by Proguard',
- 'patterns': [r".*: warning: \[ReflectedParcelable\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Any class that extends IntentService should have @Nullable notation on method onHandleIntent(@Nullable Intent intent) and handle the case if intent is null.',
- 'patterns': [r".*: warning: \[OnHandleIntentNullableChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: In many cases, randomUUID is not necessary, and it slows the performance, which can be quite severe especially when this operation happens at start up time. Consider replacing it with cheaper alternatives, like object.hashCode() or IdGenerator.INSTANCE.getRandomId()',
- 'patterns': [r".*: warning: \[UUIDChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: DynamicActivity.findViewById(int) is slow and should not be used inside View.onDraw(Canvas)!',
- 'patterns': [r".*: warning: \[NoFindViewByIdInOnDrawChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Passing Throwable/Exception argument to the message format L.x(). Calling L.w(tag, message, ex) instead of L.w(tag, ex, message)',
- 'patterns': [r".*: warning: \[WrongThrowableArgumentInLogChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: New splicers are disallowed on paths that are being Libsearched',
- 'patterns': [r".*: warning: \[BlacklistedSplicerPathChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Object serialized in Bundle may have been flattened to base type.',
- 'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Log tag too long, cannot exceed 23 characters.',
- 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Certain resources in `android.R.string` have names that do not match their content',
- 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Return value of android.graphics.Rect.intersect() must be checked',
- 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Incompatible type as argument to Object-accepting Java collections method',
- 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: @CompatibleWith\'s value is not a type argument.',
- 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Passing argument to a generic method with an incompatible type.',
- 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid printf-style format string',
- 'patterns': [r".*: warning: \[FormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid format string passed to formatting method.',
- 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
- 'patterns': [r".*: warning: \[GuardedBy\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Type declaration annotated with @Immutable is not immutable',
- 'patterns': [r".*: warning: \[Immutable\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
- 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
- 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+ 'Java: AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
+ 'patterns': [r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
@@ -1464,6 +1254,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
+ 'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: AsyncCallable should not return a null Future, only a Future whose result is null.',
'patterns': [r".*: warning: \[AsyncCallableReturnsNull\] .+"]},
{'category': 'java',
@@ -1474,11 +1269,26 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @AutoFactory and @Inject should not be used in the same type.',
+ 'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Arguments to AutoValue constructor are in the wrong order',
+ 'patterns': [r".*: warning: \[AutoValueConstructorOrderChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Shift by an amount that is out of range',
'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Object serialized in Bundle may have been flattened to base type.',
+ 'patterns': [r".*: warning: \[BundleDeserializationCast\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it. It\'s likely that it was intended to.',
'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
{'category': 'java',
@@ -1494,7 +1304,12 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
+ 'Java: Incompatible type as argument to Object-accepting Java collections method',
+ 'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ r'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
'patterns': [r".*: warning: \[ComparableType\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1509,6 +1324,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @CompatibleWith\'s value is not a type argument.',
+ 'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.',
'patterns': [r".*: warning: \[CompileTimeConstant\] .+"]},
{'category': 'java',
@@ -1529,6 +1349,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
+ 'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Exception created but not thrown',
'patterns': [r".*: warning: \[DeadException\] .+"]},
{'category': 'java',
@@ -1539,6 +1364,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Deprecated item is not annotated with @Deprecated',
+ 'patterns': [r".*: warning: \[DepAnn\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Division by integer literal zero',
'patterns': [r".*: warning: \[DivZero\] .+"]},
{'category': 'java',
@@ -1569,6 +1399,16 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Invalid printf-style format string',
+ 'patterns': [r".*: warning: \[FormatString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Invalid format string passed to formatting method.',
+ 'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior.',
'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]},
{'category': 'java',
@@ -1594,6 +1434,26 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
+ 'patterns': [r".*: warning: \[GuardedBy\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
+ 'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
+ 'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
+ 'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: contains() is a legacy method that is equivalent to containsValue()',
'patterns': [r".*: warning: \[HashtableContains\] .+"]},
{'category': 'java',
@@ -1604,11 +1464,21 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Type declaration annotated with @Immutable is not immutable',
+ 'patterns': [r".*: warning: \[Immutable\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
'patterns': [r".*: warning: \[ImmutableModification\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Passing argument to a generic method with an incompatible type.',
+ 'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: The first argument to indexOf is a Unicode code point, and the second is the index to start the search from',
'patterns': [r".*: warning: \[IndexOfChar\] .+"]},
{'category': 'java',
@@ -1624,6 +1494,36 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: A scoping annotation\'s Target should include TYPE and METHOD.',
+ 'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Using more than one qualifier annotation on the same element is not allowed.',
+ 'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: A class can be annotated with at most one scope annotation.',
+ 'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scope annotation on an interface or abstact class is not allowed',
+ 'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Scoping and qualifier annotations must have runtime retention.',
+ 'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Injected constructors cannot be optional nor have binding annotations',
+ 'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]},
{'category': 'java',
@@ -1644,7 +1544,12 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
+ 'Java: Log tag too long, cannot exceed 23 characters.',
+ 'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ r'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
'patterns': [r".*: warning: \[IterablePathParameter\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1674,7 +1579,7 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: This looks like a test method but is not run; please add @Test or @Ignore, or, if this is a helper method, reduce its visibility.',
+ 'Java: This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility.',
'patterns': [r".*: warning: \[JUnit4TestNotRun\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1684,16 +1589,41 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Abstract and default methods are not injectable with javax.inject.Inject',
+ 'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: @javax.inject.Inject cannot be put on a final field.',
+ 'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly',
'patterns': [r".*: warning: \[LiteByteStringUtf8\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: This method does not acquire the locks specified by its @LockMethod annotation',
+ 'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
+ 'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Loop condition is never modified in loop body.',
'patterns': [r".*: warning: \[LoopConditionChecker\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Certain resources in `android.R.string` have names that do not match their content',
+ 'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Overriding method is missing a call to overridden super method',
'patterns': [r".*: warning: \[MissingSuperCall\] .+"]},
{'category': 'java',
@@ -1719,6 +1649,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
+ 'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: The result of this method must be closed.',
'patterns': [r".*: warning: \[MustBeClosedChecker\] .+"]},
{'category': 'java',
@@ -1764,11 +1699,31 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
+ 'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected.',
+ 'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Declaring types inside package-info.java files is very bad form',
'patterns': [r".*: warning: \[PackageInfo\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Method parameter has wrong package',
+ 'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Detects classes which implement Parcelable but don\'t have CREATOR',
+ 'patterns': [r".*: warning: \[ParcelableCreator\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
{'category': 'java',
@@ -1804,6 +1759,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: @Provides methods need to be declared in a Module to have any effect.',
+ 'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.',
'patterns': [r".*: warning: \[RandomCast\] .+"]},
{'category': 'java',
@@ -1814,6 +1774,16 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Return value of android.graphics.Rect.intersect() must be checked',
+ 'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
+ 'Java: Use of method or class annotated with @RestrictTo',
+ 'patterns': [r".*: warning: \[RestrictTo\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Check for non-whitelisted callers to RestrictedApiChecker.',
'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
{'category': 'java',
@@ -1849,6 +1819,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: Static and default interface methods are not natively supported on older Android devices. ',
+ 'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Calling toString on a Stream does not provide useful information',
'patterns': [r".*: warning: \[StreamToString\] .+"]},
{'category': 'java',
@@ -1889,6 +1864,11 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
+ 'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
+ 'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+ {'category': 'java',
+ 'severity': Severity.HIGH,
+ 'description':
'Java: Non-generic methods should not be invoked with type arguments',
'patterns': [r".*: warning: \[UnnecessaryTypeArgument\] .+"]},
{'category': 'java',
@@ -1906,191 +1886,6 @@
'description':
'Java: `var` should not be used as a type name.',
'patterns': [r".*: warning: \[VarTypeName\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Method parameter has wrong package',
- 'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Type declaration annotated with @ThreadSafe is not thread safe',
- 'patterns': [r".*: warning: \[ThreadSafe\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of class, field, or method that is not compatible with legacy Android devices',
- 'patterns': [r".*: warning: \[AndroidApiChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid use of Flogger format string',
- 'patterns': [r".*: warning: \[AndroidFloggerFormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use TunnelException.getCauseAs(Class) instead of casting the result of TunnelException.getCause().',
- 'patterns': [r".*: warning: \[DoNotCastTunnelExceptionCause\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Identifies undesirable mocks.',
- 'patterns': [r".*: warning: \[DoNotMock_ForJavaBuilder\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Duration Flag should NOT have units in the variable name or the @FlagSpec\'s name or altName field.',
- 'patterns': [r".*: warning: \[DurationFlagWithUnits\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Duration.get() only works with SECONDS or NANOS.',
- 'patterns': [r".*: warning: \[DurationGetTemporalUnit\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Invalid printf-style format string',
- 'patterns': [r".*: warning: \[FloggerFormatString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Test class may not be run because it is missing a @RunWith annotation',
- 'patterns': [r".*: warning: \[JUnit4RunWithMissing\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of class, field, or method that is not compatible with JDK 7',
- 'patterns': [r".*: warning: \[Java7ApiChecker\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of java.time.Duration.withNanos(int) is not allowed.',
- 'patterns': [r".*: warning: \[JavaDurationWithNanos\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of java.time.Duration.withSeconds(long) is not allowed.',
- 'patterns': [r".*: warning: \[JavaDurationWithSeconds\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: java.time APIs that silently use the default system time-zone are not allowed.',
- 'patterns': [r".*: warning: \[JavaTimeDefaultTimeZone\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of new Duration(long) is not allowed. Please use Duration.millis(long) instead.',
- 'patterns': [r".*: warning: \[JodaDurationConstructor\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of duration.withMillis(long) is not allowed. Please use Duration.millis(long) instead.',
- 'patterns': [r".*: warning: \[JodaDurationWithMillis\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of instant.withMillis(long) is not allowed. Please use new Instant(long) instead.',
- 'patterns': [r".*: warning: \[JodaInstantWithMillis\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of JodaTime\'s type.plus(long) or type.minus(long) is not allowed (where \u003ctype> = {Duration,Instant,DateTime,DateMidnight}). Please use type.plus(Duration.millis(long)) or type.minus(Duration.millis(long)) instead.',
- 'patterns': [r".*: warning: \[JodaPlusMinusLong\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Changing JodaTime\'s current time is not allowed in non-testonly code.',
- 'patterns': [r".*: warning: \[JodaSetCurrentMillis\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of Joda-Time\'s DateTime.toDateTime(), Duration.toDuration(), Instant.toInstant(), Interval.toInterval(), and Period.toPeriod() are not allowed.',
- 'patterns': [r".*: warning: \[JodaToSelf\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Use of JodaTime\'s type.withDurationAdded(long, int) (where \u003ctype> = {Duration,Instant,DateTime}). Please use type.withDurationAdded(Duration.millis(long), int) instead.',
- 'patterns': [r".*: warning: \[JodaWithDurationAddedLong\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: LanguageCode comparison using reference equality instead of value equality',
- 'patterns': [r".*: warning: \[LanguageCodeEquality\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: The zero argument toString is not part of the Localizable interface and likely is just the java Object toString. You probably want to call toString(Locale).',
- 'patterns': [r".*: warning: \[LocalizableWrongToString\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Period.get() only works with YEARS, MONTHS, or DAYS.',
- 'patterns': [r".*: warning: \[PeriodGetTemporalUnit\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Return value of methods returning Promise must be checked. Ignoring returned Promises suppresses exceptions thrown from the code that completes the Promises.',
- 'patterns': [r".*: warning: \[PromiseReturnValueIgnored\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: When returning a Promise, use thenChain() instead of then()',
- 'patterns': [r".*: warning: \[PromiseThenReturningPromise\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Streams.iterating() is unsafe for use except in the header of a for-each loop; please see its Javadoc for details.',
- 'patterns': [r".*: warning: \[StreamsIteratingNotInLoop\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: TemporalAccessor.get() only works for certain values of ChronoField.',
- 'patterns': [r".*: warning: \[TemporalAccessorGetChronoField\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Try-with-resources is not supported in this code, use try/finally instead',
- 'patterns': [r".*: warning: \[TryWithResources\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Adds checkOrThrow calls where needed',
- 'patterns': [r".*: warning: \[AddCheckOrThrow\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Equality on Nano protos (== or .equals) might not be the same in Lite',
- 'patterns': [r".*: warning: \[ForbidNanoEquality\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Submessages of a proto cannot be mutated',
- 'patterns': [r".*: warning: \[ForbidSubmessageMutation\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Repeated fields on proto messages cannot be directly referenced',
- 'patterns': [r".*: warning: \[NanoUnsafeRepeatedFieldUsage\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Requires that non-@enum int assignments to @enum ints is wrapped in a checkOrThrow',
- 'patterns': [r".*: warning: \[RequireCheckOrThrow\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Assignments into repeated field elements must be sequential',
- 'patterns': [r".*: warning: \[RequireSequentialRepeatedFields\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: Future.get in Google Now Producers code',
- 'patterns': [r".*: warning: \[FutureGetInNowProducers\] .+"]},
- {'category': 'java',
- 'severity': Severity.HIGH,
- 'description':
- 'Java: @SimpleEnum applied to non-enum type',
- 'patterns': [r".*: warning: \[SimpleEnumUsage\] .+"]},
# End warnings generated by Error Prone
@@ -2513,6 +2308,29 @@
# warnings from clang-tidy
group_tidy_warn_pattern('android'),
+ simple_tidy_warn_pattern('bugprone-argument-comment'),
+ simple_tidy_warn_pattern('bugprone-copy-constructor-init'),
+ simple_tidy_warn_pattern('bugprone-fold-init-type'),
+ simple_tidy_warn_pattern('bugprone-forward-declaration-namespace'),
+ simple_tidy_warn_pattern('bugprone-forwarding-reference-overload'),
+ simple_tidy_warn_pattern('bugprone-inaccurate-erase'),
+ simple_tidy_warn_pattern('bugprone-incorrect-roundings'),
+ simple_tidy_warn_pattern('bugprone-integer-division'),
+ simple_tidy_warn_pattern('bugprone-lambda-function-name'),
+ simple_tidy_warn_pattern('bugprone-macro-parentheses'),
+ simple_tidy_warn_pattern('bugprone-misplaced-widening-cast'),
+ simple_tidy_warn_pattern('bugprone-move-forwarding-reference'),
+ simple_tidy_warn_pattern('bugprone-sizeof-expression'),
+ simple_tidy_warn_pattern('bugprone-string-constructor'),
+ simple_tidy_warn_pattern('bugprone-string-integer-assignment'),
+ simple_tidy_warn_pattern('bugprone-suspicious-enum-usage'),
+ simple_tidy_warn_pattern('bugprone-suspicious-missing-comma'),
+ simple_tidy_warn_pattern('bugprone-suspicious-string-compare'),
+ simple_tidy_warn_pattern('bugprone-suspicious-semicolon'),
+ simple_tidy_warn_pattern('bugprone-undefined-memory-manipulation'),
+ simple_tidy_warn_pattern('bugprone-unused-raii'),
+ simple_tidy_warn_pattern('bugprone-use-after-move'),
+ group_tidy_warn_pattern('bugprone'),
group_tidy_warn_pattern('cert'),
group_tidy_warn_pattern('clang-diagnostic'),
group_tidy_warn_pattern('cppcoreguidelines'),
@@ -2635,7 +2453,6 @@
simple_project_pattern('frameworks/av/cmds'),
simple_project_pattern('frameworks/av/drm'),
simple_project_pattern('frameworks/av/include'),
- simple_project_pattern('frameworks/av/media/common_time'),
simple_project_pattern('frameworks/av/media/img_utils'),
simple_project_pattern('frameworks/av/media/libcpustats'),
simple_project_pattern('frameworks/av/media/libeffects'),
@@ -3006,6 +2823,7 @@
def classify_one_warning(line, results):
+ """Classify one warning line."""
for i in range(len(warn_patterns)):
w = warn_patterns[i]
for cpat in w['compiled_patterns']: