Merge "Go one directory up looking for releasetools path"
diff --git a/Changes.md b/Changes.md
index 5a0fd23..04e0161 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,23 @@
 # Build System Changes for Android.mk Writers
 
+## Rules executed within limited environment
+
+With `ALLOW_NINJA_ENV=false` (soon to be the default), ninja, and all the
+rules/actions executed within it will only have access to a limited number of
+environment variables. Ninja does not track when environment variables change
+in order to trigger rebuilds, so changing behavior based on arbitrary variables
+is not safe with incremental builds.
+
+Kati and Soong can safely use environment variables, so the expectation is that
+you'd embed any environment variables that you need to use within the command
+line generated by those tools. See the [export section](#export_keyword) below
+for examples.
+
+For a temporary workaround, you can set `ALLOW_NINJA_ENV=true` in your
+environment to restore the previous behavior, or set
+`BUILD_BROKEN_NINJA_USES_ENV_VAR := <var> <var2> ...` in your `BoardConfig.mk`
+to allow specific variables to be passed through until you've fixed the rules.
+
 ## LOCAL_C_INCLUDES outside the source/output trees are an error {#BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS}
 
 Include directories are expected to be within the source tree (or in the output
@@ -31,7 +49,7 @@
 offending line.
 
 
-# `BOARD_HAL_STATIC_LIBRARIES` and `LOCAL_HAL_STATIC_LIBRARIES` are obsolete {#BOARD_HAL_STATIC_LIBRARIES}
+## `BOARD_HAL_STATIC_LIBRARIES` and `LOCAL_HAL_STATIC_LIBRARIES` are obsolete {#BOARD_HAL_STATIC_LIBRARIES}
 
 Define proper HIDL / Stable AIDL HAL instead.
 
diff --git a/core/Makefile b/core/Makefile
index c650022..67d5d3f 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3778,6 +3778,7 @@
   simg2img \
   sload_f2fs \
   tune2fs \
+  unpack_bootimg \
   update_host_simulator \
   validate_target_files \
   verity_signer \
diff --git a/core/board_config.mk b/core/board_config.mk
index 00ac0be..b9b4dc2 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -98,7 +98,8 @@
     BUILD_BROKEN_USES_$(m))
 
 _board_true_false_vars := $(_build_broken_var_list)
-_board_strip_readonly_list += $(_build_broken_var_list)
+_board_strip_readonly_list += $(_build_broken_var_list) \
+  BUILD_BROKEN_NINJA_USES_ENV_VARS
 
 # Conditional to building on linux, as dex2oat currently does not work on darwin.
 ifeq ($(HOST_OS),linux)
@@ -109,6 +110,7 @@
 # Broken build defaults
 # ###############################################################
 $(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
+BUILD_BROKEN_NINJA_USES_ENV_VARS :=
 
 # Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
 # or under vendor/*/$(TARGET_DEVICE).  Search in both places, but
diff --git a/core/definitions.mk b/core/definitions.mk
index 63e609e..ff435e2 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -108,6 +108,9 @@
 # All tests that should be skipped in presubmit check.
 ALL_DISABLED_PRESUBMIT_TESTS :=
 
+# All compatibility suites mentioned in LOCAL_COMPATIBILITY_SUITES
+ALL_COMPATIBILITY_SUITES :=
+
 ###########################################################
 ## Debugging; prints a variable list to stdout
 ###########################################################
@@ -2625,17 +2628,15 @@
 endef
 
 # Define a rule to create a symlink to a file.
-# $(1): full path to source
+# $(1): any dependencies
 # $(2): source (may be relative)
 # $(3): full path to destination
 define symlink-file
 $(eval $(_symlink-file))
 endef
 
-# Order-only dependency because make/ninja will follow the link when checking
-# the timestamp, so the file must exist
 define _symlink-file
-$(3): | $(1)
+$(3): $(1)
 	@echo "Symlink: $$@ -> $(2)"
 	@mkdir -p $(dir $$@)
 	@rm -rf $$@
@@ -2894,6 +2895,7 @@
 #    and use my_compat_dist_$(suite) to define the others.
 define create-suite-dependencies
 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
+  $(if $(filter $(suite),$(ALL_COMPATIBILITY_SUITES)),,$(eval ALL_COMPATIBILITY_SUITES += $(suite))) \
   $(eval COMPATIBILITY.$(suite).FILES := \
     $$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))) \
       $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call word-colon,2,$$(f)))) \
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index 0f994c4..5dd5505 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -37,16 +37,6 @@
   endif
 endif
 
-# Default to debug version to help find bugs.
-# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
-ifeq ($(USE_DEX2OAT_DEBUG),false)
-DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
-else
-DEX2OAT := $(SOONG_HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
-endif
-
-DEX2OAT_DEPENDENCY += $(DEX2OAT)
-
 # Use the first preloaded-classes file in PRODUCT_COPY_FILES.
 PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
     $(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
@@ -136,16 +126,6 @@
   $(call add_json_str,  Dex2oatImageXmx,                    $(DEX2OAT_IMAGE_XMX))
   $(call add_json_str,  Dex2oatImageXms,                    $(DEX2OAT_IMAGE_XMS))
 
-  $(call add_json_map,  Tools)
-  $(call add_json_str,  Profman,                            $(SOONG_HOST_OUT_EXECUTABLES)/profman)
-  $(call add_json_str,  Dex2oat,                            $(DEX2OAT))
-  $(call add_json_str,  Aapt,                               $(SOONG_HOST_OUT_EXECUTABLES)/aapt)
-  $(call add_json_str,  SoongZip,                           $(SOONG_ZIP))
-  $(call add_json_str,  Zip2zip,                            $(ZIP2ZIP))
-  $(call add_json_str,  ManifestCheck,                      $(SOONG_HOST_OUT_EXECUTABLES)/manifest_check)
-  $(call add_json_str,  ConstructContext,                   $(BUILD_SYSTEM)/construct_context.sh)
-  $(call end_json_map)
-
   $(call json_end)
 
   $(shell mkdir -p $(dir $(DEX_PREOPT_CONFIG)))
@@ -158,11 +138,3 @@
       rm $(DEX_PREOPT_CONFIG).tmp; \
     fi)
 endif
-
-DEXPREOPT_GEN_DEPS := \
-  $(SOONG_HOST_OUT_EXECUTABLES)/profman \
-  $(DEX2OAT) \
-  $(SOONG_HOST_OUT_EXECUTABLES)/aapt \
-  $(SOONG_ZIP) \
-  $(ZIP2ZIP) \
-  $(BUILD_SYSTEM)/construct_context.sh \
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index aa3fd80..ab1ab28 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -111,6 +111,7 @@
 my_dexpreopt_archs :=
 my_dexpreopt_images :=
 my_dexpreopt_images_deps :=
+my_dexpreopt_image_locations :=
 my_dexpreopt_infix := boot
 ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
   my_dexpreopt_infix := apex
@@ -183,6 +184,8 @@
     endif  # TARGET_2ND_ARCH
   endif  # LOCAL_MODULE_CLASS
 
+  my_dexpreopt_image_locations += $(DEXPREOPT_IMAGE_LOCATIONS_$(my_dexpreopt_infix))
+
   my_filtered_optional_uses_libraries := $(filter-out $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES), \
     $(LOCAL_OPTIONAL_USES_LIBRARIES))
 
@@ -234,7 +237,7 @@
   $(call end_json_map)
   $(call add_json_list, Archs,                          $(my_dexpreopt_archs))
   $(call add_json_list, DexPreoptImages,                $(my_dexpreopt_images))
-  $(call add_json_list, DexPreoptImageLocations,        $(DEXPREOPT_IMAGE_LOCATIONS))
+  $(call add_json_list, DexPreoptImageLocations,        $(my_dexpreopt_image_locations))
   $(call add_json_list, PreoptBootClassPathDexFiles,    $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES))
   $(call add_json_list, PreoptBootClassPathDexLocations,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
   $(call add_json_bool, PreoptExtractedApk,             $(my_preopt_for_extracted_apk))
@@ -256,12 +259,16 @@
 
   .KATI_RESTAT: $(my_dexpreopt_script)
   $(my_dexpreopt_script): PRIVATE_MODULE := $(LOCAL_MODULE)
+  $(my_dexpreopt_script): PRIVATE_GLOBAL_SOONG_CONFIG := $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE)
   $(my_dexpreopt_script): PRIVATE_GLOBAL_CONFIG := $(DEX_PREOPT_CONFIG_FOR_MAKE)
   $(my_dexpreopt_script): PRIVATE_MODULE_CONFIG := $(my_dexpreopt_config)
   $(my_dexpreopt_script): $(DEXPREOPT_GEN)
-  $(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_CONFIG_FOR_MAKE)
+  $(my_dexpreopt_script): $(my_dexpreopt_config) $(DEX_PREOPT_SOONG_CONFIG_FOR_MAKE) $(DEX_PREOPT_CONFIG_FOR_MAKE)
 	@echo "$(PRIVATE_MODULE) dexpreopt gen"
-	$(DEXPREOPT_GEN) -global $(PRIVATE_GLOBAL_CONFIG) -module $(PRIVATE_MODULE_CONFIG) \
+	$(DEXPREOPT_GEN) \
+	-global_soong $(PRIVATE_GLOBAL_SOONG_CONFIG) \
+	-global $(PRIVATE_GLOBAL_CONFIG) \
+	-module $(PRIVATE_MODULE_CONFIG) \
 	-dexpreopt_script $@ \
 	-out_dir $(OUT_DIR)
 
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index eac0414..25a16a3 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -49,29 +49,21 @@
   my_shared_library_path := $(call get_non_asan_path,\
       $($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
   my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
-  # Do not use order-only dependency, because we want to rebuild the image if an jni is updated.
-  $(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
 
   ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
 
   # Create symlink in the app specific lib path
   # Skip creating this symlink when running the second part of a target sanitization build.
   ifeq ($(filter address,$(SANITIZE_TARGET)),)
-    ifdef LOCAL_POST_INSTALL_CMD
-      # Add a shell command separator
-      LOCAL_POST_INSTALL_CMD += ;
-    endif
-
     my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
-        $(my_shared_library_path))
-    LOCAL_POST_INSTALL_CMD += \
-        mkdir -p $(my_app_lib_path) \
-        $(foreach lib, $(my_jni_filenames), ;ln -sf $(my_symlink_target_dir)/$(lib) $(my_app_lib_path)/$(lib))
-    $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
-  else
-    ifdef LOCAL_POST_INSTALL_CMD
-      $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
-    endif
+      $(my_shared_library_path))
+    $(foreach lib,$(my_jni_filenames),\
+      $(call symlink-file, \
+        $(my_shared_library_path)/$(lib), \
+        $(my_symlink_target_dir)/$(lib), \
+        $(my_app_lib_path)/$(lib)) \
+      $(eval $$(LOCAL_INSTALLED_MODULE) : $$(my_app_lib_path)/$$(lib)) \
+      $(eval ALL_MODULES.$$(LOCAL_MODULE).INSTALLED += $$(my_app_lib_path)/$$(lib)))
   endif
 
   # Clear jni_shared_libraries to not embed it into the apk.
diff --git a/core/main.mk b/core/main.mk
index b51603d..0400856 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1256,6 +1256,28 @@
     $(CUSTOM_MODULES) \
   )
 
+#
+# Used by the cleanup logic in soong_ui to remove files that should no longer
+# be installed.
+#
+
+# Include all tests, so that we remove them from the test suites / testcase
+# folders when they are removed.
+test_files := $(foreach ts,$(ALL_COMPATIBILITY_SUITES),$(COMPATIBILITY.$(ts).FILES))
+
+$(shell mkdir -p $(PRODUCT_OUT) $(HOST_OUT))
+
+$(file >$(PRODUCT_OUT)/.installable_files$(if $(filter address,$(SANITIZE_TARGET)),_asan), \
+  $(sort $(patsubst $(PRODUCT_OUT)/%,%,$(filter $(PRODUCT_OUT)/%, \
+    $(modules_to_install) $(test_files)))))
+
+$(file >$(HOST_OUT)/.installable_test_files,$(sort \
+  $(patsubst $(HOST_OUT)/%,%,$(filter $(HOST_OUT)/%, \
+    $(test_files)))))
+
+test_files :=
+
+
 # Don't include any GNU General Public License shared objects or static
 # libraries in SDK images.  GPL executables (not static/dynamic libraries)
 # are okay if they don't link against any closed source libraries (directly
@@ -1584,7 +1606,7 @@
   endif
 
   ifeq ($(EMMA_INSTRUMENT),true)
-    $(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE_TARGET)
+    $(JACOCO_REPORT_CLASSES_ALL) : $(modules_to_install)
     $(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
   endif
 
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 98c646a..ebb22c5 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -41,6 +41,10 @@
       $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
     endif
   endif # TURBINE_ENABLED != false
+
+  javac-check : $(full_classes_jar)
+  javac-check-$(LOCAL_MODULE) : $(full_classes_jar)
+  .PHONY: javac-check-$(LOCAL_MODULE)
 endif
 
 # Run veridex on product, system_ext and vendor modules.
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 8095212..5d445e0 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -250,7 +250,7 @@
     #  It must be of the form "YYYY-MM-DD" on production devices.
     #  It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
     #  If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
-      PLATFORM_SECURITY_PATCH := 2019-12-05
+      PLATFORM_SECURITY_PATCH := 2020-01-01
 endif
 .KATI_READONLY := PLATFORM_SECURITY_PATCH
 
diff --git a/target/board/mainline_arm64/BoardConfig.mk b/target/board/mainline_arm64/BoardConfig.mk
index c53da9e..a09960f 100644
--- a/target/board/mainline_arm64/BoardConfig.mk
+++ b/target/board/mainline_arm64/BoardConfig.mk
@@ -40,8 +40,3 @@
 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to BoardConfigMainlineCommon. Currently, GSI wants flattened
-#       apexes, but emulator wants .apex files, preventing this.
-TARGET_FLATTEN_APEX := false
diff --git a/target/board/mainline_x86/BoardConfig.mk b/target/board/mainline_x86/BoardConfig.mk
index a20d17c..4dda058 100644
--- a/target/board/mainline_x86/BoardConfig.mk
+++ b/target/board/mainline_x86/BoardConfig.mk
@@ -29,7 +29,3 @@
 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to product makefile and use updatable_apex.mk
-TARGET_FLATTEN_APEX := false
diff --git a/target/board/mainline_x86_arm/BoardConfig.mk b/target/board/mainline_x86_arm/BoardConfig.mk
index 6b282c2..d775a77 100644
--- a/target/board/mainline_x86_arm/BoardConfig.mk
+++ b/target/board/mainline_x86_arm/BoardConfig.mk
@@ -34,7 +34,3 @@
 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-
-# Mainline devices support apex
-# TODO: move this to product makefile and use updatable_apex.mk
-TARGET_FLATTEN_APEX := false
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 7d182c4..8ced9ab 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -97,6 +97,7 @@
     idmap2 \
     idmap2d \
     ime \
+    ims-common \
     incident \
     incidentd \
     incident_helper \
@@ -250,6 +251,7 @@
     task_profiles.json \
     tc \
     telecom \
+    telephony-common \
     tombstoned \
     traced \
     traced_probes \
@@ -268,10 +270,6 @@
     wifi-service \
     wm \
 
-# TODO(b/146549048) remove this
-PRODUCT_PACKAGES += \
-    boringssl_self_test
-
 # VINTF data for system image
 PRODUCT_PACKAGES += \
     system_manifest.xml \
@@ -325,7 +323,7 @@
     telephony-common \
     voip-common \
     ims-common \
-    framework-sdkext \
+    framework-sdkextensions \
     ike \
     updatable-media \
     framework-tethering
@@ -334,9 +332,7 @@
     com.android.conscrypt:conscrypt \
     com.android.ipsec:ike \
     com.android.media:updatable-media \
-    com.android.sdkext:framework-sdkext \
-    com.android.telephony:telephony-common \
-    com.android.telephony:ims-common \
+    com.android.sdkext:framework-sdkextensions \
     com.android.tethering:framework-tethering
 
 PRODUCT_COPY_FILES += \
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 424cf05..243c00f 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -51,7 +51,7 @@
 ifeq (REL,$(PLATFORM_VERSION_CODENAME))
 _vndk_check_failure_message += "       Changing the VNDK library list is not allowed in API locked branches."
 else
-_vndk_check_failure_message += "       Run update-vndk-list.sh to update $(LATEST_VNDK_LIB_LIST)"
+_vndk_check_failure_message += "       Run \`update-vndk-list.sh\` to update $(LATEST_VNDK_LIB_LIST)"
 endif
 
 $(check-vndk-list-timestamp): $(INTERNAL_VNDK_LIB_LIST) $(LATEST_VNDK_LIB_LIST) $(HOST_OUT_EXECUTABLES)/update-vndk-list.sh
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index c50177f..d29a48f 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -186,6 +186,7 @@
 VNDK-core: android.hardware.usb@1.0.so
 VNDK-core: android.hardware.usb@1.1.so
 VNDK-core: android.hardware.usb@1.2.so
+VNDK-core: android.hardware.vibrator-V1-ndk_platform.so
 VNDK-core: android.hardware.vibrator@1.0.so
 VNDK-core: android.hardware.vibrator@1.1.so
 VNDK-core: android.hardware.vibrator@1.2.so
@@ -273,7 +274,6 @@
 VNDK-core: libxml2.so
 VNDK-core: libyuv.so
 VNDK-core: libziparchive.so
-VNDK-core: vintf-vibrator-V1-ndk_platform.so
 VNDK-private: libbacktrace.so
 VNDK-private: libbinderthreadstate.so
 VNDK-private: libblas.so
diff --git a/target/product/mainline_system_x86_64.mk b/target/product/mainline_system_x86_64.mk
index 1b1a42f..473ff72 100644
--- a/target/product/mainline_system_x86_64.mk
+++ b/target/product/mainline_system_x86_64.mk
@@ -24,9 +24,6 @@
 # Enable mainline checking
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
 
-# Enable nonflat APEX
-$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
-
 PRODUCT_BUILD_CACHE_IMAGE := false
 PRODUCT_BUILD_ODM_IMAGE := false
 PRODUCT_BUILD_PRODUCT_IMAGE  := false
diff --git a/target/product/sdk_phone_x86.mk b/target/product/sdk_phone_x86.mk
index 4f7602d..9df26a9 100644
--- a/target/product/sdk_phone_x86.mk
+++ b/target/product/sdk_phone_x86.mk
@@ -15,7 +15,6 @@
 #
 QEMU_USE_SYSTEM_EXT_PARTITIONS := true
 PRODUCT_USE_DYNAMIC_PARTITIONS := true
-BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 2
 
 #
 # All components inherited here go to system image
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index a556f53..f41df37 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -45,6 +45,7 @@
     '/vendor': ('VENDOR', 'SYSTEM/vendor'),
     '/product': ('PRODUCT', 'SYSTEM/product'),
     '/odm': ('ODM', 'VENDOR/odm', 'SYSTEM/vendor/odm'),
+    '/system_ext': ('SYSTEM_EXT', 'SYSTEM/system_ext'),
 }
 
 UNZIP_PATTERN = ['META/*', '*/build.prop']
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 54ee7cf..6a6f119 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -823,6 +823,12 @@
     merged_dict[key] = (
         "%s %s" %
         (framework_dict.get(key, ""), vendor_dict.get(key, ""))).strip()
+
+  # Pick virtual ab related flags from vendor dict, if defined.
+  if "virtual_ab" in vendor_dict.keys():
+     merged_dict["virtual_ab"] = vendor_dict["virtual_ab"]
+  if "virtual_ab_retrofit" in vendor_dict.keys():
+     merged_dict["virtual_ab_retrofit"] = vendor_dict["virtual_ab_retrofit"]
   return merged_dict
 
 
diff --git a/tools/warn/cpp_warn_patterns.py b/tools/warn/cpp_warn_patterns.py
index 8ae0a3c..ce10693 100644
--- a/tools/warn/cpp_warn_patterns.py
+++ b/tools/warn/cpp_warn_patterns.py
@@ -426,6 +426,9 @@
     {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wnon-literal-null-conversion',
      'description': 'Zero used as null pointer',
      'patterns': [r".*: warning: expression .* zero treated as a null pointer constant"]},
+    {'category': 'C/C++', 'severity': Severity.MEDIUM, 'option': '-Wpointer-compare',
+     'description': 'Compare pointer to null character',
+     'patterns': [r".*: warning: comparing a pointer to a null character constant"]},
     {'category': 'C/C++', 'severity': Severity.MEDIUM,
      'description': 'Implicit conversion changes value or loses precision',
      'patterns': [r".*: warning: implicit conversion .* changes value from .* to .*-conversion",
diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
index 696ce9a..77b80a4 100644
--- a/tools/warn/java_warn_patterns.py
+++ b/tools/warn/java_warn_patterns.py
@@ -42,8 +42,9 @@
 patterns = [
     # pylint:disable=line-too-long,g-inconsistent-quotes
     # Warnings from Javac
-    java_medium('Use of deprecated member',
-                [r'.*: warning: \[deprecation\] .+']),
+    java_medium('Use of deprecated',
+                [r'.*: warning: \[deprecation\] .+',
+                 r'.*: warning: \[removal\] .+ has been deprecated and marked for removal$']),
     java_medium('Unchecked conversion',
                 [r'.*: warning: \[unchecked\] .+']),
     # Warnings generated by Error Prone
@@ -125,6 +126,8 @@
              [r".*: warning: \[UseBinds\] .+"]),
     java_low('Wildcard imports, static or otherwise, should not be used',
              [r".*: warning: \[WildcardImport\] .+"]),
+    java_medium('AcronymName',
+                [r".*\.java:.*: warning: .+ \[AcronymName\]$"]),
     java_medium('Method reference is ambiguous',
                 [r".*: warning: \[AmbiguousMethodReference\] .+"]),
     java_medium('This method passes a pair of parameters through to String.format, but the enclosing method wasn\'t annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.',
@@ -265,6 +268,8 @@
                 [r".*: warning: \[InstanceOfAndCastMatchWrongType\] .+"]),
     java_medium('Expression of type int may overflow before being assigned to a long',
                 [r".*: warning: \[IntLongMath\] .+"]),
+    java_medium('IntentBuilderName',
+                [r".*\.java:.*: warning: .+ \[IntentBuilderName\]$"]),
     java_medium('This @param tag doesn\'t refer to a parameter of the method.',
                 [r".*: warning: \[InvalidParam\] .+"]),
     java_medium('This tag is invalid.',
@@ -319,6 +324,8 @@
                 [r".*: warning: \[NonCanonicalStaticMemberImport\] .+"]),
     java_medium('equals method doesn\'t override Object.equals',
                 [r".*: warning: \[NonOverridingEquals\] .+"]),
+    java_medium('Not closeable',
+                [r".*\.java:.*: warning: .+ \[NotCloseable\]$"]),
     java_medium('Constructors should not be annotated with @Nullable since they cannot return null',
                 [r".*: warning: \[NullableConstructor\] .+"]),
     java_medium('Dereference of possibly-null value',
@@ -369,6 +376,8 @@
                 [r".*: warning: \[RequiredModifiers\] .+"]),
     java_medium('Void methods should not have a @return tag.',
                 [r".*: warning: \[ReturnFromVoid\] .+"]),
+    java_medium('SAM-compatible parameters should be last',
+                [r".*\.java:.*: warning: .+ \[SamShouldBeLast\]$"]),
     java_medium(u'Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
                 [r".*: warning: \[ShortCircuitBoolean\] .+"]),
     java_medium('Writes to static fields should not be guarded by instance locks',
@@ -431,6 +440,10 @@
                 [r".*: warning: \[UnusedException\] .+"]),
     java_medium('Java assert is used in test. For testing purposes Assert.* matchers should be used.',
                 [r".*: warning: \[UseCorrectAssertInTests\] .+"]),
+    java_medium('UserHandle',
+                [r".*\.java:.*: warning: .+ \[UserHandle\]$"]),
+    java_medium('UserHandleName',
+                [r".*\.java:.*: warning: .+ \[UserHandleName\]$"]),
     java_medium('Non-constant variable missing @Var annotation',
                 [r".*: warning: \[Var\] .+"]),
     java_medium('variableName and type with the same name would refer to the static field instead of the class',
@@ -449,6 +462,8 @@
               [r".*: warning: \[ArrayFillIncompatibleType\] .+"]),
     java_high('hashcode method on array does not hash array contents',
               [r".*: warning: \[ArrayHashCode\] .+"]),
+    java_high('ArrayReturn',
+              [r".*\.java:.*: warning: .+ \[ArrayReturn\]$"]),
     java_high('Calling toString on an array does not provide useful information',
               [r".*: warning: \[ArrayToString\] .+"]),
     java_high('Arrays.asList does not autobox primitive arrays, as one might expect.',
@@ -500,7 +515,7 @@
     java_high('Thread created but not started',
               [r".*: warning: \[DeadThread\] .+"]),
     java_high('Deprecated item is not annotated with @Deprecated',
-              [r".*: warning: \[DepAnn\] .+"]),
+              [r".*\.java:.*: warning: \[.*\] .+ is not annotated with @Deprecated$"]),
     java_high('Division by integer literal zero',
               [r".*: warning: \[DivZero\] .+"]),
     java_high('This method should not be called.',
@@ -721,4 +736,9 @@
               [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]),
     java_high('`var` should not be used as a type name.',
               [r".*: warning: \[VarTypeName\] .+"]),
+    # Other javac tool warnings
+    java_medium('addNdkApiCoverage failed to getPackage',
+                [r".*: warning: addNdkApiCoverage failed to getPackage"]),
+    java_medium('Supported version from annotation processor',
+                [r".*: warning: Supported source version .+ from annotation processor"]),
 ]
diff --git a/tools/warn/other_warn_patterns.py b/tools/warn/other_warn_patterns.py
index 45d14dc..524673e 100644
--- a/tools/warn/other_warn_patterns.py
+++ b/tools/warn/other_warn_patterns.py
@@ -39,6 +39,10 @@
   return warn('asm', Severity.MEDIUM, description, pattern_list)
 
 
+def kotlin(description, pattern_list):
+  return warn('Kotlin', Severity.MEDIUM, description, pattern_list)
+
+
 patterns = [
     # pylint:disable=line-too-long,g-inconsistent-quotes
     # aapt warnings
@@ -96,16 +100,16 @@
      'description': 'Proto: Import not used',
      'patterns': [r".*: warning: Import .*/.*\.proto but not used.$"]},
     # Kotlin warnings
-    {'category': 'Kotlin', 'severity': Severity.MEDIUM,
-     'description': 'Kotlin: never used parameter or variable',
-     'patterns': [r".*: warning: (parameter|variable) '.*' is never used$"]},
-    {'category': 'Kotlin', 'severity': Severity.MEDIUM,
-     'description': 'Kotlin: Deprecated in Java',
-     'patterns': [r".*: warning: '.*' is deprecated. Deprecated in Java"]},
-    {'category': 'Kotlin', 'severity': Severity.MEDIUM,
-     'description': 'Kotlin: library has Kotlin runtime',
-     'patterns': [r".*: warning: library has Kotlin runtime bundled into it",
-                  r".*: warning: some JAR files .* have the Kotlin Runtime library"]},
+    kotlin('never used parameter or variable',
+           [r".*\.kt:.*: warning: (parameter|variable) '.*' is never used$",
+            r".*\.kt:.*: warning: (parameter|variable) '.*' is never used, could be renamed to _$"]),
+    kotlin('unchecked cast',
+           [r".*\.kt:.*: warning: unchecked cast: .* to .*$"]),
+    kotlin('Deprecated in Java',
+           [r".*\.kt:.*: warning: '.*' is deprecated. Deprecated in Java"]),
+    kotlin('library has Kotlin runtime',
+           [r".*: warning: library has Kotlin runtime bundled into it",
+            r".*: warning: some JAR files .* have the Kotlin Runtime library"]),
     # Rust warnings
     {'category': 'Rust', 'severity': Severity.HIGH,
      'description': 'Rust: Does not derive Copy',