Merge "Add BOARD_KERNEL_BINARIES."
diff --git a/common/strings.mk b/common/strings.mk
index ba20e27..e560bf0 100644
--- a/common/strings.mk
+++ b/common/strings.mk
@@ -28,7 +28,7 @@
 ###########################################################
 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
+# Test to-lower and to-upper
 lower := abcdefghijklmnopqrstuvwxyz-_
 upper := ABCDEFGHIJKLMNOPQRSTUVWXYZ-_
 
diff --git a/core/Makefile b/core/Makefile
index 2550c0e..8395e45 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -385,7 +385,7 @@
   $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-recovery-load,$(dir))) \
   $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR,$(if $(filter true,$(BOARD_USES_VENDOR_DLKMIMAGE)),$(TARGET_OUT_VENDOR_DLKM),$(TARGET_OUT_VENDOR)),vendor,modules.load,$(VENDOR_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
   $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-charger-load,$(dir))) \
-  $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(TARGET_OUT_ODM),odm,modules.load,,$(dir))) \
+  $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(if $(filter true,$(BOARD_USES_ODM_DLKMIMAGE)),$(TARGET_OUT_ODM_DLKM),$(TARGET_OUT_ODM)),odm,modules.load,,$(dir))) \
   $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
     $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(dir))),\
     $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,,$(dir)))))
@@ -476,7 +476,7 @@
 SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
 $(SOONG_CONV_DATA):
 	@rm -f $@
-	@$(foreach s,$(SOONG_CONV),echo "$(s),$(SOONG_CONV.$(s).TYPE),$(sort $(SOONG_CONV.$(s).PROBLEMS)),$(sort $(filter-out $(SOONG_ALREADY_CONV),$(SOONG_CONV.$(s).DEPS)))" >>$@;)
+	@$(foreach s,$(SOONG_CONV),echo "$(s),$(SOONG_CONV.$(s).TYPE),$(sort $(SOONG_CONV.$(s).PROBLEMS)),$(sort $(filter-out $(SOONG_ALREADY_CONV),$(SOONG_CONV.$(s).DEPS))),$(sort $(SOONG_CONV.$(s).MAKEFILES)),$(sort $(SOONG_CONV.$(s).INSTALLED))" >>$@;)
 
 SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
 SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
@@ -485,6 +485,19 @@
 	$(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
 $(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
 
+MK2BP_CATALOG_SCRIPT := build/make/tools/mk2bp_catalog.py
+MK2BP_REMAINING_HTML := $(PRODUCT_OUT)/mk2bp_remaining.html
+$(MK2BP_REMAINING_HTML): PRIVATE_CODE_SEARCH_BASE_URL := "https://cs.android.com/android/platform/superproject/+/master:"
+$(MK2BP_REMAINING_HTML): $(SOONG_CONV_DATA) $(MK2BP_CATALOG_SCRIPT)
+	@rm -f $@
+	$(hide) $(MK2BP_CATALOG_SCRIPT) \
+		--device=$(TARGET_DEVICE) \
+		--title="Remaining Android.mk files for $(TARGET_DEVICE)-$(TARGET_BUILD_VARIANT)" \
+		--codesearch=$(PRIVATE_CODE_SEARCH_BASE_URL) \
+		--out_dir="$(OUT_DIR)" \
+		> $@
+$(call dist-for-goals,droidcore,$(MK2BP_REMAINING_HTML))
+
 # -----------------------------------------------------------------
 # Modules use -Wno-error, or added default -Wall -Werror
 WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
@@ -889,9 +902,10 @@
 .PHONY: notice_files
 
 # Create the rule to combine the files into text and html/xml forms
-# $(1) - xml_excluded_system_product_odm_vendor_dlkm|
-#        xml_excluded_vendor_product_odm_vendor_dlkm|
-#        xml_product|xml_odm|xml_system_ext|xml_system|xml_vendor_dlkm|html
+# $(1) - xml_excluded_system_product_odm_vendor_dlkm_odm_dlkm|
+#        xml_excluded_vendor_product_odm_vendor_dlkm_odm_dlkm|
+#        xml_product|xml_odm|xml_system_ext|xml_system|xml_vendor_dlkm|
+#        xml_odm_dlkm|html
 # $(2) - Plain text output file
 # $(3) - HTML/XML output file
 # $(4) - File title
@@ -917,15 +931,16 @@
 $(2): .KATI_IMPLICIT_OUTPUTS := $(3)
 $(2): $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
 	build/make/tools/generate-notice-files.py --text-output $(2) $(foreach xdir, $(7), -e $(xdir) )\
-	    $(if $(filter $(1),xml_excluded_vendor_product_odm_vendor_dlkm),-e vendor -e product -e system_ext -e odm -e vendor_dlkm --xml-output, \
-	      $(if $(filter $(1),xml_excluded_system_product_odm_vendor_dlkm),-e system -e product -e system_ext -e odm -e vendor_dlkm --xml-output, \
+	    $(if $(filter $(1),xml_excluded_vendor_product_odm_vendor_dlkm_odm_dlkm),-e vendor -e product -e system_ext -e odm -e vendor_dlkm -e odm_dlkm --xml-output, \
+	      $(if $(filter $(1),xml_excluded_system_product_odm_vendor_dlkm_odm_dlkm),-e system -e product -e system_ext -e odm -e vendor_dlkm -e odm_dlkm --xml-output, \
 	        $(if $(filter $(1),xml_product),-i product --xml-output, \
 	          $(if $(filter $(1),xml_system_ext),-i system_ext --xml-output, \
 	            $(if $(filter $(1),xml_system),-i system --xml-output, \
 	              $(if $(filter $(1),xml_odm),-i odm --xml-output, \
 	                $(if $(filter $(1),xml_vendor_dlkm),-i vendor_dlkm --xml-output, \
-	                  --html-output))))))) $(3) \
-	    -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
+	                  $(if $(filter $(1),xml_odm_dlkm),-i odm_dlkm --xml-output, \
+	                    --html-output)))))))) $(3) \
+	    -t $$(PRIVATE_MESSAGE) $$(foreach dir,$$(sort $$(PRIVATE_DIR)), -s $$(dir)/src)
 notice_files: $(2) $(3)
 endef
 
@@ -993,6 +1008,11 @@
 target_vendor_dlkm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR_DLKM.xml.gz
 installed_vendor_dlkm_notice_xml_gz := $(TARGET_OUT_VENDOR_DLKM)/etc/NOTICE.xml.gz
 
+target_odm_dlkm_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM_DLKM.txt
+target_odm_dlkm_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM_DLKM.xml
+target_odm_dlkm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM_DLKM.xml.gz
+installed_odm_dlkm_notice_xml_gz := $(TARGET_OUT_ODM_DLKM)/etc/NOTICE.xml.gz
+
 # Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
 # being built. A notice xml file must depend on all modules that could potentially
 # install a license file relevant to it.
@@ -1003,19 +1023,21 @@
 license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
 # testcases are not relevant to the system image.
 license_modules := $(filter-out $(TARGET_OUT_TESTCASES)/%,$(license_modules))
-# filesystem images: system, vendor, product, system_ext, odm, and vendor_dlkm
+# filesystem images: system, vendor, product, system_ext, odm, vendor_dlkm, and odm_dlkm
 license_modules_system := $(filter $(TARGET_OUT)/%,$(license_modules))
 license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
 license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
 license_modules_system_ext := $(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(license_modules))
 license_modules_odm := $(filter $(TARGET_OUT_ODM)/%,$(license_modules))
 license_modules_vendor_dlkm := $(filter $(TARGET_OUT_VENDOR_DLKM)/%,$(license_modules))
+license_modules_odm_dlkm := $(filter $(TARGET_OUT_ODM_DLKM)/%,$(license_modules))
 license_modules_agg := $(license_modules_system) \
                        $(license_modules_vendor) \
                        $(license_modules_product) \
                        $(license_modules_system_ext) \
                        $(license_modules_odm) \
-                       $(license_modules_vendor_dlkm)
+                       $(license_modules_vendor_dlkm) \
+                       $(license_modules_odm_dlkm)
 # targets used for debug symbols only and do not get copied to the device
 license_modules_symbols_only := $(filter $(PRODUCT_OUT)/apex/%,$(license_modules))
 
@@ -1050,8 +1072,8 @@
 # update its notice file, so include those notices in the system partition instead
 ifdef BOARD_PREBUILT_VENDORIMAGE
 license_modules_system += $(license_modules_rehomed)
-system_xml_directories := xml_excluded_vendor_product_odm_vendor_dlkm
-system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm/vendor_dlkm in this directory:"
+system_xml_directories := xml_excluded_vendor_product_odm_vendor_dlkm_odm_dlkm
+system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm/vendor_dlkm/odm_dlkm in this directory:"
 else
 license_modules_vendor += $(license_modules_rehomed)
 system_xml_directories := xml_system
@@ -1065,10 +1087,10 @@
 	        $(TARGET_OUT_NOTICE_FILES), \
 	        $(license_modules_system), \
 	        $(exclude_target_dirs)))
-$(eval $(call combine-notice-files, xml_excluded_system_product_odm_vendor_dlkm, \
+$(eval $(call combine-notice-files, xml_excluded_system_product_odm_vendor_dlkm_odm_dlkm, \
 	        $(target_vendor_notice_file_txt), \
 	        $(target_vendor_notice_file_xml), \
-	        "Notices for files contained in all filesystem images except system/system_ext/product/odm/vendor_dlkm in this directory:", \
+	        "Notices for files contained in all filesystem images except system/system_ext/product/odm/vendor_dlkm/odm_dlkm in this directory:", \
 	        $(TARGET_OUT_NOTICE_FILES), \
 	        $(license_modules_vendor), \
 	        $(exclude_target_dirs)))
@@ -1100,6 +1122,13 @@
 	        $(TARGET_OUT_NOTICE_FILES), \
 	        $(license_modules_vendor_dlkm), \
 	        $(exclude_target_dirs)))
+$(eval $(call combine-notice-files, xml_odm_dlkm, \
+	        $(target_odm_dlkm_notice_file_txt), \
+	        $(target_odm_dlkm_notice_file_xml), \
+	        "Notices for files contained in the odm_dlkm filesystem image in this directory:", \
+	        $(TARGET_OUT_NOTICE_FILES), \
+	        $(license_modules_odm_dlkm), \
+	        $(exclude_target_dirs)))
 
 $(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
 	$(hide) $(MINIGZIP) -9 < $< > $@
@@ -1113,6 +1142,8 @@
 	$(hide) $(MINIGZIP) -9 < $< > $@
 $(target_vendor_dlkm_notice_file_xml_gz): $(target_vendor_dlkm_notice_file_xml) | $(MINIGZIP)
 	$(hide) $(MINIGZIP) -9 < $< > $@
+$(target_odm_dlkm_notice_file_xml_gz): $(target_odm_dlkm_notice_file_xml) | $(MINIGZIP)
+	$(hide) $(MINIGZIP) -9 < $< > $@
 $(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
 	$(copy-file-to-target)
 $(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
@@ -1125,6 +1156,8 @@
 	$(copy-file-to-target)
 $(installed_vendor_dlkm_notice_xml_gz): $(target_vendor_dlkm_notice_file_xml_gz)
 	$(copy-file-to-target)
+$(installed_odm_dlkm_notice_xml_gz): $(target_odm_dlkm_notice_file_xml_gz)
+	$(copy-file-to-target)
 
 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
@@ -1132,6 +1165,7 @@
 ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz)
 ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz)
 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_dlkm_notice_xml_gz)
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_dlkm_notice_xml_gz)
 endif # PRODUCT_NOTICE_SPLIT
 
 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
@@ -1205,6 +1239,7 @@
     $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) \
     $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE) \
     $(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE) \
+    $(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE) \
   ,squashfs),)
 INTERNAL_USERIMAGES_DEPS += $(MKSQUASHFSUSERIMG)
 endif
@@ -1235,7 +1270,7 @@
 endif # PRODUCT_USE_DYNAMIC_PARTITIONS
 
 # $(1): the path of the output dictionary file
-# $(2): a subset of "system vendor cache userdata product system_ext oem odm vendor_dlkm"
+# $(2): a subset of "system vendor cache userdata product system_ext oem odm vendor_dlkm odm_dlkm"
 # $(3): additional "key=value" pairs to append to the dictionary file.
 define generate-image-prop-dictionary
 $(if $(filter $(2),system),\
@@ -1345,6 +1380,20 @@
     $(hide) echo "vendor_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1)
     $(hide) echo "building_vendor_dlkm_image=$(BUILDING_VENDOR_DLKM_IMAGE)" >> $(1)
 )
+$(if $(filter $(2),odm_dlkm),\
+    $(if $(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_dlkm_fs_type=$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_dlkm_extfs_inode_count=$(BOARD_ODM_DLKMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_dlkm_extfs_rsv_pct=$(BOARD_ODM_DLKMIMAGE_EXTFS_RSV_PCT)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE),$(hide) echo "odm_dlkm_size=$(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_dlkm_journal_size=$(BOARD_ODM_DLKMIMAGE_JOURNAL_SIZE)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_dlkm_squashfs_compressor=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_dlkm_squashfs_compressor_opt=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_dlkm_squashfs_block_size=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_dlkm_squashfs_disable_4k_align=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+    $(if $(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_dlkm_reserved_size=$(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+    $(hide) echo "odm_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1)
+    $(hide) echo "building_odm_dlkm_image=$(BUILDING_ODM_DLKM_IMAGE)" >> $(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))
@@ -1372,6 +1421,7 @@
 $(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
 $(if $(PRODUCT_SYSTEM_EXT_VERITY_PARTITION),$(hide) echo "system_ext_verity_block_device=$(PRODUCT_SYSTEM_EXT_VERITY_PARTITION)" >> $(1))
 $(if $(PRODUCT_VENDOR_DLKM_VERITY_PARTITION),$(hide) echo "vendor_dlkm_verity_block_device=$(PRODUCT_VENDOR_DLKM_VERITY_PARTITION)" >> $(1))
+$(if $(PRODUCT_ODM_DLKM_VERITY_PARTITION),$(hide) echo "odm_dlkm_verity_block_device=$(PRODUCT_ODM_DLKM_VERITY_PARTITION)" >> $(1))
 $(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1))
 $(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
 $(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
@@ -1428,6 +1478,14 @@
         $(hide) echo "avb_vendor_dlkm_key_path=$(BOARD_AVB_VENDOR_DLKM_KEY_PATH)" >> $(1)
         $(hide) echo "avb_vendor_dlkm_algorithm=$(BOARD_AVB_VENDOR_DLKM_ALGORITHM)" >> $(1)
         $(hide) echo "avb_vendor_dlkm_rollback_index_location=$(BOARD_AVB_VENDOR_DLKM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
+$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_dlkm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
+$(if $(BOARD_AVB_ENABLE),\
+    $(hide) echo "avb_odm_dlkm_add_hashtree_footer_args=$(BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
+$(if $(BOARD_AVB_ENABLE),\
+    $(if $(BOARD_AVB_ODM_DLKM_KEY_PATH),\
+        $(hide) echo "avb_odm_dlkm_key_path=$(BOARD_AVB_ODM_DLKM_KEY_PATH)" >> $(1)
+        $(hide) echo "avb_odm_dlkm_algorithm=$(BOARD_AVB_ODM_DLKM_ALGORITHM)" >> $(1)
+        $(hide) echo "avb_odm_dlkm_rollback_index_location=$(BOARD_AVB_ODM_DLKM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
     $(hide) echo "recovery_as_boot=true" >> $(1))
 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
@@ -1468,6 +1526,9 @@
 ifdef BUILDING_VENDOR_DLKM_IMAGE
   PROP_DICTIONARY_IMAGES += vendor_dlkm
 endif
+ifdef BUILDING_ODM_DLKM_IMAGE
+  PROP_DICTIONARY_IMAGES += odm_dlkm
+endif
 define generate-userimage-prop-dictionary
   $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2))
 endef
@@ -2463,6 +2524,9 @@
 ifdef BUILDING_VENDOR_DLKM_IMAGE
 	echo "-D $(TARGET_OUT_VENDOR_DLKM)" >> $@.lst
 endif
+ifdef BUILDING_ODM_DLKM_IMAGE
+	echo "-D $(TARGET_OUT_ODM_DLKM)" >> $@.lst
+endif
 ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
 	echo "-C $(OUT_DIR)" >> $@.lst
 	for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
@@ -2740,6 +2804,7 @@
 # are not guaranteed to exist on all devices.
 ifdef BOARD_USES_VENDOR_DLKMIMAGE
 define create-vendor-vendor_dlkm-symlink
+$(hide) mkdir -p $(TARGET_OUT_VENDOR)/lib
 $(hide) if [ -d $(TARGET_OUT_VENDOR)/lib/modules ] && [ ! -h $(TARGET_OUT_VENDOR)/lib/modules ]; then \
   echo 'Non-symlink $(TARGET_OUT_VENDOR)/lib/modules detected!' 1>&2; \
   echo 'You cannot install files to $(TARGET_OUT_VENDOR)/lib/modules while building a separate vendor_dlkm.img!' 1>&2; \
@@ -2752,6 +2817,35 @@
 endef
 endif
 
+# Create symlinks for odm_dlkm on devices with a odm_dlkm partition:
+# /odm/lib/modules -> /odm_dlkm/lib/modules
+#
+# On devices with a odm_dlkm partition,
+# - /odm/lib/modules is a symlink to a directory that stores odm DLKMs.
+# - /odm_dlkm/{etc,...} store other odm_dlkm files directly. The odm_dlkm partition is
+#   mounted at /odm_dlkm at runtime and the symlinks created in system/core/rootdir/Android.mk
+#   are hidden.
+# On devices without a odm_dlkm partition,
+# - /odm/lib/modules stores odm DLKMs directly.
+# - /odm_dlkm/{etc,...} are symlinks to directories that store other odm_dlkm files.
+#   See system/core/rootdir/Android.mk for a list of created symlinks.
+# The odm DLKMs and other odm_dlkm files must not be accessed using other paths because they
+# are not guaranteed to exist on all devices.
+ifdef BOARD_USES_ODM_DLKMIMAGE
+define create-odm-odm_dlkm-symlink
+$(hide) mkdir -p $(TARGET_OUT_ODM)/lib
+$(hide) if [ -d $(TARGET_OUT_ODM)/lib/modules ] && [ ! -h $(TARGET_OUT_ODM)/lib/modules ]; then \
+  echo 'Non-symlink $(TARGET_OUT_ODM)/lib/modules detected!' 1>&2; \
+  echo 'You cannot install files to $(TARGET_OUT_ODM)/lib/modules while building a separate odm_dlkm.img!' 1>&2; \
+  exit 1; \
+fi
+$(hide) ln -sf /odm_dlkm/lib/modules $(TARGET_OUT_ODM)/lib/modules
+endef
+else
+define create-odm-odm_dlkm-symlink
+endef
+endif
+
 vendorimage_intermediates := \
     $(call intermediates-dir-for,PACKAGING,vendor)
 BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
@@ -2760,6 +2854,7 @@
   @mkdir -p $(TARGET_OUT_VENDOR)
   $(call create-vendor-odm-symlink)
   $(call create-vendor-vendor_dlkm-symlink)
+  $(call create-odm-odm_dlkm-symlink)
   @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
   $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
   PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
@@ -3014,6 +3109,62 @@
 endif
 
 # -----------------------------------------------------------------
+# odm_dlkm partition image
+ifdef BUILDING_ODM_DLKM_IMAGE
+INTERNAL_ODM_DLKMIMAGE_FILES := \
+    $(filter $(TARGET_OUT_ODM_DLKM)/%,\
+      $(ALL_DEFAULT_INSTALLED_MODULES)\
+      $(ALL_PDK_FUSION_FILES)) \
+    $(PDK_FUSION_SYMLINK_STAMP)
+# platform.zip depends on $(INTERNAL_ODM_DLKMIMAGE_FILES).
+$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODM_DLKMIMAGE_FILES)
+
+INSTALLED_FILES_FILE_ODM_DLKM := $(PRODUCT_OUT)/installed-files-odm_dlkm.txt
+INSTALLED_FILES_JSON_ODM_DLKM := $(INSTALLED_FILES_FILE_ODM_DLKM:.txt=.json)
+$(INSTALLED_FILES_FILE_ODM_DLKM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM_DLKM)
+$(INSTALLED_FILES_FILE_ODM_DLKM) : $(INTERNAL_ODM_DLKMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
+	@echo Installed file list: $@
+	@mkdir -p $(dir $@)
+	@rm -f $@
+	$(hide) $(FILESLIST) $(TARGET_OUT_ODM_DLKM) > $(@:.txt=.json)
+	$(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
+
+odm_dlkmimage_intermediates := \
+    $(call intermediates-dir-for,PACKAGING,odm_dlkm)
+BUILT_ODM_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/odm_dlkm.img
+define build-odm_dlkmimage-target
+  $(call pretty,"Target odm_dlkm fs image: $(INSTALLED_ODM_DLKMIMAGE_TARGET)")
+  @mkdir -p $(TARGET_OUT_ODM_DLKM)
+  @mkdir -p $(odm_dlkmimage_intermediates) && rm -rf $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt
+  $(call generate-userimage-prop-dictionary, $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt, skip_fsck=true)
+  PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+      $(BUILD_IMAGE) \
+          $(TARGET_OUT_ODM_DLKM) $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt \
+          $(INSTALLED_ODM_DLKMIMAGE_TARGET) $(TARGET_OUT)
+  $(call assert-max-image-size,$(INSTALLED_ODM_DLKMIMAGE_TARGET),$(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE))
+endef
+
+# We just build this directly to the install location.
+INSTALLED_ODM_DLKMIMAGE_TARGET := $(BUILT_ODM_DLKMIMAGE_TARGET)
+$(INSTALLED_ODM_DLKMIMAGE_TARGET): \
+    $(INTERNAL_USERIMAGES_DEPS) \
+    $(INTERNAL_ODM_DLKMIMAGE_FILES) \
+    $(INSTALLED_FILES_FILE_ODM_DLKM)
+	$(build-odm_dlkmimage-target)
+
+.PHONY: odm_dlkmimage-nodeps odnod
+odm_dlkmimage-nodeps odnod: | $(INTERNAL_USERIMAGES_DEPS)
+	$(build-odm_dlkmimage-target)
+
+sync: $(INTERNAL_ODM_DLKMIMAGE_FILES)
+
+else ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
+INSTALLED_ODM_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/odm_dlkm.img
+$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODM_DLKMIMAGE),$(INSTALLED_ODM_DLKMIMAGE_TARGET)))
+endif
+
+
+# -----------------------------------------------------------------
 # dtbo image
 ifdef BOARD_PREBUILT_DTBOIMAGE
 INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
@@ -3173,6 +3324,10 @@
     --prop com.android.build.vendor_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
     --prop com.android.build.vendor_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
 
+BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
+    --prop com.android.build.odm_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
+    --prop com.android.build.odm_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
+
 BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \
     --prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
 
@@ -3197,6 +3352,11 @@
     --prop com.android.build.vendor_dlkm.security_patch:$(VENDOR_DLKM_SECURITY_PATCH)
 endif
 
+ifdef ODM_DLKM_SECURITY_PATCH
+BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
+    --prop com.android.build.odm_dlkm.security_patch:$(ODM_DLKM_SECURITY_PATCH)
+endif
+
 BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
 VENDOR_BOOT_FOOTER_ARGS := BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS
 DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
@@ -3207,6 +3367,7 @@
 SYSTEM_EXT_FOOTER_ARGS := BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS
 ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
 VENDOR_DLKM_FOOTER_ARGS := BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS
+ODM_DLKM_FOOTER_ARGS := BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS
 
 # Helper function that checks and sets required build variables for an AVB chained partition.
 # $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
@@ -3305,6 +3466,10 @@
 $(eval $(call check-and-set-avb-args,vendor_dlkm))
 endif
 
+ifdef INSTALLED_ODM_DLKMIMAGE_TARGET
+$(eval $(call check-and-set-avb-args,odm_dlkm))
+endif
+
 ifdef INSTALLED_DTBOIMAGE_TARGET
 $(eval $(call check-and-set-avb-args,dtbo))
 endif
@@ -3388,6 +3553,9 @@
   $(if $(BOARD_AVB_VENDOR_DLKM_KEY_PATH),\
     $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_DLKM_KEY_PATH) \
       --output $(1)/vendor_dlkm.avbpubkey)
+  $(if $(BOARD_AVB_ODM_DLKM_KEY_PATH),\
+    $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_DLKM_KEY_PATH) \
+      --output $(1)/odm_dlkm.avbpubkey)
   $(if $(BOARD_AVB_DTBO_KEY_PATH),\
     $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
       --output $(1)/dtbo.avbpubkey)
@@ -3471,6 +3639,7 @@
 	    $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
 	    $(INSTALLED_ODMIMAGE_TARGET) \
 	    $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
+	    $(INSTALLED_ODM_DLKMIMAGE_TARGET) \
 	    $(INSTALLED_DTBOIMAGE_TARGET) \
 	    $(INSTALLED_CUSTOMIMAGES_TARGET) \
 	    $(INSTALLED_RECOVERYIMAGE_TARGET) \
@@ -3493,7 +3662,7 @@
 # -----------------------------------------------------------------
 # Check VINTF of build
 
-# Note: vendor_dlkm does not have VINTF files.
+# Note: vendor_dlkm and odm_dlkm does not have VINTF files.
 ifeq (,$(TARGET_BUILD_UNBUNDLED))
 
 intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all)
@@ -4281,6 +4450,7 @@
 	    $(INSTALLED_VBMETAIMAGE_TARGET) \
 	    $(INSTALLED_ODMIMAGE_TARGET) \
 	    $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
+	    $(INSTALLED_ODM_DLKMIMAGE_TARGET) \
 	    $(INSTALLED_DTBOIMAGE_TARGET) \
 	    $(INSTALLED_CUSTOMIMAGES_TARGET) \
 	    $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
@@ -4297,6 +4467,7 @@
 	    $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \
 	    $(PRODUCT_ODM_BASE_FS_PATH) \
 	    $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \
+	    $(PRODUCT_ODM_DLKM_BASE_FS_PATH) \
 	    $(LPMAKE) \
 	    $(SELINUX_FC) \
 	    $(INSTALLED_MISC_INFO_TARGET) \
@@ -4315,6 +4486,7 @@
 	$(call create-system-system_ext-symlink)
 	$(call create-vendor-odm-symlink)
 	$(call create-vendor-vendor_dlkm-symlink)
+	$(call create-odm-odm_dlkm-symlink)
 	$(hide) rm -rf $@ $@.list $(zip_root)
 	$(hide) mkdir -p $(dir $@) $(zip_root)
 ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
@@ -4440,6 +4612,11 @@
 	$(hide) $(call package_files-copy-root, \
 	    $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM)
 endif
+ifdef BUILDING_ODM_DLKM_IMAGE
+	@# Contents of the odm_dlkm image
+	$(hide) $(call package_files-copy-root, \
+	    $(TARGET_OUT_ODM_DLKM),$(zip_root)/ODM_DLKM)
+endif
 ifdef BUILDING_SYSTEM_OTHER_IMAGE
 	@# Contents of the system_other image
 	$(hide) $(call package_files-copy-root, \
@@ -4489,6 +4666,10 @@
 	$(hide) cp $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \
 	  $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH))
 endif
+ifneq ($(PRODUCT_ODM_DLKM_BASE_FS_PATH),)
+	$(hide) cp $(PRODUCT_ODM_DLKM_BASE_FS_PATH) \
+	  $(zip_root)/META/$(notdir $(PRODUCT_ODM_DLKM_BASE_FS_PATH))
+endif
 ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
 ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
 	$(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
@@ -4572,6 +4753,9 @@
 ifdef BUILDING_VENDOR_DLKM_IMAGE
 	$(hide) $(call fs_config,$(zip_root)/VENDOR_DLKM,vendor_dlkm/) > $(zip_root)/META/vendor_dlkm_filesystem_config.txt
 endif
+ifdef BUILDING_ODM_DLKM_IMAGE
+	$(hide) $(call fs_config,$(zip_root)/ODM_DLKM,odm_dlkm/) > $(zip_root)/META/odm_dlkm_filesystem_config.txt
+endif
 	@# ROOT always contains the files for the root under normal boot.
 	$(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
@@ -4731,6 +4915,7 @@
 	    $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
 	    $(INSTALLED_ODMIMAGE_TARGET) \
 	    $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
+	    $(INSTALLED_ODM_DLKMIMAGE_TARGET) \
 	    $(updater_dep)
 endif
 $(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
@@ -4757,7 +4942,8 @@
 	    $(INSTALLED_PRODUCTIMAGE_TARGET) \
 	    $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
 	    $(INSTALLED_ODMIMAGE_TARGET) \
-	    $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)
+	    $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
+	    $(INSTALLED_ODM_DLKMIMAGE_TARGET)
 endif
 $(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
 $(COVERAGE_ZIP): $(SOONG_ZIP)
@@ -4835,6 +5021,7 @@
     $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
     $(INSTALLED_ODMIMAGE_TARGET) \
     $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
+    $(INSTALLED_ODM_DLKMIMAGE_TARGET) \
     $(updater_dep)
 endif
 $(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard)/filelist
@@ -5083,6 +5270,15 @@
 droidcore: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE)
 endif
 
+ifdef INSTALLED_ODM_DLKMIMAGE_TARGET
+INSTALLED_QEMU_ODM_DLKMIMAGE := $(PRODUCT_OUT)/odm_dlkm-qemu.img
+$(INSTALLED_QEMU_ODM_DLKMIMAGE): $(INSTALLED_ODM_DLKMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+	@echo Create odm_dlkm-qemu.img
+	(export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODM_DLKMIMAGE_TARGET))
+
+odm_dlkmimage: $(INSTALLED_QEMU_ODM_DLKMIMAGE)
+droidcore: $(INSTALLED_QEMU_ODM_DLKMIMAGE)
+endif
 
 QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
 $(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
new file mode 100644
index 0000000..ee12c8c
--- /dev/null
+++ b/core/android_soong_config_vars.mk
@@ -0,0 +1,29 @@
+# Copyright (C) 2020 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 file defines the Soong Config Variable namespace ANDROID, and also any
+# variables in that namespace.
+
+# The expectation is that no vendor should be using the ANDROID namespace. This
+# check ensures that we don't collide with any existing vendor usage.
+
+ifdef SOONG_CONFIG_ANDROID
+$(error The Soong config namespace ANDROID is reserved.)
+endif
+
+$(call add_soong_config_namespace,ANDROID)
+
+# Add variables to the namespace below:
+
+$(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index d604480..3f93c2c 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -592,12 +592,22 @@
 ifneq ($(strip $(LOCAL_TEST_DATA)),)
 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
 
+# Soong LOCAL_TEST_DATA is of the form <from_base>:<file>:<relative_install_path>
+# or <from_base>:<file>, to be installed to
+# <install_root>/<relative_install_path>/<file> or <install_root>/<file>,
+# respectively.
 ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
   define copy_test_data_pairs
     _src_base := $$(call word-colon,1,$$(td))
     _file := $$(call word-colon,2,$$(td))
-    my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_file))
-    my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_file)
+    _relative_install_path := $$(call word-colon,3,$$(td))
+    ifeq (,$$(_relative_install_path))
+        _relative_dest_file := $$(_file)
+    else
+        _relative_dest_file := $$(call append-path,$$(_relative_install_path),$$(_file))
+    endif
+    my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_relative_dest_file))
+    my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_relative_dest_file)
   endef
 else
   define copy_test_data_pairs
diff --git a/core/binary.mk b/core/binary.mk
index 6c1c4db..be7dc27 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -594,7 +594,7 @@
 
 $(call track-src-file-gen,$(renderscript_sources),$(rs_generated_cpps))
 
-# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
+# This is just a no-op rule to make sure gmake doesn't skip updating the dependents.
 $(rs_generated_cpps) : $(RenderScript_file_stamp)
 	@echo "Updated RS generated cpp file $@."
 	$(hide) touch $@
@@ -1818,6 +1818,10 @@
         $(my_shared_libraries) \
         $(my_system_shared_libraries))
 SOONG_CONV.$(LOCAL_MODULE).TYPE := native
+SOONG_CONV.$(LOCAL_MODULE).MAKEFILES := \
+    $(SOONG_CONV.$(LOCAL_MODULE).MAKEFILES) $(LOCAL_MODULE_MAKEFILE)
+SOONG_CONV.$(LOCAL_MODULE).INSTALLED:= \
+    $(SOONG_CONV.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE)
 SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE)
 
 ###########################################################
diff --git a/core/board_config.mk b/core/board_config.mk
index 70c1589..d4fe618 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -16,7 +16,7 @@
 
 # ###############################################################
 # This file includes BoardConfig.mk for the device being built,
-# and sanity-checks the variable defined therein.
+# and checks the variable defined therein.
 # ###############################################################
 
 _board_strip_readonly_list := \
@@ -74,6 +74,8 @@
   BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \
   BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE \
   BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE \
+  BOARD_ODM_DLKMIMAGE_PARTITION_SIZE \
+  BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE \
 
 # Logical partitions related variables.
 _dynamic_partitions_var_list += \
@@ -81,6 +83,7 @@
   BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
   BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \
   BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE \
+  BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE \
   BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \
   BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \
   BOARD_SUPER_PARTITION_SIZE \
@@ -164,7 +167,7 @@
 TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT))
 TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT))
 
-# The combo makefiles sanity-check and set defaults for various CPU configuration
+# The combo makefiles check and set defaults for various CPU configuration
 combo_target := TARGET_
 combo_2nd_arch_prefix :=
 include $(BUILD_SYSTEM)/combo/select.mk
@@ -188,7 +191,7 @@
   TARGET_SUPPORTS_32_BIT_APPS := true
 endif
 
-# Sanity check to warn about likely cryptic errors later in the build.
+# Quick check to warn about likely cryptic errors later in the build.
 ifeq ($(TARGET_IS_64_BIT),true)
   ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
     $(error Building a 32-bit-app-only product on a 64-bit device. \
@@ -582,6 +585,41 @@
 endif
 .KATI_READONLY := BUILDING_ODM_IMAGE
 
+
+###########################################
+# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM
+ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder))
+  TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm
+else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),)
+  $(error TARGET_COPY_OUT_ODM_DLKM must be either 'odm_dlkm', 'system/vendor/odm_dlkm' or 'vendor/odm_dlkm', seeing '$(TARGET_COPY_OUT_ODM_DLKM)'.)
+endif
+PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES))
+
+BOARD_USES_ODM_DLKMIMAGE :=
+ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
+  BOARD_USES_ODM_DLKMIMAGE := true
+endif
+ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
+  BOARD_USES_ODM_DLKMIMAGE := true
+endif
+$(call check_image_config,odm_dlkm)
+
+BUILDING_ODM_DLKM_IMAGE :=
+ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),)
+  ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
+    BUILDING_ODM_DLKM_IMAGE := true
+  endif
+else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true)
+  BUILDING_ODM_DLKM_IMAGE := true
+  ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
+    $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
+  endif
+endif
+ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
+  BUILDING_ODM_DLKM_IMAGE :=
+endif
+.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE
+
 ###########################################
 # Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
 TARGET_RECOVERY_UPDATER_LIBS ?=
@@ -611,7 +649,7 @@
   endif
 endif
 
-# Sanity check for building generic OTA packages. Currently it only supports A/B OTAs.
+# Quick check for building generic OTA packages. Currently it only supports A/B OTAs.
 ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
   ifneq ($(AB_OTA_UPDATER),true)
     $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 20319a8..f87f6b4 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -259,6 +259,7 @@
 LOCAL_SANITIZE_RECOVER:=
 LOCAL_SANITIZE_NO_RECOVER:=
 LOCAL_SANITIZE_BLACKLIST :=
+LOCAL_SANITIZE_BLOCKLIST :=
 LOCAL_SDK_LIBRARIES :=
 LOCAL_SDK_RES_VERSION:=
 LOCAL_SDK_VERSION:=
@@ -273,6 +274,7 @@
 LOCAL_SOONG_HEADER_JAR :=
 LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=
 LOCAL_SOONG_LINK_TYPE :=
+LOCAL_SOONG_LINT_REPORTS :=
 LOCAL_SOONG_PROGUARD_DICT :=
 LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=
 LOCAL_SOONG_DEVICE_RRO_DIRS :=
@@ -340,6 +342,7 @@
 LOCAL_REQUIRED_MODULES_$(TARGET_ARCH):=
 LOCAL_SHARED_LIBRARIES_$(TARGET_ARCH):=
 LOCAL_SOONG_JNI_LIBS_$(TARGET_ARCH):=
+LOCAL_SOONG_JNI_LIBS_SYMBOLS:=
 LOCAL_SRC_FILES_EXCLUDE_$(TARGET_ARCH):=
 LOCAL_SRC_FILES_$(TARGET_ARCH):=
 LOCAL_STATIC_LIBRARIES_$(TARGET_ARCH):=
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index cbca1fb..e45c1a6 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -39,7 +39,7 @@
   TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT := generic
 endif
 
-# This sanity checks TARGET_2ND_ARCH_VARIANT against the lists above.
+# This quickly checks TARGET_2ND_ARCH_VARIANT against the lists above.
 ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv82a_CORES)))
   ifeq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
     TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv8-2a
diff --git a/core/config.mk b/core/config.mk
index 2689d80..a35b718 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -153,6 +153,7 @@
 $(KATI_obsolete_var PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST,Use PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST.)
 $(KATI_obsolete_var COVERAGE_PATHS,Use NATIVE_COVERAGE_PATHS instead)
 $(KATI_obsolete_var COVERAGE_EXCLUDE_PATHS,Use NATIVE_COVERAGE_EXCLUDE_PATHS instead)
+$(KATI_obsolete_var BOARD_VNDK_RUNTIME_DISABLE,VNDK-Lite is no longer supported.)
 
 # Used to force goals to build.  Only use for conditionally defined goals.
 .PHONY: FORCE
@@ -937,6 +938,13 @@
 endif
 endif
 
+ifneq ($(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_ODM_DLKMIMAGE_PARTITION_SIZE and \
+    BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE together)
+endif
+endif
+
 ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_SIZE),)
 ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),)
 $(error Should not define BOARD_PRODUCTIMAGE_PARTITION_SIZE and \
@@ -972,7 +980,7 @@
 )
 
 # BOARD_*_PARTITION_LIST: a list of the following tokens
-valid_super_partition_list := system vendor product system_ext odm vendor_dlkm
+valid_super_partition_list := system vendor product system_ext odm vendor_dlkm odm_dlkm
 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
     $(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \
         $(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \
@@ -1220,6 +1228,7 @@
     product-graph dump-products
 
 ifeq ($(CALLED_FROM_SETUP),true)
+include $(BUILD_SYSTEM)/android_soong_config_vars.mk
 include $(BUILD_SYSTEM)/ninja_config.mk
 include $(BUILD_SYSTEM)/soong_config.mk
 endif
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index c5cb91c..323bb36 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -147,6 +147,9 @@
   ifneq ($(LOCAL_SANITIZE_BLACKLIST),)
     my_cflags += -fsanitize-blacklist=$(LOCAL_PATH)/$(LOCAL_SANITIZE_BLACKLIST)
   endif
+  ifneq ($(LOCAL_SANITIZE_BLOCKLIST),)
+    my_cflags += -fsanitize-blacklist=$(LOCAL_PATH)/$(LOCAL_SANITIZE_BLOCKLIST)
+  endif
 endif
 
 # Disable integer_overflow if LOCAL_NOSANITIZE=integer.
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 20b4051..dd31999 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -21,32 +21,38 @@
 my_boot_image_arch := TARGET_ARCH
 my_boot_image_out := $(PRODUCT_OUT)
 my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED)
-my_boot_image_root := DEFAULT_DEX_PREOPT_INSTALLED_IMAGE
-DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
-$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE := \
+  $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(strip \
+    $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
+    $(my_boot_image_module)))
 ifdef TARGET_2ND_ARCH
   my_boot_image_arch := TARGET_2ND_ARCH
-  my_boot_image_root := 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE
-  2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
-  $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+  2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE := \
+    $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(strip \
+      $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
+      $(my_boot_image_module)))
 endif
 # Install boot images for testing on host. We exclude framework image as it is not part of art manifest.
 my_boot_image_arch := HOST_ARCH
 my_boot_image_out := $(HOST_OUT)
 my_boot_image_syms := $(HOST_OUT)/symbols
-my_boot_image_root := HOST_BOOT_IMAGE
-HOST_BOOT_IMAGE :=
-$(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+HOST_BOOT_IMAGE_MODULE := \
+  $(foreach my_boot_image_name,art_host,$(strip \
+    $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
+    $(my_boot_image_module)))
+HOST_BOOT_IMAGE := $(call module-installed-files,$(HOST_BOOT_IMAGE_MODULE))
 ifdef HOST_2ND_ARCH
   my_boot_image_arch := HOST_2ND_ARCH
-  my_boot_image_root := 2ND_HOST_BOOT_IMAGE
-  2ND_HOST_BOOT_IMAGE :=
-  $(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
+  2ND_HOST_BOOT_IMAGE_MODULE := \
+    $(foreach my_boot_image_name,art_host,$(strip \
+      $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
+      $(my_boot_image_module)))
+  2ND_HOST_BOOT_IMAGE := $(call module-installed-files,$(2ND_HOST_BOOT_IMAGE_MODULE))
 endif
 my_boot_image_arch :=
 my_boot_image_out :=
 my_boot_image_syms :=
-my_boot_image_root :=
+my_boot_image_module :=
 
 # Build the boot.zip which contains the boot jars and their compilation output
 # We can do this only if preopt is enabled and if the product uses libart config (which sets the
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 12b29f4..8f0702b 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -5,38 +5,75 @@
 #   my_boot_image_arch: the architecture to install (e.g. TARGET_ARCH, not expanded)
 #   my_boot_image_out:  the install directory (e.g. $(PRODUCT_OUT))
 #   my_boot_image_syms: the symbols director (e.g. $(TARGET_OUT_UNSTRIPPED))
-#   my_boot_image_root: make variable used to store installed image path
+#
+# Output variables:
+#   my_boot_image_module: the created module name. Empty if no module is created.
+#
+# Install the boot images compiled by Soong.
+# Create a module named dexpreopt_bootjar.$(my_boot_image_name)_$($(my_boot_image_arch))
+# that installs all of boot image files.
+# If there is no file to install for $(my_boot_image_name), for example when
+# building an unbundled build, then no module is created.
 #
 ####################################
 
 # Install $(1) to $(2) so that it is shared between architectures.
+# Returns the target path of the shared vdex file and installed symlink.
 define copy-vdex-file
-my_vdex_shared := $$(dir $$(patsubst %/,%,$$(dir $(2))))$$(notdir $(2))  # Remove the arch dir.
-ifneq ($(my_boot_image_arch),$(filter $(my_boot_image_arch), TARGET_2ND_ARCH HOST_2ND_ARCH))
-$$(my_vdex_shared): $(1)  # Copy $(1) to directory one level up (i.e. with the arch dir removed).
-	@echo "Install: $$@"
-	$$(copy-file-to-target)
-endif
-$(2): $$(my_vdex_shared)  # Create symlink at $(2) which points to the actual physical copy.
-	@echo "Symlink: $$@"
-	mkdir -p $$(dir $$@)
-	ln -sfn ../$$(notdir $$@) $$@
-my_vdex_shared :=
+$(strip \
+  $(eval # Remove the arch dir) \
+  $(eval my_vdex_shared := $(dir $(patsubst %/,%,$(dir $(2))))$(notdir $(2))) \
+  $(if $(filter-out %_2ND_ARCH,$(my_boot_image_arch)), \
+    $(eval # Copy $(1) to directory one level up (i.e. with the arch dir removed).) \
+    $(eval $(call copy-one-file,$(1),$(my_vdex_shared))) \
+  ) \
+  $(eval # Create symlink at $(2) which points to the actual physical copy.) \
+  $(call symlink-file,$(my_vdex_shared),../$(notdir $(2)),$(2)) \
+  $(my_vdex_shared) $(2) \
+)
 endef
 
 # Same as 'copy-many-files' but it uses the vdex-specific helper above.
 define copy-vdex-files
-$(foreach v,$(1),$(eval $(call copy-vdex-file, $(call word-colon,1,$(v)), $(2)$(call word-colon,2,$(v)))))
-$(foreach v,$(1),$(2)$(call word-colon,2,$(v)))
+$(foreach v,$(1),$(call copy-vdex-file,$(call word-colon,1,$(v)),$(2)$(call word-colon,2,$(v))))
 endef
 
-# Install the boot images compiled by Soong.
-# The first file is saved in $(my_boot_image_root) and the rest are added as it's dependencies.
-my_suffix := BUILT_INSTALLED_$(my_boot_image_name)_$($(my_boot_image_arch))
-my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_$(my_suffix)),$(my_boot_image_out))
-my_installed += $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_$(my_suffix)),$(my_boot_image_syms))
-my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_$(my_suffix)),$(my_boot_image_out))
-$(my_boot_image_root) += $(firstword $(my_installed))
-$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed))
-my_installed :=
-my_suffix :=
+my_boot_image_module :=
+
+my_suffix := $(my_boot_image_name)_$($(my_boot_image_arch))
+my_copy_pairs := $(strip $(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_suffix)))
+
+# Generate the boot image module only if there is any file to install.
+ifneq (,$(my_copy_pairs))
+  my_first_pair := $(firstword $(my_copy_pairs))
+  my_rest_pairs := $(wordlist 2,$(words $(my_copy_pairs)),$(my_copy_pairs))
+
+  my_first_src := $(call word-colon,1,$(my_first_pair))
+  my_first_dest := $(my_boot_image_out)$(call word-colon,2,$(my_first_pair))
+
+  my_installed := $(call copy-many-files,$(my_rest_pairs),$(my_boot_image_out))
+  my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_suffix)),$(my_boot_image_out))
+  my_unstripped_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_suffix)),$(my_boot_image_syms))
+
+  # We don't have a LOCAL_PATH for the auto-generated modules, so let it be the $(BUILD_SYSTEM).
+  LOCAL_PATH := $(BUILD_SYSTEM)
+
+  include $(CLEAR_VARS)
+  LOCAL_MODULE := dexpreopt_bootjar.$(my_suffix)
+  LOCAL_PREBUILT_MODULE_FILE := $(my_first_src)
+  LOCAL_MODULE_PATH := $(dir $(my_first_dest))
+  LOCAL_MODULE_STEM := $(notdir $(my_first_dest))
+  ifneq (,$(strip $(filter HOST_%,$(my_boot_image_arch))))
+    LOCAL_IS_HOST_MODULE := true
+  endif
+  LOCAL_MODULE_CLASS := ETC
+  include $(BUILD_PREBUILT)
+  $(LOCAL_BUILT_MODULE): $(my_unstripped_installed)
+  # Installing boot.art causes all boot image bits to be installed.
+  # Keep this old behavior in case anyone still needs it.
+  $(LOCAL_INSTALLED_MODULE): $(my_installed)
+  ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed)
+  $(my_all_targets): $(my_installed)
+
+  my_boot_image_module := $(LOCAL_MODULE)
+endif  # my_copy_pairs != empty
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 1fb4605..f78ecb4 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -254,6 +254,7 @@
 _system_ext_path_placeholder := ||SYSTEM_EXT-PATH-PH||
 _odm_path_placeholder := ||ODM-PATH-PH||
 _vendor_dlkm_path_placeholder := ||VENDOR_DLKM-PATH-PH||
+_odm_dlkm_path_placeholder := ||ODM_DLKM-PATH-PH||
 TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
 TARGET_COPY_OUT_VENDOR_RAMDISK := vendor-ramdisk
 TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder)
@@ -263,6 +264,7 @@
 TARGET_COPY_OUT_SYSTEM_EXT := $(_system_ext_path_placeholder)
 TARGET_COPY_OUT_ODM := $(_odm_path_placeholder)
 TARGET_COPY_OUT_VENDOR_DLKM := $(_vendor_dlkm_path_placeholder)
+TARGET_COPY_OUT_ODM_DLKM := $(_odm_dlkm_path_placeholder)
 
 # Returns the non-sanitized version of the path provided in $1.
 define get_non_asan_path
@@ -755,6 +757,40 @@
     $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED \
     , vendor_dlkm should not contain any executables, libraries, or apps)
 
+TARGET_OUT_ODM_DLKM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM_DLKM)
+
+TARGET_OUT_ODM_DLKM_ETC := $(TARGET_OUT_ODM_DLKM)/etc
+.KATI_READONLY := \
+  TARGET_OUT_ODM_DLKM_ETC
+
+# Unlike other partitions, odm_dlkm should only contain kernel modules.
+TARGET_OUT_ODM_DLKM_EXECUTABLES :=
+TARGET_OUT_ODM_DLKM_OPTIONAL_EXECUTABLES :=
+TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES :=
+TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE :=
+TARGET_OUT_ODM_DLKM_JAVA_LIBRARIES :=
+TARGET_OUT_ODM_DLKM_APPS :=
+TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED :=
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_EXECUTABLES :=
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES :=
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE :=
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS :=
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED :=
+$(KATI_obsolete_var \
+    TARGET_OUT_ODM_DLKM_EXECUTABLES \
+    TARGET_OUT_ODM_DLKM_OPTIONAL_EXECUTABLES \
+    TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES \
+    TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE \
+    TARGET_OUT_ODM_DLKM_JAVA_LIBRARIES \
+    TARGET_OUT_ODM_DLKM_APPS \
+    TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED \
+    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_EXECUTABLES \
+    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES \
+    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE \
+    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS \
+    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED \
+    , odm_dlkm should not contain any executables, libraries, or apps)
+
 TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT)
 TARGET_OUT_PRODUCT_EXECUTABLES := $(TARGET_OUT_PRODUCT)/bin
 .KATI_READONLY := TARGET_OUT_PRODUCT
diff --git a/core/java_common.mk b/core/java_common.mk
index 658296d..b7f2883 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -6,10 +6,6 @@
 my_soong_problems += dotdot_srcs
 endif
 
-ifneq (,$(LOCAL_JNI_SHARED_LIBRARIES))
-my_soong_problems += jni_libs
-endif
-
 ###########################################################
 ## Java version
 ###########################################################
@@ -235,7 +231,7 @@
 
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
 
-# Sanity check class path vars.
+# Quickly check class path vars.
 disallowed_deps := $(foreach sdk,$(TARGET_AVAILABLE_SDK_VERSIONS),$(call resolve-prebuilt-sdk-module,$(sdk)))
 disallowed_deps += $(foreach sdk,$(TARGET_AVAILABLE_SDK_VERSIONS),\
   $(foreach sdk_lib,$(JAVA_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(sdk),$(sdk_lib))))
@@ -546,6 +542,10 @@
     $(LOCAL_JAVA_LIBRARIES) \
     $(LOCAL_JNI_SHARED_LIBRARIES)
 SOONG_CONV.$(LOCAL_MODULE).TYPE := java
+SOONG_CONV.$(LOCAL_MODULE).MAKEFILES := \
+    $(SOONG_CONV.$(LOCAL_MODULE).MAKEFILES) $(LOCAL_MODULE_MAKEFILE)
+SOONG_CONV.$(LOCAL_MODULE).INSTALLED := \
+    $(SOONG_CONV.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE)
 SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE)
 
 endif
diff --git a/core/line_coverage.mk b/core/line_coverage.mk
index babcb30..6bfbb8d 100644
--- a/core/line_coverage.mk
+++ b/core/line_coverage.mk
@@ -12,11 +12,11 @@
 # -----------------------------------------------------------------
 
 # TODO(b/148306195): Due this issue some fuzz targets cannot be built with
-# line coverage instrumentation. For now we just blacklist them.
-blacklisted_fuzz_targets := libneuralnetworks_fuzzer
+# line coverage instrumentation. For now we just block them.
+blocked_fuzz_targets := libneuralnetworks_fuzzer
 
 fuzz_targets := $(ALL_FUZZ_TARGETS)
-fuzz_targets := $(filter-out $(blacklisted_fuzz_targets),$(fuzz_targets))
+fuzz_targets := $(filter-out $(blocked_fuzz_targets),$(fuzz_targets))
 
 
 # Android components that considered critical.
diff --git a/core/main.mk b/core/main.mk
index 8ac0717..b8b4404 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -150,9 +150,6 @@
 # Bring in standard build system definitions.
 include $(BUILD_SYSTEM)/definitions.mk
 
-# Bring in dex_preopt.mk
-include $(BUILD_SYSTEM)/dex_preopt.mk
-
 ifneq ($(filter user userdebug eng,$(MAKECMDGOALS)),)
 $(info ***************************************************************)
 $(info ***************************************************************)
@@ -235,12 +232,6 @@
   else
     ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
   endif
-  ifdef BOARD_VNDK_RUNTIME_DISABLE
-    ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true
-  endif
-else
-  ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
-  ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true
 endif
 
 # Add cpu properties for bionic and ART.
@@ -473,6 +464,12 @@
 # Typical build; include any Android.mk files we can find.
 #
 
+# Bring in dex_preopt.mk
+# This creates some modules so it needs to be included after
+# should-install-to-system is defined (in order for base_rules.mk to function
+# properly), but before readonly-final-product-vars is called.
+include $(BUILD_SYSTEM)/dex_preopt.mk
+
 # Strip and readonly a few more variables so they won't be modified.
 $(readonly-final-product-vars)
 ADDITIONAL_SYSTEM_PROPERTIES := $(strip $(ADDITIONAL_SYSTEM_PROPERTIES))
@@ -1142,7 +1139,8 @@
       $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),\
         $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),\
           $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),\
-            $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2))))))))
+            $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),\
+              $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2)))))))))
 endef
 
 # Returns modules included automatically as a result of certain BoardConfig
@@ -1228,7 +1226,7 @@
       # Strip :32 and :64 suffixes
       _modules := $(patsubst %:32,%,$(_modules))
       _modules := $(patsubst %:64,%,$(_modules))
-      # Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
+      # Quickly check all modules in PRODUCT_PACKAGES exist. We check for the
       # existence if either <module> or the <module>_32 variant.
       _nonexistent_modules := $(foreach m,$(_modules), \
         $(if $(or $(ALL_MODULES.$(m).PATH),$(call get-modules-for-2nd-arch,TARGET,$(m))),,$(m)))
@@ -1523,6 +1521,9 @@
 .PHONY: vendor_dlkmimage
 vendor_dlkmimage: $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)
 
+.PHONY: odm_dlkmimage
+odm_dlkmimage: $(INSTALLED_ODM_DLKMIMAGE_TARGET)
+
 .PHONY: systemotherimage
 systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
 
@@ -1541,6 +1542,12 @@
 .PHONY: vbmetaimage
 vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET)
 
+.PHONY: vbmetasystemimage
+vbmetasystemimage: $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET)
+
+.PHONY: vbmetavendorimage
+vbmetavendorimage: $(INSTALLED_VBMETA_VENDORIMAGE_TARGET)
+
 # Build files and then package it into the rom formats
 .PHONY: droidcore
 droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
@@ -1552,6 +1559,8 @@
     $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
     $(INSTALLED_RECOVERYIMAGE_TARGET) \
     $(INSTALLED_VBMETAIMAGE_TARGET) \
+    $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
+    $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
     $(INSTALLED_USERDATAIMAGE_TARGET) \
     $(INSTALLED_CACHEIMAGE_TARGET) \
     $(INSTALLED_BPTIMAGE_TARGET) \
@@ -1561,6 +1570,7 @@
     $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \
     $(INSTALLED_ODMIMAGE_TARGET) \
     $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
+    $(INSTALLED_ODM_DLKMIMAGE_TARGET) \
     $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \
     $(INSTALLED_PRODUCTIMAGE_TARGET) \
     $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
@@ -1572,6 +1582,8 @@
     $(INSTALLED_FILES_JSON_ODM) \
     $(INSTALLED_FILES_FILE_VENDOR_DLKM) \
     $(INSTALLED_FILES_JSON_VENDOR_DLKM) \
+    $(INSTALLED_FILES_FILE_ODM_DLKM) \
+    $(INSTALLED_FILES_JSON_ODM_DLKM) \
     $(INSTALLED_FILES_FILE_PRODUCT) \
     $(INSTALLED_FILES_JSON_PRODUCT) \
     $(INSTALLED_FILES_FILE_SYSTEM_EXT) \
@@ -1615,6 +1627,14 @@
     $(if $(ALL_MODULES.$(m).BUNDLE),$(ALL_MODULES.$(m).BUNDLE):$(m)-base.zip))
   $(call dist-for-goals,apps_only, $(apps_only_bundle_files))
 
+  # Dist the lint reports if they exist.
+  apps_only_lint_report_files := $(foreach m,$(unbundled_build_modules),\
+    $(foreach report,$(ALL_MODULES.$(m).LINT_REPORTS),\
+      $(report):$(m)-$(notdir $(report))))
+  .PHONY: lint-check
+  lint-check: $(foreach f, $(apps_only_lint_report_files), $(call word-colon,1,$(f)))
+  $(call dist-for-goals,lint-check, $(apps_only_lint_report_files))
+
   # For uninstallable modules such as static Java library, we have to dist the built file,
   # as <module_name>.<suffix>
   apps_only_dist_built_files := $(foreach m,$(unbundled_build_modules),$(if $(ALL_MODULES.$(m).INSTALLED),,\
@@ -1669,6 +1689,8 @@
     $(INSTALLED_FILES_JSON_ODM) \
     $(INSTALLED_FILES_FILE_VENDOR_DLKM) \
     $(INSTALLED_FILES_JSON_VENDOR_DLKM) \
+    $(INSTALLED_FILES_FILE_ODM_DLKM) \
+    $(INSTALLED_FILES_JSON_ODM_DLKM) \
     $(INSTALLED_FILES_FILE_PRODUCT) \
     $(INSTALLED_FILES_JSON_PRODUCT) \
     $(INSTALLED_FILES_FILE_SYSTEM_EXT) \
diff --git a/core/product.mk b/core/product.mk
index 740563f..324010c 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -252,6 +252,7 @@
 _product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION
 _product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION
 _product_single_value_vars += PRODUCT_VENDOR_DLKM_VERITY_PARTITION
+_product_single_value_vars += PRODUCT_ODM_DLKM_VERITY_PARTITION
 _product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO
 _product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO
 
@@ -280,6 +281,7 @@
 _product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH
 _product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH
 _product_single_value_vars += PRODUCT_VENDOR_DLKM_BASE_FS_PATH
+_product_single_value_vars += PRODUCT_ODM_DLKM_BASE_FS_PATH
 
 # The first API level this product shipped with
 _product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL
@@ -372,6 +374,7 @@
 _product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE
 _product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE
 _product_single_value_vars += PRODUCT_BUILD_VENDOR_DLKM_IMAGE
+_product_single_value_vars += PRODUCT_BUILD_ODM_DLKM_IMAGE
 _product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE
 _product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE
 _product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE
diff --git a/core/product_config.mk b/core/product_config.mk
index d614e10..38926c2 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -166,7 +166,7 @@
   $(if $(filter-out $(makefile),$(PRODUCTS)),$(eval $(call import-products,$(makefile))))\
 )
 
-# Sanity check
+# Quick check
 $(check-all-products)
 
 ifneq ($(filter dump-products, $(MAKECMDGOALS)),)
@@ -201,7 +201,7 @@
 $(call strip-product-vars)
 
 #############################################################################
-# Sanity check and assign default values
+# Quick check and assign default values
 
 TARGET_DEVICE := $(PRODUCT_DEVICE)
 
@@ -400,6 +400,7 @@
     SYSTEM_EXT \
     ODM \
     VENDOR_DLKM \
+    ODM_DLKM \
     CACHE \
     RAMDISK \
     USERDATA \
diff --git a/core/robolectric_test_config_template.xml b/core/robolectric_test_config_template.xml
new file mode 100644
index 0000000..e79abd5
--- /dev/null
+++ b/core/robolectric_test_config_template.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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 test config file is auto-generated. -->
+<configuration description="Runs {MODULE}">
+    <option name="test-suite-tag" value="apct" />
+    <option name="test-suite-tag" value="apct-junit" />
+
+    <option name="java-folder" value="prebuilts/jdk/jdk9/linux-x86/" />
+    <option name="exclude-paths" value="java" />
+    <option name="use-robolectric-resources" value="true" />
+
+    {EXTRA_CONFIGS}
+
+    <test class="com.android.tradefed.testtype.IsolatedHostTest" >
+        <option name="jar" value="{MODULE}.jar" />
+    </test>
+</configuration>
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 3549c1d..46b16ac 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -11,6 +11,7 @@
 # LOCAL_SOONG_RRO_DIRS
 # LOCAL_SOONG_JNI_LIBS_$(TARGET_ARCH)
 # LOCAL_SOONG_JNI_LIBS_$(TARGET_2ND_ARCH)
+# LOCAL_SOONG_JNI_LIBS_SYMBOLS
 
 ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
   $(call pretty-error,soong_app_prebuilt.mk may only be used from Soong)
@@ -118,6 +119,11 @@
 $(call create-suite-dependencies)
 endif
 
+# install symbol files of JNI libraries
+my_jni_lib_symbols_copy_files := $(foreach f,$(LOCAL_SOONG_JNI_LIBS_SYMBOLS),\
+  $(call word-colon,1,$(f)):$(patsubst $(PRODUCT_OUT)/%,$(TARGET_OUT_UNSTRIPPED)/%,$(call word-colon,2,$(f))))
+$(LOCAL_BUILT_MODULE): $(call copy-many-files, $(my_jni_lib_symbols_copy_files))
+
 # embedded JNI will already have been handled by soong
 my_embed_jni :=
 my_prebuilt_jni_libs :=
@@ -170,6 +176,10 @@
   ALL_MODULES.$(my_register_name).BUNDLE := $(LOCAL_SOONG_BUNDLE)
 endif
 
+ifdef LOCAL_SOONG_LINT_REPORTS
+  ALL_MODULES.$(my_register_name).LINT_REPORTS := $(LOCAL_SOONG_LINT_REPORTS)
+endif
+
 ifndef LOCAL_IS_HOST_MODULE
 ifeq ($(LOCAL_SDK_VERSION),system_current)
 my_link_type := java:system
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 986609b..c9b742a 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -113,7 +113,10 @@
 ifeq ($(LOCAL_CHECK_SAME_VNDK_VARIANTS),true)
   ifeq ($(filter hwaddress address, $(SANITIZE_TARGET)),)
     ifneq ($(CLANG_COVERAGE),true)
-      my_check_same_vndk_variants := true
+        # Do not compare VNDK variant for special cases e.g. coverage builds.
+        ifneq ($(SKIP_VNDK_VARIANTS_CHECK),true)
+            my_check_same_vndk_variants := true
+        endif
     endif
   endif
 endif
diff --git a/core/soong_config.mk b/core/soong_config.mk
index efd811e..98ab07d 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -129,7 +129,6 @@
 $(call add_json_str,  Platform_vndk_version,             $(PLATFORM_VNDK_VERSION))
 $(call add_json_str,  ProductVndkVersion,                $(PRODUCT_PRODUCT_VNDK_VERSION))
 $(call add_json_list, ExtraVndkVersions,                 $(PRODUCT_EXTRA_VNDK_VERSIONS))
-$(call add_json_bool, BoardVndkRuntimeDisable,           $(BOARD_VNDK_RUNTIME_DISABLE))
 $(call add_json_list, DeviceSystemSdkVersions,           $(BOARD_SYSTEMSDK_VERSIONS))
 $(call add_json_list, Platform_systemsdk_versions,       $(PLATFORM_SYSTEMSDK_VERSIONS))
 $(call add_json_bool, Malloc_not_svelte,                 $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
@@ -156,6 +155,7 @@
 $(call add_json_str,  VendorPath,                        $(TARGET_COPY_OUT_VENDOR))
 $(call add_json_str,  OdmPath,                           $(TARGET_COPY_OUT_ODM))
 $(call add_json_str,  VendorDlkmPath,                    $(TARGET_COPY_OUT_VENDOR_DLKM))
+$(call add_json_str,  OdmDlkmPath,                       $(TARGET_COPY_OUT_ODM_DLKM))
 $(call add_json_str,  ProductPath,                       $(TARGET_COPY_OUT_PRODUCT))
 $(call add_json_str,  SystemExtPath,                     $(TARGET_COPY_OUT_SYSTEM_EXT))
 $(call add_json_bool, MinimizeJavaDebugInfo,             $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
@@ -174,6 +174,7 @@
 $(call add_json_list, BoardVendorSepolicyDirs,           $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS))
 $(call add_json_list, BoardOdmSepolicyDirs,              $(BOARD_ODM_SEPOLICY_DIRS))
 $(call add_json_list, BoardVendorDlkmSepolicyDirs,       $(BOARD_VENDOR_DLKM_SEPOLICY_DIRS))
+$(call add_json_list, BoardOdmDlkmSepolicyDirs,          $(BOARD_ODM_DLKM_SEPOLICY_DIRS))
 $(call add_json_list, BoardPlatPublicSepolicyDirs,       $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
 $(call add_json_list, BoardPlatPrivateSepolicyDirs,      $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
 $(call add_json_list, BoardSepolicyM4Defs,               $(BOARD_SEPOLICY_M4DEFS))
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index e4c84e0..05f700d 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -94,16 +94,18 @@
     boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS), $(call word-colon,2,$(pair)))
     ifneq ($(filter $(LOCAL_MODULE),$(boot_jars)),) # is_boot_jar
       ifeq (true,$(WITH_DEXPREOPT))
-        # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
-        # We use this installed_odex trick to get boot.art installed.
-        installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
-        # Append the odex for the 2nd arch if we have one.
-        installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
-        ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
-        # Make sure to install the .odex and .vdex when you run "make <module_name>"
-       $(my_all_targets): $(installed_odex)
-       # Copy $(LOCAL_BUILT_MODULE) and its dependencies when installing boot.art
-       $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(LOCAL_BUILT_MODULE)
+        # $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) contains modules that installs
+        # all of bootjars' dexpreopt files (.art, .oat, .vdex, ...)
+        # Add them to the required list so they are installed alongside this module.
+        ALL_MODULES.$(my_register_name).REQUIRED_FROM_TARGET += \
+          $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) \
+          $(2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE)
+        # Copy $(LOCAL_BUILT_MODULE) and its dependencies when installing boot.art
+        # so that dependencies of $(LOCAL_BUILT_MODULE) (which may include
+        # jacoco-report-classes.jar) are copied for every build.
+        $(foreach m,$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) $(2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE), \
+          $(eval $(call add-dependency,$(firstword $(call module-installed-files,$(m))),$(LOCAL_BUILT_MODULE))) \
+        )
       endif
     endif # is_boot_jar
 
diff --git a/core/sysprop.mk b/core/sysprop.mk
index 99c7ebd..d01255f 100644
--- a/core/sysprop.mk
+++ b/core/sysprop.mk
@@ -230,7 +230,7 @@
 $(strip $(subst _,-, $(firstword $(1))))
 endef
 
-gen_from_buildinfo_sh := $(call intermediates-dir-for,ETC,system_build_prop)/buildinfo.prop
+gen_from_buildinfo_sh := $(call intermediates-dir-for,PACKAGING,system_build_prop)/buildinfo.prop
 $(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT)
 	$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
 	        TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
@@ -401,6 +401,15 @@
     vendor_dlkm,\
     $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
 
+# ----------------------------------------------------------------
+# odm_dlkm/etc/build.prop
+#
+
+INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
+$(eval $(call build-properties,\
+    odm_dlkm,\
+    $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
+
 # -----------------------------------------------------------------
 # system_ext/etc/build.prop
 #
diff --git a/core/tasks/ide.mk b/core/tasks/ide.mk
index e557e60..a3aa0cd 100644
--- a/core/tasks/ide.mk
+++ b/core/tasks/ide.mk
@@ -40,8 +40,7 @@
   endif
 
   source_paths := $(foreach m,$(eclipse_project_modules),$(ALL_MODULES.$(m).PATH)) \
-              $(foreach m,$(eclipse_project_modules),$(ALL_MODULES.$(m).INTERMEDIATE_SOURCE_DIR)) \
-              $(INTERNAL_SDK_SOURCE_DIRS)
+              $(foreach m,$(eclipse_project_modules),$(ALL_MODULES.$(m).INTERMEDIATE_SOURCE_DIR))
   source_paths := $(sort $(source_paths))
 
 .classpath: PRIVATE_MODULES := $(eclipse_project_modules)
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index 89a34d6..4d7d67e 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -108,10 +108,10 @@
 
 $(foreach m, $(_vendor_check_modules), \
   $(if $(filter-out ,$(ALL_MODULES.$(m).INSTALLED)),\
-    $(if $(filter $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_ODM)/% $(TARGET_OUT_VENDOR_DLKM)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\
+    $(if $(filter $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_ODM)/% $(TARGET_OUT_VENDOR_DLKM)/% $(TARGET_OUT_ODM_DLKM)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\
       $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) \
         in product "$(TARGET_PRODUCT)" being installed to \
-        $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor, odm or vendor_dlkm tree))))
+        $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor, odm, vendor_dlkm or odm_dlkm tree))))
 
 endif
 
diff --git a/core/tasks/vndk.mk b/core/tasks/vndk.mk
index a2973b4..ebe9bd4 100644
--- a/core/tasks/vndk.mk
+++ b/core/tasks/vndk.mk
@@ -20,18 +20,11 @@
 # PLATFORM_VNDK_VERSION must be set.
 ifneq (,$(PLATFORM_VNDK_VERSION))
 
-# BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'.
-ifneq ($(BOARD_VNDK_RUNTIME_DISABLE),true)
-
 .PHONY: vndk
 vndk: $(SOONG_VNDK_SNAPSHOT_ZIP)
 
 $(call dist-for-goals, vndk, $(SOONG_VNDK_SNAPSHOT_ZIP))
 
-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'."
-endif # BOARD_VNDK_RUNTIME_DISABLE
-
 else # PLATFORM_VNDK_VERSION is NOT set
 error_msg := "CANNOT generate VNDK snapshot. PLATFORM_VNDK_VERSION must be set."
 endif # PLATFORM_VNDK_VERSION
diff --git a/help.sh b/help.sh
index 37018f7..4af5154 100755
--- a/help.sh
+++ b/help.sh
@@ -46,6 +46,8 @@
                             Stands for "Odm, NO Dependencies"
     vdnod                   Quickly rebuild the vendor_dlkm image from built packages
                             Stands for "VendorDlkm, NO Dependencies"
+    odnod                   Quickly rebuild the odm_dlkm image from built packages
+                            Stands for "OdmDlkm, NO Dependencies"
 
 
 So, for example, you could run:
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 2963ee4..22108fa 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -61,12 +61,17 @@
 BOARD_KERNEL-5.4_BOOTIMAGE_PARTITION_SIZE := 67108864
 BOARD_KERNEL-5.4-GZ_BOOTIMAGE_PARTITION_SIZE := 47185920
 BOARD_KERNEL-5.4-LZ4_BOOTIMAGE_PARTITION_SIZE := 53477376
+BOARD_KERNEL-MAINLINE_BOOTIMAGE_PARTITION_SIZE := 67108864
+BOARD_KERNEL-MAINLINE-GZ_BOOTIMAGE_PARTITION_SIZE := 47185920
+BOARD_KERNEL-MAINLINE-LZ4_BOOTIMAGE_PARTITION_SIZE := 53477376
+
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
 
 BOARD_BOOT_HEADER_VERSION := 3
 BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
 
-BOARD_KERNEL_BINARIES := kernel-5.4 kernel-5.4-gz kernel-5.4-lz4
+BOARD_KERNEL_BINARIES := kernel-5.4 kernel-5.4-gz kernel-5.4-lz4 \
+    kernel-mainline kernel-mainline-gz kernel-mainline-lz4
 
 # Some vendors still haven't cleaned up all device specific directories under
 # root!
diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk
index b34004f..d8d06cd 100644
--- a/target/board/generic_arm64/device.mk
+++ b/target/board/generic_arm64/device.mk
@@ -17,4 +17,7 @@
 PRODUCT_COPY_FILES += \
     device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4:kernel-5.4 \
     device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-gz:kernel-5.4-gz \
-    device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-lz4:kernel-5.4-lz4
+    device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-lz4:kernel-5.4-lz4 \
+    kernel/prebuilts/mainline/arm64/kernel-mainline:kernel-mainline \
+    kernel/prebuilts/mainline/arm64/kernel-mainline-gz:kernel-mainline-gz \
+    kernel/prebuilts/mainline/arm64/kernel-mainline-lz4:kernel-mainline-lz4
diff --git a/target/board/gsi_system_ext.prop b/target/board/gsi_system_ext.prop
index dd3227e..780aadc 100644
--- a/target/board/gsi_system_ext.prop
+++ b/target/board/gsi_system_ext.prop
@@ -12,8 +12,3 @@
 
 # TODO(b/78105955): disable privapp_permissions checking before the bug solved
 ro.control_privapp_permissions=disable
-
-# TODO(b/136212765): the default for LMK
-ro.lmk.kill_heaviest_task=true
-ro.lmk.kill_timeout_ms=100
-ro.lmk.use_minfree_levels=true
diff --git a/target/board/gsi_system_ext_user.prop b/target/board/gsi_system_ext_user.prop
index db6d880..217bd01 100644
--- a/target/board/gsi_system_ext_user.prop
+++ b/target/board/gsi_system_ext_user.prop
@@ -9,8 +9,3 @@
 
 # TODO(b/78105955): disable privapp_permissions checking before the bug solved
 ro.control_privapp_permissions=disable
-
-# TODO(b/136212765): the default for LMK
-ro.lmk.kill_heaviest_task=true
-ro.lmk.kill_timeout_ms=100
-ro.lmk.use_minfree_levels=true
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index d66136e..345faa4 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -18,6 +18,8 @@
 LLNDK: libsync.so
 LLNDK: libvndksupport.so
 LLNDK: libvulkan.so
+VNDK-SP: android.hardware.common-V1-ndk_platform.so
+VNDK-SP: android.hardware.graphics.common-V1-ndk_platform.so
 VNDK-SP: android.hardware.graphics.common@1.0.so
 VNDK-SP: android.hardware.graphics.common@1.1.so
 VNDK-SP: android.hardware.graphics.common@1.2.so
diff --git a/target/product/mainline_system_arm64.mk b/target/product/mainline_system_arm64.mk
index e536e55..a0c3e6d 100644
--- a/target/product/mainline_system_arm64.mk
+++ b/target/product/mainline_system_arm64.mk
@@ -27,6 +27,7 @@
 PRODUCT_BUILD_CACHE_IMAGE := false
 PRODUCT_BUILD_ODM_IMAGE := false
 PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false
+PRODUCT_BUILD_ODM_DLKM_IMAGE := false
 PRODUCT_BUILD_PRODUCT_IMAGE  := false
 PRODUCT_BUILD_RAMDISK_IMAGE := false
 PRODUCT_BUILD_SYSTEM_IMAGE := true
diff --git a/target/product/mainline_system_x86.mk b/target/product/mainline_system_x86.mk
index 484ae30..3c4a867 100644
--- a/target/product/mainline_system_x86.mk
+++ b/target/product/mainline_system_x86.mk
@@ -26,6 +26,7 @@
 PRODUCT_BUILD_CACHE_IMAGE := false
 PRODUCT_BUILD_ODM_IMAGE := false
 PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false
+PRODUCT_BUILD_ODM_DLKM_IMAGE := false
 PRODUCT_BUILD_PRODUCT_IMAGE  := false
 PRODUCT_BUILD_RAMDISK_IMAGE := false
 PRODUCT_BUILD_SYSTEM_IMAGE := true
diff --git a/target/product/mainline_system_x86_64.mk b/target/product/mainline_system_x86_64.mk
index ad31f81..410c998 100644
--- a/target/product/mainline_system_x86_64.mk
+++ b/target/product/mainline_system_x86_64.mk
@@ -27,6 +27,7 @@
 PRODUCT_BUILD_CACHE_IMAGE := false
 PRODUCT_BUILD_ODM_IMAGE := false
 PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false
+PRODUCT_BUILD_ODM_DLKM_IMAGE := false
 PRODUCT_BUILD_PRODUCT_IMAGE  := false
 PRODUCT_BUILD_RAMDISK_IMAGE := false
 PRODUCT_BUILD_SYSTEM_IMAGE := true
diff --git a/target/product/mainline_system_x86_arm.mk b/target/product/mainline_system_x86_arm.mk
index 24f1ad7..8c6611e 100644
--- a/target/product/mainline_system_x86_arm.mk
+++ b/target/product/mainline_system_x86_arm.mk
@@ -26,6 +26,7 @@
 PRODUCT_BUILD_CACHE_IMAGE := false
 PRODUCT_BUILD_ODM_IMAGE := false
 PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false
+PRODUCT_BUILD_ODM_DLKM_IMAGE := false
 PRODUCT_BUILD_PRODUCT_IMAGE  := false
 PRODUCT_BUILD_RAMDISK_IMAGE := false
 PRODUCT_BUILD_SYSTEM_IMAGE := true
diff --git a/tools/Android.bp b/tools/Android.bp
index 149d06d..e0f3739 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -56,3 +56,23 @@
   test_config: "post_process_props_unittest.xml",
   test_suites: ["general-tests"],
 }
+
+python_binary_host {
+  name: "extract_kernel",
+  srcs: ["extract_kernel.py"],
+  version: {
+    py2: {
+      enabled: true,
+    },
+    py3: {
+      enabled: false,
+    },
+  },
+}
+
+genrule_defaults {
+  name: "extract_kernel_release_defaults",
+  tools: ["extract_kernel", "lz4"],
+  out: ["kernel_release.txt"],
+  cmd: "$(location) --tools lz4:$(location lz4) --input $(in) --output-release > $(out)"
+}
diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py
index de855c6..372404b 100755
--- a/tools/check_elf_file.py
+++ b/tools/check_elf_file.py
@@ -174,7 +174,7 @@
   @classmethod
   def open(cls, elf_file_path, llvm_readobj):
     """Open and parse the ELF file."""
-    # Parse the ELF header for simple sanity checks.
+    # Parse the ELF header to check the magic word.
     header = cls._read_elf_header(elf_file_path)
     if not header or header.ei_magic != _ELF_MAGIC:
       raise ELFInvalidMagicError()
diff --git a/tools/extract_kernel.py b/tools/extract_kernel.py
index 8ca11d1..92a647b 100755
--- a/tools/extract_kernel.py
+++ b/tools/extract_kernel.py
@@ -40,10 +40,10 @@
 # LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
 LINUX_BANNER_PREFIX = b'Linux version '
 LINUX_BANNER_REGEX = LINUX_BANNER_PREFIX + \
-    r'([0-9]+[.][0-9]+[.][0-9]+).* \(.*@.*\) \(.*\) .*\n'
+    r'(?P<release>(?P<version>[0-9]+[.][0-9]+[.][0-9]+).*) \(.*@.*\) \(.*\) .*\n'
 
 
-def get_version(input_bytes, start_idx):
+def get_from_release(input_bytes, start_idx, key):
   null_idx = input_bytes.find('\x00', start_idx)
   if null_idx < 0:
     return None
@@ -53,24 +53,43 @@
     return None
   mo = re.match(LINUX_BANNER_REGEX, linux_banner)
   if mo:
-    return mo.group(1)
+    return mo.group(key)
   return None
 
 
-def dump_version(input_bytes):
+def dump_from_release(input_bytes, key):
+  """
+  Helper of dump_version and dump_release
+  """
   idx = 0
   while True:
     idx = input_bytes.find(LINUX_BANNER_PREFIX, idx)
     if idx < 0:
       return None
 
-    version = get_version(input_bytes, idx)
-    if version:
-      return version
+    value = get_from_release(input_bytes, idx, key)
+    if value:
+      return value
 
     idx += len(LINUX_BANNER_PREFIX)
 
 
+def dump_version(input_bytes):
+  """
+  Dump kernel version, w.x.y, from input_bytes. Search for the string
+  "Linux version " and do pattern matching after it. See LINUX_BANNER_REGEX.
+  """
+  return dump_from_release(input_bytes, "version")
+
+
+def dump_release(input_bytes):
+  """
+  Dump kernel release, w.x.y-..., from input_bytes. Search for the string
+  "Linux version " and do pattern matching after it. See LINUX_BANNER_REGEX.
+  """
+  return dump_from_release(input_bytes, "release")
+
+
 def dump_configs(input_bytes):
   """
   Dump kernel configuration from input_bytes. This can be done when
@@ -140,6 +159,23 @@
       if o:
         return o
 
+
+def dump_to_file(f, dump_fn, input_bytes, desc):
+  """
+  Call decompress_dump(dump_fn, input_bytes) and write to f. If it fails, return
+  False; otherwise return True.
+  """
+  if f is not None:
+    o = decompress_dump(dump_fn, input_bytes)
+    if o:
+      f.write(o)
+    else:
+      sys.stderr.write(
+          "Cannot extract kernel {}".format(desc))
+      return False
+  return True
+
+
 def main():
   parser = argparse.ArgumentParser(
       formatter_class=argparse.RawTextHelpFormatter,
@@ -165,6 +201,13 @@
                       nargs='?',
                       type=argparse.FileType('wb'),
                       const=sys.stdout)
+  parser.add_argument('--output-release',
+                      help='If specified, write kernel release. Use stdout if '
+                           'no file is specified.',
+                      metavar='FILE',
+                      nargs='?',
+                      type=argparse.FileType('wb'),
+                      const=sys.stdout)
   parser.add_argument('--tools',
                       help='Decompression tools to use. If not specified, PATH '
                            'is searched.',
@@ -181,25 +224,18 @@
   input_bytes = args.input.read()
 
   ret = 0
-  if args.output_configs is not None:
-    o = decompress_dump(dump_configs, input_bytes)
-    if o:
-      args.output_configs.write(o)
-    else:
-      sys.stderr.write(
-          "Cannot extract kernel configs in {}".format(args.input.name))
-      ret = 1
-  if args.output_version is not None:
-    o = decompress_dump(dump_version, input_bytes)
-    if o:
-      args.output_version.write(o)
-    else:
-      sys.stderr.write(
-          "Cannot extract kernel versions in {}".format(args.input.name))
-      ret = 1
+  if not dump_to_file(args.output_configs, dump_configs, input_bytes,
+                      "configs in {}".format(args.input.name)):
+    ret = 1
+  if not dump_to_file(args.output_version, dump_version, input_bytes,
+                      "version in {}".format(args.input.name)):
+    ret = 1
+  if not dump_to_file(args.output_release, dump_release, input_bytes,
+                      "kernel release in {}".format(args.input.name)):
+    ret = 1
 
   return ret
 
 
 if __name__ == '__main__':
-  exit(main())
+  sys.exit(main())
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index 60b51b6..41e8ca5 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -27,12 +27,13 @@
 system_android_filesystem_config := system/core/include/private/android_filesystem_config.h
 system_capability_header := bionic/libc/kernel/uapi/linux/capability.h
 
-# List of supported vendor, oem, odm, vendor_dlkm, product and system_ext Partitions
+# List of supported vendor, oem, odm, vendor_dlkm, odm_dlkm, product and system_ext Partitions
 fs_config_generate_extra_partition_list := $(strip \
   $(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),vendor) \
   $(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),oem) \
   $(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm) \
   $(if $(BOARD_USES_VENDOR_DLKMIMAGE)$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),vendor_dlkm) \
+  $(if $(BOARD_USES_ODM_DLKMIMAGE)$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),odm_dlkm) \
   $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),product) \
   $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),system_ext) \
 )
@@ -334,6 +335,57 @@
 
 endif
 
+ifneq ($(filter odm_dlkm,$(fs_config_generate_extra_partition_list)),)
+##################################
+# Generate the odm_dlkm/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_odm_dlkm to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs_odm_dlkm
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
+LOCAL_MODULE_PATH := $(TARGET_OUT_ODM_DLKM)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
+$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(system_capability_header)
+$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
+$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) $(system_capability_header)
+	@mkdir -p $(dir $@)
+	$< fsconfig \
+	   --aid-header $(PRIVATE_ANDROID_FS_HDR) \
+	   --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
+	   --partition odm_dlkm \
+	   --dirs \
+	   --out_file $@ \
+	   $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
+
+##################################
+# Generate the odm_dlkm/etc/fs_config_files binary file for the target
+# Add fs_config_files of fs_config_files_odm_dlkm to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files_odm_dlkm
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_files
+LOCAL_MODULE_PATH := $(TARGET_OUT_ODM_DLKM)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
+$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(system_capability_header)
+$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
+$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) $(system_capability_header)
+	@mkdir -p $(dir $@)
+	$< fsconfig \
+	   --aid-header $(PRIVATE_ANDROID_FS_HDR) \
+	   --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
+	   --partition odm_dlkm \
+	   --files \
+	   --out_file $@ \
+	   $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
+
+endif
+
 ifneq ($(filter product,$(fs_config_generate_extra_partition_list)),)
 ##################################
 # Generate the product/etc/fs_config_dirs binary file for the target
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index 1405fd3..940a398 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -299,11 +299,10 @@
     Parses a C header file and extracts lines starting with #define AID_<name>
     while capturing the OEM defined ranges and ignoring other ranges. It also
     skips some hardcoded AIDs it doesn't need to generate a mapping for.
-    It provides some basic sanity checks. The information extracted from this
-    file can later be used to sanity check other things (like oem ranges) as
-    well as generating a mapping of names to uids. It was primarily designed to
-    parse the private/android_filesystem_config.h, but any C header should
-    work.
+    It provides some basic checks. The information extracted from this file can
+    later be used to quickly check other things (like oem ranges) as well as
+    generating a mapping of names to uids. It was primarily designed to parse
+    the private/android_filesystem_config.h, but any C header should work.
     """
 
     _SKIP_AIDS = [
@@ -394,7 +393,7 @@
     def _handle_aid(self, identifier, value):
         """Handle an AID C #define.
 
-        Handles an AID, sanity checking, generating the friendly name and
+        Handles an AID, quick checking, generating the friendly name and
         adding it to the internal maps. Internal use only.
 
         Args:
@@ -422,7 +421,7 @@
         """Process, check and populate internal data structures.
 
         After parsing and generating the internal data structures, this method
-        is responsible for sanity checking ALL of the acquired data.
+        is responsible for quickly checking ALL of the acquired data.
 
         Raises:
             ValueError: With the message set to indicate the specific error.
diff --git a/tools/generate-notice-files.py b/tools/generate-notice-files.py
index 49011b2..18f2166 100755
--- a/tools/generate-notice-files.py
+++ b/tools/generate-notice-files.py
@@ -73,10 +73,10 @@
 </style>
 """
 
-def combine_notice_files_html(file_hash, input_dir, output_filename):
+def combine_notice_files_html(file_hash, input_dirs, output_filename):
     """Combine notice files in FILE_HASH and output a HTML version to OUTPUT_FILENAME."""
 
-    SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
+    SRC_DIR_STRIP_RE = re.compile("(?:" + "|".join(input_dirs) + ")(/.*).txt")
 
     # Set up a filename to row id table (anchors inside tables don't work in
     # most browsers, but href's to table row ids do)
@@ -131,10 +131,10 @@
     print >> output_file, "</body></html>"
     output_file.close()
 
-def combine_notice_files_text(file_hash, input_dir, output_filename, file_title):
+def combine_notice_files_text(file_hash, input_dirs, output_filename, file_title):
     """Combine notice files in FILE_HASH and output a text version to OUTPUT_FILENAME."""
 
-    SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
+    SRC_DIR_STRIP_RE = re.compile("(?:" + "|".join(input_dirs) + ")(/.*).txt")
     output_file = open(output_filename, "wb")
     print >> output_file, file_title
     for value in file_hash:
@@ -146,10 +146,10 @@
       print >> output_file, open(value[0]).read()
     output_file.close()
 
-def combine_notice_files_xml(files_with_same_hash, input_dir, output_filename):
+def combine_notice_files_xml(files_with_same_hash, input_dirs, output_filename):
     """Combine notice files in FILE_HASH and output a XML version to OUTPUT_FILENAME."""
 
-    SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
+    SRC_DIR_STRIP_RE = re.compile("(?:" + "|".join(input_dirs) + ")(/.*).txt")
 
     # Set up a filename to row id table (anchors inside tables don't work in
     # most browsers, but href's to table row ids do)
@@ -205,7 +205,7 @@
         '-t', '--title', required=True,
         help='The file title.')
     parser.add_argument(
-        '-s', '--source-dir', required=True,
+        '-s', '--source-dir', required=True, action='append',
         help='The directory containing notices.')
     parser.add_argument(
         '-i', '--included-subdirs', action='append',
@@ -229,39 +229,40 @@
     if args.excluded_subdirs is not None:
         excluded_subdirs = args.excluded_subdirs
 
+    input_dirs = [os.path.normpath(source_dir) for source_dir in args.source_dir]
     # Find all the notice files and md5 them
-    input_dir = os.path.normpath(args.source_dir)
-    files_with_same_hash = defaultdict(list)
-    for root, dir, files in os.walk(input_dir):
-        for file in files:
-            matched = True
-            if len(included_subdirs) > 0:
-                matched = False
-                for subdir in included_subdirs:
-                    if (root == (input_dir + '/' + subdir) or
-                        root.startswith(input_dir + '/' + subdir + '/')):
-                        matched = True
-                        break
-            elif len(excluded_subdirs) > 0:
-                for subdir in excluded_subdirs:
-                    if (root == (input_dir + '/' + subdir) or
-                        root.startswith(input_dir + '/' + subdir + '/')):
-                        matched = False
-                        break
-            if matched and file.endswith(".txt"):
-                filename = os.path.join(root, file)
-                file_md5sum = md5sum(filename)
-                files_with_same_hash[file_md5sum].append(filename)
+    for input_dir in input_dirs:
+        files_with_same_hash = defaultdict(list)
+        for root, dir, files in os.walk(input_dir):
+            for file in files:
+                matched = True
+                if len(included_subdirs) > 0:
+                    matched = False
+                    for subdir in included_subdirs:
+                        if (root == (input_dir + '/' + subdir) or
+                            root.startswith(input_dir + '/' + subdir + '/')):
+                            matched = True
+                            break
+                elif len(excluded_subdirs) > 0:
+                    for subdir in excluded_subdirs:
+                        if (root == (input_dir + '/' + subdir) or
+                            root.startswith(input_dir + '/' + subdir + '/')):
+                            matched = False
+                            break
+                if matched and file.endswith(".txt"):
+                    filename = os.path.join(root, file)
+                    file_md5sum = md5sum(filename)
+                    files_with_same_hash[file_md5sum].append(filename)
 
-    filesets = [sorted(files_with_same_hash[md5]) for md5 in sorted(files_with_same_hash.keys())]
+        filesets = [sorted(files_with_same_hash[md5]) for md5 in sorted(files_with_same_hash.keys())]
 
-    combine_notice_files_text(filesets, input_dir, txt_output_file, file_title)
+    combine_notice_files_text(filesets, input_dirs, txt_output_file, file_title)
 
     if html_output_file is not None:
-        combine_notice_files_html(filesets, input_dir, html_output_file)
+        combine_notice_files_html(filesets, input_dirs, html_output_file)
 
     if xml_output_file is not None:
-        combine_notice_files_xml(files_with_same_hash, input_dir, xml_output_file)
+        combine_notice_files_xml(files_with_same_hash, input_dirs, xml_output_file)
 
 if __name__ == "__main__":
     main(sys.argv)
diff --git a/tools/mk2bp_catalog.py b/tools/mk2bp_catalog.py
new file mode 100755
index 0000000..83abd62
--- /dev/null
+++ b/tools/mk2bp_catalog.py
@@ -0,0 +1,892 @@
+#!/usr/bin/env python3
+
+"""
+Command to print info about makefiles remaining to be converted to soong.
+
+See usage / argument parsing below for commandline options.
+"""
+
+import argparse
+import csv
+import itertools
+import json
+import os
+import re
+import sys
+
+DIRECTORY_PATTERNS = [x.split("/") for x in (
+  "device/*",
+  "frameworks/*",
+  "hardware/*",
+  "packages/*",
+  "vendor/*",
+  "*",
+)]
+
+def match_directory_group(pattern, filename):
+  match = []
+  filename = filename.split("/")
+  if len(filename) < len(pattern):
+    return None
+  for i in range(len(pattern)):
+    pattern_segment = pattern[i]
+    filename_segment = filename[i]
+    if pattern_segment == "*" or pattern_segment == filename_segment:
+      match.append(filename_segment)
+    else:
+      return None
+  if match:
+    return os.path.sep.join(match)
+  else:
+    return None
+
+def directory_group(filename):
+  for pattern in DIRECTORY_PATTERNS:
+    match = match_directory_group(pattern, filename)
+    if match:
+      return match
+  return os.path.dirname(filename)
+
+class Analysis(object):
+  def __init__(self, filename, line_matches):
+    self.filename = filename;
+    self.line_matches = line_matches
+
+def analyze_lines(filename, lines, func):
+  line_matches = []
+  for i in range(len(lines)):
+    line = lines[i]
+    stripped = line.strip()
+    if stripped.startswith("#"):
+      continue
+    if func(stripped):
+      line_matches.append((i+1, line))
+  if line_matches:
+    return Analysis(filename, line_matches);
+
+def analyze_has_conditional(line):
+  return (line.startswith("ifeq") or line.startswith("ifneq")
+          or line.startswith("ifdef") or line.startswith("ifndef"))
+
+NORMAL_INCLUDES = [re.compile(pattern) for pattern in (
+  "include \$+\(CLEAR_VARS\)", # These are in defines which are tagged separately
+  "include \$+\(BUILD_.*\)",
+  "include \$\(call first-makefiles-under, *\$\(LOCAL_PATH\)\)",
+  "include \$\(call all-subdir-makefiles\)",
+  "include \$\(all-subdir-makefiles\)",
+  "include \$\(call all-makefiles-under, *\$\(LOCAL_PATH\)\)",
+  "include \$\(call all-makefiles-under, *\$\(call my-dir\).*\)",
+  "include \$\(BUILD_SYSTEM\)/base_rules.mk", # called out separately
+  "include \$\(call all-named-subdir-makefiles,.*\)",
+  "include \$\(subdirs\)",
+)]
+def analyze_has_wacky_include(line):
+  if not (line.startswith("include") or line.startswith("-include")
+          or line.startswith("sinclude")):
+    return False
+  for matcher in NORMAL_INCLUDES:
+    if matcher.fullmatch(line):
+      return False
+  return True
+
+BASE_RULES_RE = re.compile("include \$\(BUILD_SYSTEM\)/base_rules.mk")
+
+class Analyzer(object):
+  def __init__(self, title, func):
+    self.title = title;
+    self.func = func
+
+
+ANALYZERS = (
+  Analyzer("ifeq / ifneq", analyze_has_conditional),
+  Analyzer("Wacky Includes", analyze_has_wacky_include),
+  Analyzer("Calls base_rules", lambda line: BASE_RULES_RE.fullmatch(line)),
+  Analyzer("Calls define", lambda line: line.startswith("define ")),
+  Analyzer("Has ../", lambda line: "../" in line),
+  Analyzer("dist-for-&#8203;goals", lambda line: "dist-for-goals" in line),
+  Analyzer(".PHONY", lambda line: ".PHONY" in line),
+  Analyzer("render-&#8203;script", lambda line: ".rscript" in line),
+  Analyzer("vts src", lambda line: ".vts" in line),
+  Analyzer("COPY_&#8203;HEADERS", lambda line: "LOCAL_COPY_HEADERS" in line),
+)
+
+class Summary(object):
+  def __init__(self):
+    self.makefiles = dict()
+    self.directories = dict()
+
+  def Add(self, makefile):
+    self.makefiles[makefile.filename] = makefile
+    self.directories.setdefault(directory_group(makefile.filename), []).append(makefile)
+
+class Makefile(object):
+  def __init__(self, filename):
+    self.filename = filename
+
+    # Analyze the file
+    with open(filename, "r", errors="ignore") as f:
+      try:
+        lines = f.readlines()
+      except UnicodeDecodeError as ex:
+        sys.stderr.write("Filename: %s\n" % filename)
+        raise ex
+    lines = [line.strip() for line in lines]
+
+    self.analyses = dict([(analyzer, analyze_lines(filename, lines, analyzer.func)) for analyzer
+        in ANALYZERS])
+
+def find_android_mk():
+  cwd = os.getcwd()
+  for root, dirs, files in os.walk(cwd):
+    for filename in files:
+      if filename == "Android.mk":
+        yield os.path.join(root, filename)[len(cwd) + 1:]
+    for ignore in (".git", ".repo"):
+      if ignore in dirs:
+        dirs.remove(ignore)
+
+def is_aosp(dirname):
+  for d in ("device/sample", "hardware/interfaces", "hardware/libhardware",
+          "hardware/ril"):
+    if dirname.startswith(d):
+      return True
+  for d in ("device/", "hardware/", "vendor/"):
+    if dirname.startswith(d):
+      return False
+  return True
+
+def is_google(dirname):
+  for d in ("device/google",
+            "hardware/google",
+            "test/sts",
+            "vendor/auto",
+            "vendor/google",
+            "vendor/unbundled_google",
+            "vendor/widevine",
+            "vendor/xts"):
+    if dirname.startswith(d):
+      return True
+  return False
+
+def make_annotation_link(annotations, analysis, modules):
+  if analysis:
+    return "<a href='javascript:update_details(%d)'>%s</a>" % (
+      annotations.Add(analysis, modules),
+      len(analysis)
+    )
+  else:
+    return "";
+
+
+def is_clean(makefile):
+  for analysis in makefile.analyses.values():
+    if analysis:
+      return False
+  return True
+
+class Annotations(object):
+  def __init__(self):
+    self.entries = []
+    self.count = 0
+
+  def Add(self, makefiles, modules):
+    self.entries.append((makefiles, modules))
+    self.count += 1
+    return self.count-1
+
+class SoongData(object):
+  def __init__(self, reader):
+    """Read the input file and store the modules and dependency mappings.
+    """
+    self.problems = dict()
+    self.deps = dict()
+    self.reverse_deps = dict()
+    self.module_types = dict()
+    self.makefiles = dict()
+    self.reverse_makefiles = dict()
+    self.installed = dict()
+    self.modules = set()
+
+    for (module, module_type, problem, dependencies, makefiles, installed) in reader:
+      self.modules.add(module)
+      makefiles = [f for f in makefiles.strip().split(' ') if f != ""]
+      self.module_types[module] = module_type
+      self.problems[module] = problem
+      self.deps[module] = [d for d in dependencies.strip().split(' ') if d != ""]
+      for dep in self.deps[module]:
+        if not dep in self.reverse_deps:
+          self.reverse_deps[dep] = []
+        self.reverse_deps[dep].append(module)
+      self.makefiles[module] = makefiles
+      for f in makefiles:
+        self.reverse_makefiles.setdefault(f, []).append(module)
+      for f in installed.strip().split(' '):
+        self.installed[f] = module
+
+def count_deps(depsdb, module, seen):
+  """Based on the depsdb, count the number of transitive dependencies.
+
+  You can pass in an reversed dependency graph to count the number of
+  modules that depend on the module."""
+  count = 0
+  seen.append(module)
+  if module in depsdb:
+    for dep in depsdb[module]:
+      if dep in seen:
+        continue
+      count += 1 + count_deps(depsdb, dep, seen)
+  return count
+
+def contains_unblocked_modules(soong, modules):
+  for m in modules:
+    if len(soong.deps[m]) == 0:
+      return True
+  return False
+
+def contains_blocked_modules(soong, modules):
+  for m in modules:
+    if len(soong.deps[m]) > 0:
+      return True
+  return False
+
+OTHER_PARTITON = "_other"
+HOST_PARTITON = "_host"
+
+def get_partition_from_installed(HOST_OUT_ROOT, PRODUCT_OUT, filename):
+  host_prefix = HOST_OUT_ROOT + "/"
+  device_prefix = PRODUCT_OUT + "/"
+
+  if filename.startswith(host_prefix):
+    return HOST_PARTITON
+
+  elif filename.startswith(device_prefix):
+    index = filename.find("/", len(device_prefix))
+    if index < 0:
+      return OTHER_PARTITON
+    return filename[len(device_prefix):index]
+
+  return OTHER_PARTITON
+
+def format_module_link(module):
+  return "<a class='ModuleLink' href='#module_%s'>%s</a>" % (module, module)
+
+def format_module_list(modules):
+  return "".join(["<div>%s</div>" % format_module_link(m) for m in modules])
+
+def main():
+  parser = argparse.ArgumentParser(description="Info about remaining Android.mk files.")
+  parser.add_argument("--device", type=str, required=True,
+                      help="TARGET_DEVICE")
+  parser.add_argument("--title", type=str,
+                      help="page title")
+  parser.add_argument("--codesearch", type=str,
+                      default="https://cs.android.com/android/platform/superproject/+/master:",
+                      help="page title")
+  parser.add_argument("--out_dir", type=str,
+                      default=None,
+                      help="Equivalent of $OUT_DIR, which will also be checked if"
+                        + " --out_dir is unset. If neither is set, default is"
+                        + " 'out'.")
+
+  args = parser.parse_args()
+
+  # Guess out directory name
+  if not args.out_dir:
+    args.out_dir = os.getenv("OUT_DIR", "out")
+  while args.out_dir.endswith("/") and len(args.out_dir) > 1:
+    args.out_dir = args.out_dir[:-1]
+
+  TARGET_DEVICE = args.device
+  HOST_OUT_ROOT = args.out_dir + "host"
+  PRODUCT_OUT = args.out_dir + "/target/product/%s" % TARGET_DEVICE
+
+  if args.title:
+    page_title = args.title
+  else:
+    page_title = "Remaining Android.mk files"
+
+  # Read target information
+  # TODO: Pull from configurable location. This is also slightly different because it's
+  # only a single build, where as the tree scanning we do below is all Android.mk files.
+  with open("%s/obj/PACKAGING/soong_conversion_intermediates/soong_conv_data"
+      % PRODUCT_OUT, "r", errors="ignore") as csvfile:
+    soong = SoongData(csv.reader(csvfile))
+
+  # Which modules are installed where
+  modules_by_partition = dict()
+  partitions = set()
+  for installed, module in soong.installed.items():
+    partition = get_partition_from_installed(HOST_OUT_ROOT, PRODUCT_OUT, installed)
+    modules_by_partition.setdefault(partition, []).append(module)
+    partitions.add(partition)
+
+  print("""
+  <html>
+    <head>
+      <title>%(page_title)s</title>
+      <style type="text/css">
+        body, table {
+          font-family: Roboto, sans-serif;
+          font-size: 9pt;
+        }
+        body {
+          margin: 0;
+          padding: 0;
+          display: flex;
+          flex-direction: column;
+          height: 100vh;
+        }
+        #container {
+          flex: 1;
+          display: flex;
+          flex-direction: row;
+          overflow: hidden;
+        }
+        #tables {
+          padding: 0 20px 0 20px;
+          overflow: scroll;
+          flex: 2 2 600px;
+        }
+        #details {
+          display: none;
+          overflow: scroll;
+          flex: 1 1 650px;
+          padding: 0 20px 0 20px;
+        }
+        h1 {
+          margin: 16px 0 16px 20px;
+        }
+        h2 {
+          margin: 12px 0 4px 0;
+        }
+        .DirName {
+          text-align: left;
+          width: 200px;
+          min-width: 200px;
+        }
+        .Count {
+          text-align: center;
+          width: 60px;
+          min-width: 60px;
+          max-width: 60px;
+        }
+        th.Clean,
+        th.Unblocked {
+          background-color: #1e8e3e;
+        }
+        th.Blocked {
+          background-color: #d93025;
+        }
+        th.Warning {
+          background-color: #e8710a;
+        }
+        th {
+          background-color: #1a73e8;
+          color: white;
+          font-weight: bold;
+        }
+        td.Unblocked {
+          background-color: #81c995;
+        }
+        td.Blocked {
+          background-color: #f28b82;
+        }
+        td, th {
+          padding: 2px 4px;
+          border-right: 2px solid white;
+        }
+        tr.AospDir td {
+          background-color: #e6f4ea;
+          border-right-color: #e6f4ea;
+        }
+        tr.GoogleDir td {
+          background-color: #e8f0fe;
+          border-right-color: #e8f0fe;
+        }
+        tr.PartnerDir td {
+          background-color: #fce8e6;
+          border-right-color: #fce8e6;
+        }
+        table {
+          border-spacing: 0;
+          border-collapse: collapse;
+        }
+        div.Makefile {
+          margin: 12px 0 0 0;
+        }
+        div.Makefile:first {
+          margin-top: 0;
+        }
+        div.FileModules {
+          padding: 4px 0 0 20px;
+        }
+        td.LineNo {
+          vertical-align: baseline;
+          padding: 6px 0 0 20px;
+          width: 50px;
+          vertical-align: baseline;
+        }
+        td.LineText {
+          vertical-align: baseline;
+          font-family: monospace;
+          padding: 6px 0 0 0;
+        }
+        a.CsLink {
+          font-family: monospace;
+        }
+        div.Help {
+          width: 550px;
+        }
+        table.HelpColumns tr {
+          border-bottom: 2px solid white;
+        }
+        .ModuleName {
+          vertical-align: baseline;
+          padding: 6px 0 0 20px;
+          width: 275px;
+        }
+        .ModuleDeps {
+          vertical-align: baseline;
+          padding: 6px 0 0 0;
+        }
+        table#Modules td {
+          vertical-align: baseline;
+        }
+        tr.Alt {
+          background-color: #ececec;
+        }
+        tr.Alt td {
+          border-right-color: #ececec;
+        }
+        .AnalysisCol {
+          width: 300px;
+          padding: 2px;
+          line-height: 21px;
+        }
+        .Analysis {
+          color: white;
+          font-weight: bold;
+          background-color: #e8710a;
+          border-radius: 6px;
+          margin: 4px;
+          padding: 2px 6px;
+          white-space: nowrap;
+        }
+        .Nav {
+          margin: 4px 0 16px 20px;
+        }
+        .NavSpacer {
+          display: inline-block;
+          width: 6px;
+        }
+        .ModuleDetails {
+          margin-top: 20px;
+        }
+        .ModuleDetails td {
+          vertical-align: baseline;
+        }
+      </style>
+    </head>
+    <body>
+      <h1>%(page_title)s</h1>
+      <div class="Nav">
+        <a href='#help'>Help</a>
+        <span class='NavSpacer'></span><span class='NavSpacer'> </span>
+        Partitions:
+  """ % {
+    "page_title": page_title,
+  })
+  for partition in sorted(partitions):
+    print("<a href='#partition_%s'>%s</a><span class='NavSpacer'></span>" % (partition, partition))
+
+  print("""
+        <span class='NavSpacer'></span><span class='NavSpacer'> </span>
+      </div>
+      <div id="container">
+        <div id="tables">
+        <a name="help"></a>
+        <div class="Help">
+          <p>
+          This page analyzes the remaining Android.mk files in the Android Source tree.
+          <p>
+          The modules are first broken down by which of the device filesystem partitions
+          they are installed to. This also includes host tools and testcases which don't
+          actually reside in their own partition but convenitely group together.
+          <p>
+          The makefiles for each partition are further are grouped into a set of directories
+          aritrarily picked to break down the problem size by owners.
+          <ul style="width: 300px">
+            <li style="background-color: #e6f4ea">AOSP directories are colored green.</li>
+            <li style="background-color: #e8f0fe">Google directories are colored blue.</li>
+            <li style="background-color: #fce8e6">Other partner directories are colored red.</li>
+          </ul>
+          Each of the makefiles are scanned for issues that are likely to come up during
+          conversion to soong.  Clicking the number in each cell shows additional information,
+          including the line that triggered the warning.
+          <p>
+          <table class="HelpColumns">
+            <tr>
+              <th>Total</th>
+              <td>The total number of makefiles in this each directory.</td>
+            </tr>
+            <tr>
+              <th class="Unblocked">Unblocked</th>
+              <td>Makefiles containing one or more modules that don't have any
+                  additional dependencies pending before conversion.</td>
+            </tr>
+            <tr>
+              <th class="Blocked">Blocked</th>
+              <td>Makefiles containiong one or more modules which <i>do</i> have
+                  additional prerequesite depenedencies that are not yet converted.</td>
+            </tr>
+            <tr>
+              <th class="Clean">Clean</th>
+              <td>The number of makefiles that have none of the following warnings.</td>
+            </tr>
+            <tr>
+              <th class="Warning">ifeq / ifneq</th>
+              <td>Makefiles that use <code>ifeq</code> or <code>ifneq</code>. i.e.
+              conditionals.</td>
+            </tr>
+            <tr>
+              <th class="Warning">Wacky Includes</th>
+              <td>Makefiles that <code>include</code> files other than the standard build-system
+                  defined template and macros.</td>
+            </tr>
+            <tr>
+              <th class="Warning">Calls base_rules</th>
+              <td>Makefiles that include base_rules.mk directly.</td>
+            </tr>
+            <tr>
+              <th class="Warning">Calls define</th>
+              <td>Makefiles that define their own macros. Some of these are easy to convert
+                  to soong <code>defaults</code>, but others are complex.</td>
+            </tr>
+            <tr>
+              <th class="Warning">Has ../</th>
+              <td>Makefiles containing the string "../" outside of a comment. These likely
+                  access files outside their directories.</td>
+            </tr>
+            <tr>
+              <th class="Warning">dist-for-goals</th>
+              <td>Makefiles that call <code>dist-for-goals</code> directly.</td>
+            </tr>
+            <tr>
+              <th class="Warning">.PHONY</th>
+              <td>Makefiles that declare .PHONY targets.</td>
+            </tr>
+            <tr>
+              <th class="Warning">renderscript</th>
+              <td>Makefiles defining targets that depend on <code>.rscript</code> source files.</td>
+            </tr>
+            <tr>
+              <th class="Warning">vts src</th>
+              <td>Makefiles defining targets that depend on <code>.vts</code> source files.</td>
+            </tr>
+            <tr>
+              <th class="Warning">COPY_HEADERS</th>
+              <td>Makefiles using LOCAL_COPY_HEADERS.</td>
+            </tr>
+          </table>
+          <p>
+          Following the list of directories is a list of the modules that are installed on
+          each partition. Potential issues from their makefiles are listed, as well as the
+          total number of dependencies (both blocking that module and blocked by that module)
+          and the list of direct dependencies.  Note: The number is the number of all transitive
+          dependencies and the list of modules is only the direct dependencies.
+        </div>
+  """)
+
+  annotations = Annotations()
+
+  # For each partition
+  makefiles_for_partitions = dict()
+  for partition in sorted(partitions):
+    modules = modules_by_partition[partition]
+
+    makefiles = set(itertools.chain.from_iterable(
+        [soong.makefiles[module] for module in modules]))
+
+    # Read makefiles
+    summary = Summary()
+    for filename in makefiles:
+      if not filename.startswith(args.out_dir + "/"):
+        summary.Add(Makefile(filename))
+
+    # Categorize directories by who is responsible
+    aosp_dirs = []
+    google_dirs = []
+    partner_dirs = []
+    for dirname in sorted(summary.directories.keys()):
+      if is_aosp(dirname):
+        aosp_dirs.append(dirname)
+      elif is_google(dirname):
+        google_dirs.append(dirname)
+      else:
+        partner_dirs.append(dirname)
+
+    print("""
+      <a name="partition_%(partition)s"></a>
+      <h2>%(partition)s</h2>
+      <table>
+        <tr>
+          <th class="DirName">Directory</th>
+          <th class="Count">Total</th>
+          <th class="Count Unblocked">Unblocked</th>
+          <th class="Count Blocked">Blocked</th>
+          <th class="Count Clean">Clean</th>
+    """ % {
+      "partition": partition
+    })
+
+    for analyzer in ANALYZERS:
+      print("""<th class="Count Warning">%s</th>""" % analyzer.title)
+
+    print("      </tr>")
+    for dirgroup, rowclass in [(aosp_dirs, "AospDir"),
+                               (google_dirs, "GoogleDir"),
+                               (partner_dirs, "PartnerDir"),]:
+      for dirname in dirgroup:
+        makefiles = summary.directories[dirname]
+
+        all_makefiles = [Analysis(makefile.filename, []) for makefile in makefiles]
+        clean_makefiles = [Analysis(makefile.filename, []) for makefile in makefiles
+            if is_clean(makefile)]
+        unblocked_makefiles = [Analysis(makefile.filename, []) for makefile in makefiles
+            if contains_unblocked_modules(soong,
+              soong.reverse_makefiles[makefile.filename])]
+        blocked_makefiles = [Analysis(makefile.filename, []) for makefile in makefiles
+            if contains_blocked_modules(soong,
+              soong.reverse_makefiles[makefile.filename])]
+
+        print("""
+          <tr class="%(rowclass)s">
+            <td class="DirName">%(dirname)s</td>
+            <td class="Count">%(makefiles)s</td>
+            <td class="Count">%(unblocked)s</td>
+            <td class="Count">%(blocked)s</td>
+            <td class="Count">%(clean)s</td>
+        """ % {
+          "rowclass": rowclass,
+          "dirname": dirname,
+          "makefiles": make_annotation_link(annotations, all_makefiles, modules),
+          "unblocked": make_annotation_link(annotations, unblocked_makefiles, modules),
+          "blocked": make_annotation_link(annotations, blocked_makefiles, modules),
+          "clean": make_annotation_link(annotations, clean_makefiles, modules),
+        })
+        for analyzer in ANALYZERS:
+          analyses = [m.analyses.get(analyzer) for m in makefiles if m.analyses.get(analyzer)]
+          print("""<td class="Count">%s</td>"""
+              % make_annotation_link(annotations, analyses, modules))
+
+        print("      </tr>")
+    print("""
+      </table>
+    """)
+
+    module_details = [(count_deps(soong.deps, m, []), -count_deps(soong.reverse_deps, m, []), m)
+               for m in modules]
+    module_details.sort()
+    module_details = [m[2] for m in module_details]
+    print("""
+      <table class="ModuleDetails">""")
+    print("<tr>")
+    print("  <th>Module Name</th>")
+    print("  <th>Issues</th>")
+    print("  <th colspan='2'>Blocked By</th>")
+    print("  <th colspan='2'>Blocking</th>")
+    print("</tr>")
+    altRow = True
+    for module in module_details:
+      analyses = set()
+      for filename in soong.makefiles[module]:
+        makefile = summary.makefiles.get(filename)
+        if makefile:
+          for analyzer, analysis in makefile.analyses.items():
+            if analysis:
+              analyses.add(analyzer.title)
+
+      altRow = not altRow
+      print("<tr class='%s'>" % ("Alt" if altRow else "",))
+      print("  <td><a name='module_%s'></a>%s</td>" % (module, module))
+      print("  <td class='AnalysisCol'>%s</td>" % " ".join(["<span class='Analysis'>%s</span>" % title
+          for title in analyses]))
+      print("  <td>%s</td>" % count_deps(soong.deps, module, []))
+      print("  <td>%s</td>" % format_module_list(soong.deps.get(module, [])))
+      print("  <td>%s</td>" % count_deps(soong.reverse_deps, module, []))
+      print("  <td>%s</td>" % format_module_list(soong.reverse_deps.get(module, [])))
+      print("</tr>")
+    print("""</table>""")
+
+  print("""
+    <script type="text/javascript">
+    function close_details() {
+      document.getElementById('details').style.display = 'none';
+    }
+
+    class LineMatch {
+      constructor(lineno, text) {
+        this.lineno = lineno;
+        this.text = text;
+      }
+    }
+
+    class Analysis {
+      constructor(filename, modules, line_matches) {
+        this.filename = filename;
+        this.modules = modules;
+        this.line_matches = line_matches;
+      }
+    }
+
+    class Module {
+      constructor(deps) {
+        this.deps = deps;
+      }
+    }
+
+    function make_module_link(module) {
+      var a = document.createElement('a');
+      a.className = 'ModuleLink';
+      a.innerText = module;
+      a.href = '#module_' + module;
+      return a;
+    }
+
+    function update_details(id) {
+      document.getElementById('details').style.display = 'block';
+
+      var analyses = ANALYSIS[id];
+
+      var details = document.getElementById("details_data");
+      while (details.firstChild) {
+          details.removeChild(details.firstChild);
+      }
+
+      for (var i=0; i<analyses.length; i++) {
+        var analysis = analyses[i];
+
+        var makefileDiv = document.createElement('div');
+        makefileDiv.className = 'Makefile';
+        details.appendChild(makefileDiv);
+
+        var fileA = document.createElement('a');
+        makefileDiv.appendChild(fileA);
+        fileA.className = 'CsLink';
+        fileA.href = '%(codesearch)s' + analysis.filename;
+        fileA.innerText = analysis.filename;
+        fileA.target = "_blank";
+
+        if (analysis.modules.length > 0) {
+          var moduleTable = document.createElement('table');
+          details.appendChild(moduleTable);
+
+          for (var j=0; j<analysis.modules.length; j++) {
+            var moduleRow = document.createElement('tr');
+            moduleTable.appendChild(moduleRow);
+
+            var moduleNameCell = document.createElement('td');
+            moduleRow.appendChild(moduleNameCell);
+            moduleNameCell.className = 'ModuleName';
+            moduleNameCell.appendChild(make_module_link(analysis.modules[j]));
+
+            var moduleData = MODULE_DATA[analysis.modules[j]];
+            console.log(moduleData);
+
+            var depCell = document.createElement('td');
+            moduleRow.appendChild(depCell);
+
+            if (moduleData.deps.length == 0) {
+              depCell.className = 'ModuleDeps Unblocked';
+              depCell.innerText = 'UNBLOCKED';
+            } else {
+              depCell.className = 'ModuleDeps Blocked';
+
+              for (var k=0; k<moduleData.deps.length; k++) {
+                depCell.appendChild(make_module_link(moduleData.deps[k]));
+                depCell.appendChild(document.createElement('br'));
+              }
+            }
+          }
+        }
+
+        if (analysis.line_matches.length > 0) {
+          var lineTable = document.createElement('table');
+          details.appendChild(lineTable);
+
+          for (var j=0; j<analysis.line_matches.length; j++) {
+            var line_match = analysis.line_matches[j];
+
+            var lineRow = document.createElement('tr');
+            lineTable.appendChild(lineRow);
+
+            var linenoCell = document.createElement('td');
+            lineRow.appendChild(linenoCell);
+            linenoCell.className = 'LineNo';
+
+            var linenoA = document.createElement('a');
+            linenoCell.appendChild(linenoA);
+            linenoA.className = 'CsLink';
+            linenoA.href = '%(codesearch)s' + analysis.filename
+                + ';l=' + line_match.lineno;
+            linenoA.innerText = line_match.lineno;
+            linenoA.target = "_blank";
+
+            var textCell = document.createElement('td');
+            lineRow.appendChild(textCell);
+            textCell.className = 'LineText';
+            textCell.innerText = line_match.text;
+          }
+        }
+      }
+    }
+
+    var ANALYSIS = [
+    """ % {
+        "codesearch": args.codesearch,
+    })
+  for entry, mods in annotations.entries:
+    print("  [")
+    for analysis in entry:
+      print("    new Analysis('%(filename)s', %(modules)s, [%(line_matches)s])," % {
+        "filename": analysis.filename,
+        #"modules": json.dumps([m for m in mods if m in filename in soong.makefiles[m]]),
+        "modules": json.dumps(
+            [m for m in soong.reverse_makefiles[analysis.filename] if m in mods]),
+        "line_matches": ", ".join([
+            "new LineMatch(%d, %s)" % (lineno, json.dumps(text))
+            for lineno, text in analysis.line_matches]),
+      })
+    print("  ],")
+  print("""
+    ];
+    var MODULE_DATA = {
+  """)
+  for module in soong.modules:
+    print("      '%(name)s': new Module(%(deps)s)," % {
+      "name": module,
+      "deps": json.dumps(soong.deps[module]),
+    })
+  print("""
+    };
+    </script>
+
+  """)
+
+  print("""
+      </div> <!-- id=tables -->
+      <div id="details">
+        <div style="text-align: right;">
+          <a href="javascript:close_details();">
+            <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
+          </a>
+        </div>
+        <div id="details_data"></div>
+      </div>
+    </body>
+  </html>
+  """)
+
+if __name__ == "__main__":
+  main()
+
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 284c89a..a1f8e31 100644
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -296,6 +296,21 @@
       block_list=block_list)
   return img.name
 
+def AddOdmDlkm(output_zip):
+  """Turn the contents of OdmDlkm into an odm_dlkm image and store it in output_zip."""
+
+  img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "odm_dlkm.img")
+  if os.path.exists(img.name):
+    logger.info("odm_dlkm.img already exists; no need to rebuild...")
+    return img.name
+
+  block_list = OutputFile(
+      output_zip, OPTIONS.input_tmp, "IMAGES", "odm_dlkm.map")
+  CreateImage(
+      OPTIONS.input_tmp, OPTIONS.info_dict, "odm_dlkm", img,
+      block_list=block_list)
+  return img.name
+
 
 def AddDtbo(output_zip):
   """Adds the DTBO image.
@@ -752,8 +767,9 @@
   has_boot = OPTIONS.info_dict.get("no_boot") != "true"
   has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true"
 
-  # {vendor,odm,product,system_ext,vendor_dlkm}.img are unlike system.img or
-  # system_other.img. Because it could be built from source, or dropped into
+  # {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm}.img
+  # are unlike system.img or
+  # system_other.img, because it could be built from source, or  dropped into
   # target_files.zip as a prebuilt blob. We consider either of them as
   # {vendor,product,system_ext}.img being available, which could be
   # used when generating vbmeta.img for AVB.
@@ -772,6 +788,12 @@
                      os.path.exists(
                          os.path.join(OPTIONS.input_tmp, "IMAGES",
                                       "vendor_dlkm.img")))
+  has_odm_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp,
+                                              "ODM_DLKM")) and
+                   OPTIONS.info_dict.get("building_odm_dlkm_image")
+                   == "true") or
+                  os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
+                                              "odm_dlkm.img")))
   has_product = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) and
                   OPTIONS.info_dict.get("building_product_image") == "true") or
                  os.path.exists(
@@ -901,6 +923,10 @@
     banner("vendor_dlkm")
     partitions['vendor_dlkm'] = AddVendorDlkm(output_zip)
 
+  if has_odm_dlkm:
+    banner("odm_dlkm")
+    partitions['odm_dlkm'] = AddOdmDlkm(output_zip)
+
   if has_system_other:
     banner("system_other")
     AddSystemOther(output_zip)
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 1c61938..afebc40 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -273,7 +273,7 @@
     else:
       payload_info[key] = value
 
-  # Sanity check.
+  # Validation check.
   for key in ('Algorithm', 'Salt', 'apex.key', 'Hash Algorithm'):
     if key not in payload_info:
       raise ApexInfoError(
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 8b6a690..d33c2f7 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -521,7 +521,7 @@
         stashed_blocks -= free_size
 
       if common.OPTIONS.cache_size is not None:
-        # Sanity check: abort if we're going to need more stash space than
+        # Validation check: abort if we're going to need more stash space than
         # the allowed size (cache_size * threshold). There are two purposes
         # of having a threshold here. a) Part of the cache may have been
         # occupied by some recovery logs. b) It will buy us some time to deal
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index dbfb485..9cc072f 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -731,6 +731,29 @@
       d["extfs_rsv_pct"] = "0"
     copy_prop("vendor_dlkm_reserved_size", "partition_reserved_size")
     copy_prop("vendor_dlkm_selinux_fc", "selinux_fc")
+  elif mount_point == "odm_dlkm":
+    copy_prop("avb_odm_dlkm_hashtree_enable", "avb_hashtree_enable")
+    copy_prop("avb_odm_dlkm_add_hashtree_footer_args",
+              "avb_add_hashtree_footer_args")
+    copy_prop("avb_odm_dlkm_key_path", "avb_key_path")
+    copy_prop("avb_odm_dlkm_algorithm", "avb_algorithm")
+    copy_prop("avb_odm_dlkm_salt", "avb_salt")
+    copy_prop("odm_dlkm_fs_type", "fs_type")
+    copy_prop("odm_dlkm_size", "partition_size")
+    if not copy_prop("odm_dlkm_journal_size", "journal_size"):
+      d["journal_size"] = "0"
+    copy_prop("odm_dlkm_verity_block_device", "verity_block_device")
+    copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks")
+    copy_prop("odm_dlkm_squashfs_compressor", "squashfs_compressor")
+    copy_prop("odm_dlkm_squashfs_compressor_opt", "squashfs_compressor_opt")
+    copy_prop("odm_dlkm_squashfs_block_size", "squashfs_block_size")
+    copy_prop("odm_dlkm_squashfs_disable_4k_align", "squashfs_disable_4k_align")
+    copy_prop("odm_dlkm_base_fs_file", "base_fs_file")
+    copy_prop("odm_dlkm_extfs_inode_count", "extfs_inode_count")
+    if not copy_prop("odm_dlkm_extfs_rsv_pct", "extfs_rsv_pct"):
+      d["extfs_rsv_pct"] = "0"
+    copy_prop("odm_dlkm_reserved_size", "partition_reserved_size")
+    copy_prop("odm_dlkm_selinux_fc", "selinux_fc")
   elif mount_point == "oem":
     copy_prop("fs_type", "fs_type")
     copy_prop("oem_size", "partition_size")
@@ -777,6 +800,8 @@
     copy_prop("partition_size", "odm_size")
   elif mount_point == "vendor_dlkm":
     copy_prop("partition_size", "vendor_dlkm_size")
+  elif mount_point == "odm_dlkm":
+    copy_prop("partition_size", "odm_dlkm_size")
   elif mount_point == "product":
     copy_prop("partition_size", "product_size")
   elif mount_point == "system_ext":
@@ -818,6 +843,8 @@
       mount_point = "odm"
     elif image_filename == "vendor_dlkm.img":
       mount_point = "vendor_dlkm"
+    elif image_filename == "odm_dlkm.img":
+      mount_point = "odm_dlkm"
     elif image_filename == "oem.img":
       mount_point = "oem"
     elif image_filename == "product.img":
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index 79005df..ef66112 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -46,7 +46,7 @@
     '/product': ('PRODUCT', 'SYSTEM/product'),
     '/odm': ('ODM', 'VENDOR/odm', 'SYSTEM/vendor/odm'),
     '/system_ext': ('SYSTEM_EXT', 'SYSTEM/system_ext'),
-    # vendor_dlkm does not have VINTF files.
+    # vendor_dlkm and odm_dlkm does not have VINTF files.
 }
 
 UNZIP_PATTERN = ['META/*', '*/build.prop']
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a26f9e4..9ac2cc6 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -110,7 +110,8 @@
 # that system_other is not in the list because we don't want to include its
 # descriptor into vbmeta.img.
 AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'recovery', 'system',
-                  'system_ext', 'vendor', 'vendor_boot', 'vendor_dlkm')
+                  'system_ext', 'vendor', 'vendor_boot', 'vendor_dlkm',
+                  'odm_dlkm')
 
 # Chained VBMeta partitions.
 AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor')
@@ -123,6 +124,7 @@
     'system_ext',
     'odm',
     'vendor_dlkm',
+    'odm_dlkm',
 )
 
 
@@ -599,7 +601,7 @@
 def LoadInfoDict(input_file, repacking=False):
   """Loads the key/value pairs from the given input target_files.
 
-  It reads `META/misc_info.txt` file in the target_files input, does sanity
+  It reads `META/misc_info.txt` file in the target_files input, does validation
   checks and returns the parsed key/value pairs for to the given build. It's
   usually called early when working on input target_files files, e.g. when
   generating OTAs, or signing builds. Note that the function may be called
@@ -663,7 +665,7 @@
 
     # Redirect {partition}_base_fs_file for each of the named partitions.
     for part_name in ["system", "vendor", "system_ext", "product", "odm",
-                      "vendor_dlkm"]:
+                      "vendor_dlkm", "odm_dlkm"]:
       key_name = part_name + "_base_fs_file"
       if key_name not in d:
         continue
@@ -1175,7 +1177,7 @@
   if args and args.strip():
     split_args = shlex.split(args)
     for index, arg in enumerate(split_args[:-1]):
-      # Sanity check that the image file exists. Some images might be defined
+      # Check that the image file exists. Some images might be defined
       # as a path relative to source tree, which may not be available at the
       # same location when running this script (we have the input target_files
       # zip only). For such cases, we additionally scan other locations (e.g.
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index b9c9b19..033c02e 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -301,7 +301,7 @@
             len(patchpairs) == 2), \
         "Failed to handle unknown format. Use PatchPartition() instead."
 
-    # Also sanity check the args.
+    # Also validity check the args.
     assert tokens[3] == patchpairs[0], \
         "Found mismatching values for source SHA-1: {} vs {}".format(
             tokens[3], patchpairs[0])
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index ad991ca..45532f5 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -198,6 +198,7 @@
     'RADIO/*',
     'VENDOR/*',
     'VENDOR_DLKM/*',
+    'ODM_DLKM/*',
 )
 
 # VENDOR_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the
@@ -225,6 +226,7 @@
     'SYSTEM_OTHER/',
     'VENDOR/',
     'VENDOR_DLKM/',
+    'ODM_DLKM/',
 )
 
 
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index f114f63..b70044e 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -278,15 +278,15 @@
 # Files to be unzipped for target diffing purpose.
 TARGET_DIFFING_UNZIP_PATTERN = ['BOOT', 'RECOVERY', 'SYSTEM/*', 'VENDOR/*',
                                 'PRODUCT/*', 'SYSTEM_EXT/*', 'ODM/*',
-                                'VENDOR_DLKM/*']
+                                'VENDOR_DLKM/*', 'ODM_DLKM/*']
 RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS]
 
 # Images to be excluded from secondary payload. We essentially only keep
 # 'system_other' and bootloader partitions.
 SECONDARY_PAYLOAD_SKIPPED_IMAGES = [
-    'boot', 'dtbo', 'modem', 'odm', 'product', 'radio', 'recovery',
+    'boot', 'dtbo', 'modem', 'odm', 'odm_dlkm', 'product', 'radio', 'recovery',
     'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor',
-    'vendor_boot', 'vendor_dlkm']
+    'vendor_boot']
 
 
 class PayloadSigner(object):
@@ -670,7 +670,7 @@
 
   block_diff_dict = collections.OrderedDict()
   partition_names = ["system", "vendor", "product", "odm", "system_ext",
-                     "vendor_dlkm"]
+                     "vendor_dlkm", "odm_dlkm"]
   for partition in partition_names:
     if not HasPartition(target_zip, partition):
       continue
@@ -1940,7 +1940,7 @@
 
 def GenerateNonAbOtaPackage(target_file, output_file, source_file=None):
   """Generates a non-A/B OTA package."""
-  # Sanity check the loaded info dicts first.
+  # Check the loaded info dicts first.
   if OPTIONS.info_dict.get("no_recovery") == "true":
     raise common.ExternalError(
         "--- target build has specified no recovery ---")
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 5d10c40..b4646b7 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -1116,7 +1116,7 @@
               privkey.endswith(privkey_suffix) and
               pubkey[:-pubkey_suffix_len] == privkey[:-privkey_suffix_len])
 
-    # Sanity check on the container key names, as we'll carry them without the
+    # Check the container key names, as we'll carry them without the
     # extensions. This doesn't apply to payload keys though, which we will use
     # full names only.
     container_cert = matches.group("CONTAINER_CERT")
@@ -1149,7 +1149,7 @@
       apex_name, key = a.split("=")
       OPTIONS.extra_apex_payload_keys[apex_name] = key
     elif o == "--skip_apks_with_path_prefix":
-      # Sanity check the prefix, which must be in all upper case.
+      # 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,))
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index c82a40b..efa60b6 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -370,7 +370,7 @@
     with zipfile.ZipFile(output_file, 'w') as output_zip:
       # Create an existing META/care_map.pb entry.
       common.ZipWriteStr(output_zip, 'META/care_map.pb',
-                         'dummy care_map.pb')
+                         'fake care_map.pb')
 
       # Request to add META/care_map.pb again.
       AddCareMapForAbOta(output_zip, ['system', 'vendor'], image_paths)
diff --git a/tools/releasetools/test_check_target_files_vintf.py b/tools/releasetools/test_check_target_files_vintf.py
index d326229..8725dd6 100644
--- a/tools/releasetools/test_check_target_files_vintf.py
+++ b/tools/releasetools/test_check_target_files_vintf.py
@@ -87,8 +87,8 @@
     return test_dir
 
   @test_utils.SkipIfExternalToolsUnavailable()
-  def test_CheckVintf_sanity(self):
-    msg = 'Sanity check with skeleton target files failed.'
+  def test_CheckVintf_skeleton(self):
+    msg = 'vintf check with skeleton target files failed.'
     test_dir = self.prepare_test_dir('does-not-exist')
     self.assertTrue(CheckVintf(test_dir), msg=msg)
 
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 787e675..81ee53d 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -1619,12 +1619,12 @@
 
   def setUp(self):
     self._tempdir = common.MakeTempDir()
-    # Create a dummy dict that contains the fstab info for boot&recovery.
+    # Create a fake dict that contains the fstab info for boot&recovery.
     self._info = {"fstab" : {}}
-    dummy_fstab = [
+    fake_fstab = [
         "/dev/soc.0/by-name/boot /boot emmc defaults defaults",
         "/dev/soc.0/by-name/recovery /recovery emmc defaults defaults"]
-    self._info["fstab"] = common.LoadRecoveryFSTab("\n".join, 2, dummy_fstab)
+    self._info["fstab"] = common.LoadRecoveryFSTab("\n".join, 2, fake_fstab)
     # Construct the gzipped recovery.img and boot.img
     self.recovery_data = bytearray([
         0x1f, 0x8b, 0x08, 0x00, 0x81, 0x11, 0x02, 0x5a, 0x00, 0x03, 0x2b, 0x4a,
diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py
index 7783f96..07b2e05 100644
--- a/tools/releasetools/test_ota_from_target_files.py
+++ b/tools/releasetools/test_ota_from_target_files.py
@@ -61,7 +61,7 @@
         'META/ab_partitions.txt',
         '\n'.join([partition[1] for partition in ab_partitions]))
 
-    # Create dummy images for each of them.
+    # Create fake images for each of them.
     for path, partition in ab_partitions:
       target_files_zip.writestr(
           '{}/{}.img'.format(path, partition),
@@ -754,7 +754,7 @@
 
 
 class StreamingPropertyFilesTest(PropertyFilesTest):
-  """Additional sanity checks specialized for StreamingPropertyFiles."""
+  """Additional validity checks specialized for StreamingPropertyFiles."""
 
   def test_init(self):
     property_files = StreamingPropertyFiles()
@@ -835,7 +835,7 @@
 
 
 class AbOtaPropertyFilesTest(PropertyFilesTest):
-  """Additional sanity checks specialized for AbOtaPropertyFiles."""
+  """Additional validity checks specialized for AbOtaPropertyFiles."""
 
   # The size for payload and metadata signature size.
   SIGNATURE_SIZE = 256
@@ -1003,7 +1003,7 @@
 
 
 class NonAbOtaPropertyFilesTest(PropertyFilesTest):
-  """Additional sanity checks specialized for NonAbOtaPropertyFiles."""
+  """Additional validity checks specialized for NonAbOtaPropertyFiles."""
 
   def test_init(self):
     property_files = NonAbOtaPropertyFiles()
diff --git a/tools/releasetools/test_verity_utils.py b/tools/releasetools/test_verity_utils.py
index d02bc7f..a850390 100644
--- a/tools/releasetools/test_verity_utils.py
+++ b/tools/releasetools/test_verity_utils.py
@@ -233,8 +233,8 @@
         os.path.join(get_testdata_dir(), 'testkey_mincrypt'))
 
   @SkipIfExternalToolsUnavailable()
-  def test_Build_SanityCheck(self):
-    # A sanity check for the test itself: the image shouldn't be verifiable
+  def test_Build_ValidationCheck(self):
+    # A validity check for the test itself: the image shouldn't be verifiable
     # with wrong key.
     self.assertRaises(
         common.ExternalError,
diff --git a/tools/releasetools/testdata/apexkeys_framework.txt b/tools/releasetools/testdata/apexkeys_framework.txt
index b9caf9e..a827f22 100644
--- a/tools/releasetools/testdata/apexkeys_framework.txt
+++ b/tools/releasetools/testdata/apexkeys_framework.txt
@@ -1,5 +1,5 @@
 name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8" partition="system"
-name="com.android.dummy_product.apex" public_key="selected" private_key="selected" container_certificate="selected" container_private_key="selected" partition="product"
+name="com.android.fake_product.apex" public_key="selected" private_key="selected" container_certificate="selected" container_private_key="selected" partition="product"
 name="com.android.runtime.apex" public_key="bionic/apex/com.android.runtime.avbpubkey" private_key="bionic/apex/com.android.runtime.pem" container_certificate="bionic/apex/com.android.runtime.x509.pem" container_private_key="bionic/apex/com.android.runtime.pk8" partition="system"
 name="com.android.vndk.current.on_vendor.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="vendor"
 name="com.android.vndk.v27.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v27.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v27.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v27.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v27.pk8" partition="system_ext"
diff --git a/tools/releasetools/testdata/apexkeys_merge.txt b/tools/releasetools/testdata/apexkeys_merge.txt
index a9355d7..5b1b544 100644
--- a/tools/releasetools/testdata/apexkeys_merge.txt
+++ b/tools/releasetools/testdata/apexkeys_merge.txt
@@ -1,5 +1,5 @@
 name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8" partition="system"
-name="com.android.dummy_product.apex" public_key="selected" private_key="selected" container_certificate="selected" container_private_key="selected" partition="product"
+name="com.android.fake_product.apex" public_key="selected" private_key="selected" container_certificate="selected" container_private_key="selected" partition="product"
 name="com.android.runtime.apex" public_key="bionic/apex/com.android.runtime.avbpubkey" private_key="bionic/apex/com.android.runtime.pem" container_certificate="bionic/apex/com.android.runtime.x509.pem" container_private_key="bionic/apex/com.android.runtime.pk8" partition="system"
 name="com.android.vndk.current.on_vendor.apex" public_key="packages/modules/vndk/apex/com.android.vndk.current.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.current.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.current.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.current.pk8" partition="vendor"
 name="com.android.vndk.v27.apex" public_key="packages/modules/vndk/apex/com.android.vndk.v27.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.v27.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.v27.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.v27.pk8" partition="system_ext"
diff --git a/tools/releasetools/testdata/apexkeys_vendor.txt b/tools/releasetools/testdata/apexkeys_vendor.txt
index 7dd3964..c6a9771 100644
--- a/tools/releasetools/testdata/apexkeys_vendor.txt
+++ b/tools/releasetools/testdata/apexkeys_vendor.txt
@@ -1,5 +1,5 @@
 name="com.android.conscrypt.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system"
-name="com.android.dummy_product.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="product"
+name="com.android.fake_product.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="product"
 name="com.android.runtime.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system"
 name="com.android.vndk.current.on_vendor.apex" public_key="packages/modules/vndk/apex/com.android.vndk.current.pubkey" private_key="packages/modules/vndk/apex/com.android.vndk.current.pem" container_certificate="packages/modules/vndk/apex/com.android.vndk.current.x509.pem" container_private_key="packages/modules/vndk/apex/com.android.vndk.current.pk8" partition="vendor"
 name="com.android.vndk.v27.apex" public_key="not_selected" private_key="not_selected" container_certificate="not_selected" container_private_key="not_selected" partition="system_ext"
diff --git a/tools/soong_to_convert.py b/tools/soong_to_convert.py
index 083f6f7..949131b 100755
--- a/tools/soong_to_convert.py
+++ b/tools/soong_to_convert.py
@@ -78,7 +78,7 @@
     reverse_deps = dict()
     module_types = dict()
 
-    for (module, module_type, problem, dependencies) in reader:
+    for (module, module_type, problem, dependencies, makefiles, installed) in reader:
         module_types[module] = module_type
         problems[module] = problem
         deps[module] = [d for d in dependencies.strip().split(' ') if d != ""]