Merge "Revert "Build: Bring back SDK dependencies""
diff --git a/CleanSpec.mk b/CleanSpec.mk
index a3b5f3c..8087646 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -377,6 +377,8 @@
 $(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/previous_overlays.txt)
 $(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/current_packages.txt)
 
+$(call add-clean-step, rm -rf $(HOST_OUT_INTERMEDIATES)/include)
+
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/core/Makefile b/core/Makefile
index dc760b5..547db71 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1665,6 +1665,7 @@
   $(HOST_OUT_EXECUTABLES)/e2fsck \
   $(HOST_OUT_EXECUTABLES)/build_verity_tree \
   $(HOST_OUT_EXECUTABLES)/verity_signer \
+  $(HOST_OUT_EXECUTABLES)/verity_verifier \
   $(HOST_OUT_EXECUTABLES)/append2simg \
   $(HOST_OUT_EXECUTABLES)/img2simg \
   $(HOST_OUT_EXECUTABLES)/boot_signer \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 13d20e0..251ac35 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -65,6 +65,8 @@
   my_host_cross :=
 endif
 
+include $(BUILD_SYSTEM)/local_vndk.mk
+
 my_module_tags := $(LOCAL_MODULE_TAGS)
 ifeq ($(my_host_cross),true)
   my_module_tags :=
diff --git a/core/binary.mk b/core/binary.mk
index c11ed32f..17b1bf2 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -74,8 +74,9 @@
 my_ndk_sysroot :=
 my_ndk_sysroot_include :=
 my_ndk_sysroot_lib :=
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
   ifdef LOCAL_IS_HOST_MODULE
+    # LOCAL_USE_VNDK is checked in local_vndk.mk
     $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
   endif
 
@@ -104,17 +105,33 @@
   # missing API levels to existing ones where necessary, but we're not doing
   # that for the generated libraries. Clip the API level to the minimum where
   # appropriate.
-  my_ndk_api := $(call math_max,$(LOCAL_SDK_VERSION),$(my_min_sdk_version))
+  ifdef LOCAL_USE_VNDK
+    my_ndk_api := $(BOARD_VNDK_VERSION)
+  else
+    my_ndk_api := $(LOCAL_SDK_VERSION)
+  endif
+  ifneq ($(my_ndk_api),current)
+      my_ndk_api := $(call math_max,$(my_ndk_api),$(my_min_sdk_version))
+  endif
+
+  my_ndk_api_def := $(my_ndk_api)
+  my_ndk_hist_api := $(my_ndk_api)
+  ifeq ($(my_ndk_api),current)
+    my_ndk_api_def := __ANDROID_API_FUTURE__
+    # The last API level supported by the old prebuilt NDKs.
+    my_ndk_hist_api := 24
+  endif
+
 
   # Traditionally this has come from android/api-level.h, but with the libc
   # headers unified it must be set by the build system since we don't have
   # per-API level copies of that header now.
-  my_cflags += -D__ANDROID_API__=$(my_ndk_api)
+  my_cflags += -D__ANDROID_API__=$(my_ndk_api_def)
 
   my_ndk_source_root := \
       $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
   my_ndk_sysroot := \
-    $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_api)/arch-$(my_arch)
+    $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_hist_api)/arch-$(my_arch)
   my_built_ndk := $(SOONG_OUT_DIR)/ndk
   my_ndk_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_TRIPLE)
   my_ndk_sysroot_include := \
@@ -142,18 +159,20 @@
   my_built_ndk_libs := $(my_ndk_platform_dir)/usr/$(my_ndk_libdir_name)
   my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/$(my_ndk_libdir_name)
 
-  # The bionic linker now has support for packed relocations and gnu style
-  # hashes (which are much faster!), but shipping to older devices requires
-  # the old style hash. Fortunately, we can build with both and it'll work
-  # anywhere.
-  #
-  # This is not currently supported on MIPS architectures.
-  ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
-    my_ldflags += -Wl,--hash-style=both
-  endif
+  ifndef LOCAL_USE_VNDK
+    # The bionic linker now has support for packed relocations and gnu style
+    # hashes (which are much faster!), but shipping to older devices requires
+    # the old style hash. Fortunately, we can build with both and it'll work
+    # anywhere.
+    #
+    # This is not currently supported on MIPS architectures.
+    ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
+      my_ldflags += -Wl,--hash-style=both
+    endif
 
-  # We don't want to expose the relocation packer to the NDK just yet.
-  LOCAL_PACK_MODULE_RELOCATIONS := false
+    # We don't want to expose the relocation packer to the NDK just yet.
+    LOCAL_PACK_MODULE_RELOCATIONS := false
+  endif
 
   # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
   # See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -161,6 +180,7 @@
   my_ndk_stl_shared_lib_fullpath :=
   my_ndk_stl_static_lib :=
   my_ndk_cpp_std_version :=
+  ifndef LOCAL_USE_VNDK
   my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
   ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
     my_cpu_variant := mips32r6
@@ -248,6 +268,7 @@
   endif
   endif
   endif
+  endif
 endif
 
 ifndef LOCAL_IS_HOST_MODULE
@@ -268,7 +289,7 @@
 my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
 endif
 
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
   my_all_ndk_libraries := \
       $(NDK_MIGRATED_LIBS) $(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES))
   my_ndk_shared_libraries := \
@@ -477,17 +498,30 @@
 ## Define PRIVATE_ variables from global vars
 ###########################################################
 ifndef LOCAL_IS_HOST_MODULE
-ifdef LOCAL_SDK_VERSION
+ifdef LOCAL_USE_VNDK
+my_target_global_c_includes := \
+    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
+my_target_global_c_system_includes := \
+    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+    $(my_ndk_sysroot_include)
+else ifdef LOCAL_SDK_VERSION
 my_target_global_c_includes :=
 my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
-else
+else ifdef BOARD_VNDK_VERSION
 my_target_global_c_includes := $(SRC_HEADERS) \
     $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
     $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
 my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
     $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
     $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
-endif # LOCAL_SDK_VERSION
+else
+my_target_global_c_includes := $(SRC_HEADERS) \
+    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
+my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
+    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
+endif
 
 ifeq ($(my_clang),true)
 my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
@@ -511,10 +545,8 @@
 else # LOCAL_IS_HOST_MODULE
 
 my_host_global_c_includes := $(SRC_HEADERS) \
-    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
     $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
 my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
-    $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
     $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
 
 ifeq ($(my_clang),true)
@@ -1327,7 +1359,7 @@
 ## they may cusomize their install path with LOCAL_MODULE_PATH
 ##########################################################
 # Get the list of INSTALLED libraries as module names.
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
   installed_shared_library_module_names := \
       $(my_shared_libraries)
 else
@@ -1496,7 +1528,7 @@
 so_suffix := $($(my_prefix)SHLIB_SUFFIX)
 a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
 
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
 built_shared_libraries := \
     $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
       $(addsuffix $(so_suffix), \
@@ -1678,7 +1710,7 @@
 # One last verification check for ldlibs
 ifndef LOCAL_IS_HOST_MODULE
 my_allowed_ldlibs :=
-ifdef LOCAL_SDK_VERSION
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
   my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES))
 endif
 
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index faf18e3..b9c28b1 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -216,6 +216,7 @@
 LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES:=
 LOCAL_LOGTAGS_FILES:=
 LOCAL_RECORDED_MODULE_TYPE:=
+LOCAL_USE_VNDK:=
 
 # arch specific variables
 LOCAL_SRC_FILES_$(TARGET_ARCH):=
diff --git a/core/config.mk b/core/config.mk
index 2fcf1fe..677d210 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -684,10 +684,8 @@
 RELATIVE_PWD :=
 endif
 
-HOST_PROJECT_INCLUDES :=
-HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_OUT_HEADERS)
 TARGET_PROJECT_INCLUDES :=
-TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_OUT_HEADERS) \
+TARGET_PROJECT_SYSTEM_INCLUDES := \
 		$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
 		$(TARGET_PRODUCT_KERNEL_HEADERS)
 
@@ -696,21 +694,6 @@
 $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
 endif
 
-ifdef HOST_2ND_ARCH
-$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_INCLUDES := $(HOST_PROJECT_INCLUDES)
-$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_PROJECT_SYSTEM_INCLUDES)
-endif
-
-ifdef HOST_CROSS_OS
-HOST_CROSS_PROJECT_INCLUDES :=
-HOST_CROSS_PROJECT_SYSTEM_INCLUDES := $(HOST_CROSS_OUT_HEADERS)
-
-ifdef HOST_CROSS_2ND_ARCH
-$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(HOST_CROSS_PROJECT_INCLUDES)
-$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_SYSTEM_INCLUDES:= $(HOST_CROSS_PROJECT_SYSTEM_INCLUDES)
-endif
-endif
-
 # allow overriding default Java libraries on a per-target basis
 ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
   TARGET_DEFAULT_JAVA_LIBRARIES := core-oj core-libart core-junit ext framework okhttp
diff --git a/core/copy_headers.mk b/core/copy_headers.mk
index 417a76c..c26d51d 100644
--- a/core/copy_headers.mk
+++ b/core/copy_headers.mk
@@ -1,11 +1,30 @@
+ifneq (,$(strip $(LOCAL_COPY_HEADERS)))
 ###########################################################
 ## Copy headers to the install tree
 ###########################################################
 $(call record-module-type,COPY_HEADERS)
 ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
-  my_prefix := HOST_
-else
-  my_prefix := TARGET_
+  $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_COPY_HEADERS may not be used with host modules >&2)
+  $(error done)
+endif
+
+# Modules linking against the SDK do not have the include path to use
+# COPY_HEADERS, so prevent them from exporting any either.
+ifdef LOCAL_SDK_VERSION
+$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2)
+$(error done)
+endif
+
+include $(BUILD_SYSTEM)/local_vndk.mk
+
+# If we're using the VNDK, only vendor modules using the VNDK may use
+# LOCAL_COPY_HEADERS. Platform libraries will not have the include path
+# present.
+ifdef BOARD_VNDK_VERSION
+ifndef LOCAL_USE_VNDK
+$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2)
+$(error done)
+endif
 endif
 
 # Create a rule to copy each header, and make the
@@ -17,8 +36,8 @@
   $(eval _chFrom := $(LOCAL_PATH)/$(header)) \
   $(eval _chTo := \
       $(if $(LOCAL_COPY_HEADERS_TO),\
-        $($(my_prefix)OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
-        $($(my_prefix)OUT_HEADERS)/$(notdir $(header)))) \
+        $(TARGET_OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
+        $(TARGET_OUT_HEADERS)/$(notdir $(header)))) \
   $(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \
   $(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \
   $(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \
@@ -26,3 +45,5 @@
  )
 _chFrom :=
 _chTo :=
+
+endif # LOCAL_COPY_HEADERS
diff --git a/core/definitions.mk b/core/definitions.mk
index 7a42ad8..1a9276c 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1773,7 +1773,6 @@
 	-nostdlib -Wl,-soname,$(notdir $@) \
 	-Wl,--gc-sections \
 	$(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl$(comma)-shared) \
-	$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
 	$(PRIVATE_TARGET_CRTBEGIN_SO_O) \
 	$(PRIVATE_ALL_OBJECTS) \
 	-Wl,--whole-archive \
@@ -1860,7 +1859,6 @@
 	-Wl,-dynamic-linker,$(PRIVATE_LINKER) \
 	-Wl,--gc-sections \
 	-Wl,-z,nocopyreloc \
-	$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
 	-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
 	$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O) \
 	$(PRIVATE_ALL_OBJECTS) \
@@ -1904,7 +1902,6 @@
 	$(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \
 	-Wl,--gc-sections \
 	-o $@ \
-	$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
 	$(PRIVATE_TARGET_CRTBEGIN_STATIC_O) \
 	$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
 	$(PRIVATE_LDFLAGS) \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 8794c8a..b08f57c 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -269,7 +269,6 @@
 HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage
 
 HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
-HOST_OUT_HEADERS := $(HOST_OUT_INTERMEDIATES)/include
 HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
 HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
 HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
@@ -279,7 +278,6 @@
 include $(BUILD_SYSTEM)/aux_config.mk
 
 HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
-HOST_CROSS_OUT_HEADERS := $(HOST_CROSS_OUT_INTERMEDIATES)/include
 HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib
 HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
 
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 593f9f4..f51ddb8 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -34,7 +34,6 @@
 endif
 
 # Define PRIVATE_ variables from global vars
-my_target_global_ld_dirs :=
 ifeq ($(LOCAL_NO_LIBGCC),true)
 my_target_libgcc :=
 else
@@ -50,20 +49,11 @@
 my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
 my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
 endif
-ifdef LOCAL_SDK_VERSION
-# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
-# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
-my_target_global_ld_dirs := \
-    $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
-    $(my_ndk_sysroot_lib)) \
-    $(my_target_global_ld_dirs)
-my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
 my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_dynamic.o)
 my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.o)
 my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
 endif
-$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
-$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
 $(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
 $(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
 $(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
diff --git a/core/local_vndk.mk b/core/local_vndk.mk
new file mode 100644
index 0000000..f81249b
--- /dev/null
+++ b/core/local_vndk.mk
@@ -0,0 +1,25 @@
+# Verify LOCAL_USE_VNDK usage, and set LOCAL_SDK_VERSION if necessary
+
+ifdef LOCAL_IS_HOST_MODULE
+  ifdef LOCAL_USE_VNDK
+    $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Do not use LOCAL_USE_VNDK with host modules >&2)
+    $(error done)
+  endif
+endif
+ifdef LOCAL_USE_VNDK
+  ifneq ($(LOCAL_USE_VNDK),true)
+    $(shell echo '$(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_USE_VNDK must be "true" or empty, not "$(LOCAL_USE_VNDK)"' >&2)
+    $(error done)
+  endif
+
+  ifdef LOCAL_SDK_VERSION
+    $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_USE_VNDK must not be used with LOCAL_SDK_VERSION >&2)
+    $(error done)
+  endif
+
+  # If we're not using the VNDK, drop all restrictions
+  ifndef BOARD_VNDK_VERSION
+    LOCAL_USE_VNDK:=
+  endif
+endif
+
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 1a8975a..6b914c9 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -39,7 +39,6 @@
 include $(BUILD_SYSTEM)/dynamic_binary.mk
 
 # Define PRIVATE_ variables from global vars
-my_target_global_ld_dirs :=
 ifeq ($(LOCAL_NO_LIBGCC),true)
 my_target_libgcc :=
 else
@@ -53,19 +52,10 @@
 my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
 my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
 endif
-ifdef LOCAL_SDK_VERSION
-# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
-# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
-my_target_global_ld_dirs := \
-    $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
-    $(my_ndk_sysroot_lib)) \
-    $(my_target_global_ld_dirs)
-my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
+ifneq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),)
 my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o)
 my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
 endif
-$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
-$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
 $(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
 $(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
 $(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 995d9ed..1782ce5 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -47,6 +47,7 @@
 	echo '    "DeviceCpuVariant": "$(TARGET_CPU_VARIANT)",'; \
 	echo '    "DeviceAbi": ["$(TARGET_CPU_ABI)", "$(TARGET_CPU_ABI2)"],'; \
 	echo '    "DeviceUsesClang": $(if $(USE_CLANG_PLATFORM_BUILD),$(USE_CLANG_PLATFORM_BUILD),false),'; \
+	echo '    "DeviceVndkVersion": "$(BOARD_VNDK_VERSION)",'; \
 	echo ''; \
 	echo '    "DeviceSecondaryArch": "$(TARGET_2ND_ARCH)",'; \
 	echo '    "DeviceSecondaryArchVariant": "$(TARGET_2ND_ARCH_VARIANT)",'; \
diff --git a/tools/warn.py b/tools/warn.py
index 5c49cd3..5be6d9d 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -454,7 +454,7 @@
      'description': '_ used as an identifier',
      'patterns': [r".*: warning: '_' used as an identifier"]},
 
-    # Warnings from Error Prone.
+    # Warnings from Javac
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description': 'Java: Use of deprecated member',
@@ -464,7 +464,27 @@
      'description': 'Java: Unchecked conversion',
      'patterns': [r'.*: warning: \[unchecked\] .+']},
 
-    # Warnings from Error Prone (auto generated list).
+    # Begin warnings generated by Error Prone
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.',
+     'patterns': [r".*: warning: \[EmptySetMultibindingContributions\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Add a private constructor to modules that will not be instantiated by Dagger.',
+     'patterns': [r".*: warning: \[PrivateConstructorForNoninstantiableModuleTest\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: @Binds is a more efficient and declarative mechanism for delegating a binding.',
+     'patterns': [r".*: warning: \[UseBinds\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Field name is CONSTANT CASE, but field is not static and final',
+     'patterns': [r".*: warning: \[ConstantField\] .+"]},
     {'category': 'java',
      'severity': Severity.LOW,
      'description':
@@ -473,18 +493,118 @@
     {'category': 'java',
      'severity': Severity.LOW,
      'description':
-         'Java: Fallthrough warning suppression has no effect if warning is suppressed',
-     'patterns': [r".*: warning: \[FallthroughSuppression\] .+"]},
-    {'category': 'java',
-     'severity': Severity.LOW,
-     'description':
          'Java: Prefer \'L\' to \'l\' for the suffix to long literals',
      'patterns': [r".*: warning: \[LongLiteralLowerCaseSuffix\] .+"]},
     {'category': 'java',
      'severity': Severity.LOW,
      'description':
-         'Java: @Binds is a more efficient and declaritive mechanism for delegating a binding.',
-     'patterns': [r".*: warning: \[UseBinds\] .+"]},
+         'Java: C-style array declarations should not be used',
+     'patterns': [r".*: warning: \[MixedArrayDimensions\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Variable declarations should declare only one variable',
+     'patterns': [r".*: warning: \[MultiVariableDeclaration\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Source files should not contain multiple top-level class declarations',
+     'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Package names should match the directory they are declared in',
+     'patterns': [r".*: warning: \[PackageLocation\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Utility classes (only static members) are not designed to be instantiated and should be made noninstantiable with a default constructor.',
+     'patterns': [r".*: warning: \[PrivateConstructorForUtilityClass\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Unused imports',
+     'patterns': [r".*: warning: \[RemoveUnusedImports\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Unchecked exceptions do not need to be declared in the method signature.',
+     'patterns': [r".*: warning: \[ThrowsUncheckedException\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Using static imports for types is unnecessary',
+     'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
+    {'category': 'java',
+     'severity': Severity.LOW,
+     'description':
+         'Java: Wildcard imports, static or otherwise, should not be used',
+     'patterns': [r".*: warning: \[WildcardImport\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
+     'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Hardcoded reference to /sdcard',
+     'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
+     'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Constructors on abstract classes are never directly @Injected, only the constructors of their subclasses can be @Inject\'ed.',
+     'patterns': [r".*: warning: \[InjectOnConstructorOfAbstractClass\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Injection frameworks currently don\'t understand Qualifiers in TYPE PARAMETER or TYPE USE contexts.',
+     'patterns': [r".*: warning: \[QualifierWithTypeUse\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: This code declares a binding for a common value type without a Qualifier annotation.',
+     'patterns': [r".*: warning: \[BindingToUnqualifiedCommonType\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
+     'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Double-checked locking on non-volatile fields is unsafe',
+     'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Enums should always be immutable',
+     'patterns': [r".*: warning: \[ImmutableEnumChecker\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Writes to static fields should not be guarded by instance locks',
+     'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
+     'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Method reference is ambiguous',
+     'patterns': [r".*: warning: \[AmbiguousMethodReference\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: A different potential argument is more similar to the name of the parameter than the existing argument; this may be an error',
+     'patterns': [r".*: warning: \[ArgumentParameterMismatch\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
@@ -498,16 +618,41 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
+         'Java: Possible sign flip from narrowing conversion',
+     'patterns': [r".*: warning: \[BadComparable\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
          'Java: BigDecimal(double) and BigDecimal.valueOf(double) may lose precision, prefer BigDecimal(String) or BigDecimal(long)',
      'patterns': [r".*: warning: \[BigDecimalLiteralDouble\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
+         'Java: valueOf or autoboxing provides better time and space performance',
+     'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
          'Java: Mockito cannot mock final classes',
      'patterns': [r".*: warning: \[CannotMockFinalClass\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
+         'Java: Inner class is non-static but does not reference enclosing class',
+     'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Class.newInstance() bypasses exception checking; prefer getConstructor().newInstance()',
+     'patterns': [r".*: warning: \[ClassNewInstance\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Implicit use of the platform default charset, which can result in e.g. non-ASCII characters being silently replaced with \'?\' in many environments',
+     'patterns': [r".*: warning: \[DefaultCharset\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
          'Java: This code, which counts elements using a loop, can be replaced by a simpler library method',
      'patterns': [r".*: warning: \[ElementsCountedInLoop\] .+"]},
     {'category': 'java',
@@ -533,11 +678,26 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
+         'Java: Overloads will be ambiguous when passing lambda arguments',
+     'patterns': [r".*: warning: \[FunctionalInterfaceClash\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Calling getClass() on an enum may return a subclass of the enum type',
+     'patterns': [r".*: warning: \[GetClassOnEnum\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
          'Java: This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation',
      'patterns': [r".*: warning: \[IncompatibleModifiers\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
+         'Java: Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.',
+     'patterns': [r".*: warning: \[InputStreamSlowMultibyteRead\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
          'Java: Class should not implement both `Iterable` and `Iterator`',
      'patterns': [r".*: warning: \[IterableAndIterator\] .+"]},
     {'category': 'java',
@@ -553,7 +713,7 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
-         'Java: Enum switch statement is missing cases',
+         'Java: The Google Java Style Guide requires switch statements to have an explicit default',
      'patterns': [r".*: warning: \[MissingCasesInEnumSwitch\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
@@ -568,8 +728,8 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
-         'Java: Source files should not contain multiple top-level class declarations',
-     'patterns': [r".*: warning: \[MultipleTopLevelClasses\] .+"]},
+         'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
+     'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
@@ -603,13 +763,8 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
-         'Java: Package names should match the directory they are declared in',
-     'patterns': [r".*: warning: \[PackageLocation\] .+"]},
-    {'category': 'java',
-     'severity': Severity.MEDIUM,
-     'description':
-         'Java: Second argument to Preconditions.* is a call to String.format(), which can be unwrapped',
-     'patterns': [r".*: warning: \[PreconditionsErrorMessageEagerEvaluation\] .+"]},
+         'Java: Use grouping parenthesis to make the operator precedence explicit',
+     'patterns': [r".*: warning: \[OperatorPrecedence\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
@@ -628,6 +783,16 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
+         'Java: Thrown exception is a subtype of another',
+     'patterns': [r".*: warning: \[RedundantThrows\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Comparison using reference equality instead of value equality',
+     'patterns': [r".*: warning: \[ReferenceEquality\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
          'Java: This annotation is missing required modifiers as specified by its @RequiredModifiers annotation',
      'patterns': [r".*: warning: \[RequiredModifiers\] .+"]},
     {'category': 'java',
@@ -643,13 +808,18 @@
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
-         'Java: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
-     'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
+         'Java: Truth Library assert is called on a constant.',
+     'patterns': [r".*: warning: \[TruthConstantAsserts\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
-         'Java: Using static imports for types is unnecessary',
-     'patterns': [r".*: warning: \[UnnecessaryStaticImport\] .+"]},
+         'Java: An object is tested for equality to itself using Truth Libraries.',
+     'patterns': [r".*: warning: \[TruthSelfEquals\] .+"]},
+    {'category': 'java',
+     'severity': Severity.MEDIUM,
+     'description':
+         'Java: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.',
+     'patterns': [r".*: warning: \[TypeParameterUnusedInFormals\] .+"]},
     {'category': 'java',
      'severity': Severity.MEDIUM,
      'description':
@@ -666,50 +836,180 @@
          'Java: Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop',
      'patterns': [r".*: warning: \[WaitNotInLoop\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor',
-     'patterns': [r".*: warning: \[FragmentNotInstantiable\] .+"]},
+         'Java: Log tag too long, cannot exceed 23 characters.',
+     'patterns': [r".*: warning: \[IsLoggableTagLength\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: Hardcoded reference to /sdcard',
-     'patterns': [r".*: warning: \[HardCodedSdCardPath\] .+"]},
+         'Java: Certain resources in `android.R.string` have names that do not match their content',
+     'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Return value of android.graphics.Rect.intersect() must be checked',
+     'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Static and default methods in interfaces are not allowed in android builds.',
+     'patterns': [r".*: warning: \[StaticOrDefaultInterfaceMethod\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
      'description':
          'Java: Incompatible type as argument to Object-accepting Java collections method',
      'patterns': [r".*: warning: \[CollectionIncompatibleType\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: @AssistedInject and @Inject should not be used on different constructors in the same class.',
-     'patterns': [r".*: warning: \[AssistedInjectAndInjectOnConstructors\] .+"]},
+         'Java: @CompatibleWith\'s value is not a type argument.',
+     'patterns': [r".*: warning: \[CompatibleWithAnnotationMisuse\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: Although Guice allows injecting final fields, doing so is not recommended because the injected value may not be visible to other threads.',
+         'Java: Passing argument to a generic method with an incompatible type.',
+     'patterns': [r".*: warning: \[IncompatibleArgumentType\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Invalid printf-style format string',
+     'patterns': [r".*: warning: \[FormatString\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Invalid format string passed to formatting method.',
+     'patterns': [r".*: warning: \[FormatStringAnnotation\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
+     'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: @AutoFactory and @Inject should not be used in the same type.',
+     'patterns': [r".*: warning: \[AutoFactoryAtInject\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Injected constructors cannot be optional nor have binding annotations',
+     'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: A scoping annotation\'s Target should include TYPE and METHOD.',
+     'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Abstract and default methods are not injectable with javax.inject.Inject',
+     'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: @javax.inject.Inject cannot be put on a final field.',
+     'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.',
+     'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Using more than one qualifier annotation on the same element is not allowed.',
+     'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: A class can be annotated with at most one scope annotation.',
+     'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.',
+     'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Qualifier applied to a method that isn\'t a @Provides method. This method won\'t be used for dependency injection',
+     'patterns': [r".*: warning: \[QualifierOnMethodWithoutProvides\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Scope annotation on an interface or abstact class is not allowed',
+     'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Scoping and qualifier annotations must have runtime retention.',
+     'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: `@Multibinds` is the new way to declare multibindings.',
+     'patterns': [r".*: warning: \[MultibindsInsteadOfMultibindings\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
+     'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
+     'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.',
+     'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.',
      'patterns': [r".*: warning: \[GuiceInjectOnFinalField\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly.',
-     'patterns': [r".*: warning: \[OverridesGuiceInjectableMethod\] .+"]},
+         'Java: This method is not annotated with @Inject, but it overrides a method that is  annotated with @javax.inject.Inject. The method will not be Injected.',
+     'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: Double-checked locking on non-volatile fields is unsafe',
-     'patterns': [r".*: warning: \[DoubleCheckedLocking\] .+"]},
+         'Java: @Provides methods need to be declared in a Module to have any effect.',
+     'patterns': [r".*: warning: \[ProvidesMethodOutsideOfModule\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: Writes to static fields should not be guarded by instance locks',
-     'patterns': [r".*: warning: \[StaticGuardedByInstance\] .+"]},
+         'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
+     'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
     {'category': 'java',
-     'severity': Severity.MEDIUM,
+     'severity': Severity.HIGH,
      'description':
-         'Java: Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.',
-     'patterns': [r".*: warning: \[SynchronizeOnNonFinalField\] .+"]},
+         'Java: Invalid @GuardedBy expression',
+     'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Type declaration annotated with @Immutable is not immutable',
+     'patterns': [r".*: warning: \[Immutable\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: This method does not acquire the locks specified by its @LockMethod annotation',
+     'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
+     'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: An argument is more similar to a different parameter; the arguments may have been swapped.',
+     'patterns': [r".*: warning: \[ArgumentParameterSwap\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
@@ -724,7 +1024,7 @@
      'severity': Severity.HIGH,
      'description':
          'Java: Calling toString on an array does not provide useful information',
-     'patterns': [r".*: warning: \[ArrayToString.*\] .+"]},
+     'patterns': [r".*: warning: \[ArrayToString\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
@@ -743,21 +1043,11 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Possible sign flip from narrowing conversion',
-     'patterns': [r".*: warning: \[BadComparable\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
          'Java: Shift by an amount that is out of range',
      'patterns': [r".*: warning: \[BadShiftAmount\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: valueOf provides better time and space performance',
-     'patterns': [r".*: warning: \[BoxedPrimitiveConstructor\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
          'Java: The called constructor accepts a parameter with the same name and type as one of its caller\'s parameters, but its caller doesn\'t pass that parameter to it.  It\'s likely that it was intended to.',
      'patterns': [r".*: warning: \[ChainingConstructorIgnoresParameter\] .+"]},
     {'category': 'java',
@@ -768,11 +1058,6 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Inner class is non-static but does not reference enclosing class',
-     'patterns': [r".*: warning: \[ClassCanBeStatic\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
          'Java: The source file name should match the name of the top-level class it contains',
      'patterns': [r".*: warning: \[ClassName\] .+"]},
     {'category': 'java',
@@ -793,6 +1078,11 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
+         'Java: Compile-time constant expression overflows',
+     'patterns': [r".*: warning: \[ConstantOverflow\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
          'Java: Exception created but not thrown',
      'patterns': [r".*: warning: \[DeadException\] .+"]},
     {'category': 'java',
@@ -818,11 +1108,21 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
+         'Java: Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users.  Prefer decorator methods to this surprising behavior.',
+     'patterns': [r".*: warning: \[FunctionalInterfaceMethodChanged\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
          'Java: Futures.getChecked requires a checked exception type with a standard constructor.',
      'patterns': [r".*: warning: \[FuturesGetCheckedIllegalExceptionType\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
+         'Java: Calling getClass() on an annotation may return a proxy class',
+     'patterns': [r".*: warning: \[GetClassOnAnnotation\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
          'Java: Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly',
      'patterns': [r".*: warning: \[GetClassOnClass\] .+"]},
     {'category': 'java',
@@ -838,8 +1138,23 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Cipher.getInstance() is invoked using either the default settings or ECB mode',
-     'patterns': [r".*: warning: \[InsecureCipherMode\] .+"]},
+         'Java: Writing "a && a", "a || a", "a & a", or "a | a" is equivalent to "a".',
+     'patterns': [r".*: warning: \[IdentityBinaryExpression\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: Modifying an immutable collection is guaranteed to throw an exception and leave the collection unmodified',
+     'patterns': [r".*: warning: \[ImmutableModification\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: This method always recurses, and will cause a StackOverflowError',
+     'patterns': [r".*: warning: \[InfiniteRecursion\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
+         'Java: A standard cryptographic operation is used in a mode that is prone to vulnerabilities',
+     'patterns': [r".*: warning: \[InsecureCryptoUsage\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
@@ -878,11 +1193,6 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Printf-like format string does not match its arguments',
-     'patterns': [r".*: warning: \[MalformedFormatString\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
          'Java: Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.',
      'patterns': [r".*: warning: \[MisusedWeekYear\] .+"]},
     {'category': 'java',
@@ -898,16 +1208,11 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Modifying a collection with itself',
+         'Java: Using a collection function with itself as the argument.',
      'patterns': [r".*: warning: \[ModifyingCollectionWithItself\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Compound assignments to bytes, shorts, chars, and floats hide dangerous casts',
-     'patterns': [r".*: warning: \[NarrowingCompoundAssignment\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
          'Java: @NoAllocation was specified on this method, but something was found that would trigger an allocation',
      'patterns': [r".*: warning: \[NoAllocation\] .+"]},
     {'category': 'java',
@@ -918,7 +1223,7 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: @CompileTimeConstant parameters should be final',
+         'Java: @CompileTimeConstant parameters should be final or effectively final',
      'patterns': [r".*: warning: \[NonFinalCompileTimeConstant\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
@@ -943,6 +1248,11 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
+         'Java: Declaring types inside package-info.java files is very bad form',
+     'patterns': [r".*: warning: \[PackageInfo\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
          'Java: Literal passed as first argument to Preconditions.checkNotNull() can never be null',
      'patterns': [r".*: warning: \[PreconditionsCheckNotNull\] .+"]},
     {'category': 'java',
@@ -963,6 +1273,11 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
+         'Java: Use Random.nextInt(int).  Random.nextInt() % n can have negative results',
+     'patterns': [r".*: warning: \[RandomModInteger\] .+"]},
+    {'category': 'java',
+     'severity': Severity.HIGH,
+     'description':
          'Java:  Check for non-whitelisted callers to RestrictedApiChecker.',
      'patterns': [r".*: warning: \[RestrictedApiChecker\] .+"]},
     {'category': 'java',
@@ -979,7 +1294,7 @@
      'severity': Severity.HIGH,
      'description':
          'Java: An object is compared to itself',
-     'patterns': [r".*: warning: \[SelfComparision\] .+"]},
+     'patterns': [r".*: warning: \[SelfComparison\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
@@ -1038,128 +1353,15 @@
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
-         'Java: Use of wildcard imports is forbidden',
-     'patterns': [r".*: warning: \[WildcardImport\] .+"]},
+         'Java: Collection is modified in place, but the result is not used',
+     'patterns': [r".*: warning: \[UnusedCollectionModifiedInPlace\] .+"]},
     {'category': 'java',
      'severity': Severity.HIGH,
      'description':
          'Java: Method parameter has wrong package',
      'patterns': [r".*: warning: \[ParameterPackage\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Certain resources in `android.R.string` have names that do not match their content',
-     'patterns': [r".*: warning: \[MislabeledAndroidString\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Return value of android.graphics.Rect.intersect() must be checked',
-     'patterns': [r".*: warning: \[RectIntersectReturnValueIgnored\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Invalid printf-style format string',
-     'patterns': [r".*: warning: \[FormatString\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: @AssistedInject and @Inject cannot be used on the same constructor.',
-     'patterns': [r".*: warning: \[AssistedInjectAndInjectOnSameConstructor\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Injected constructors cannot be optional nor have binding annotations',
-     'patterns': [r".*: warning: \[InjectedConstructorAnnotations\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: The target of a scoping annotation must be set to METHOD and/or TYPE.',
-     'patterns': [r".*: warning: \[InjectInvalidTargetingOnScopingAnnotation\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Abstract methods are not injectable with javax.inject.Inject.',
-     'patterns': [r".*: warning: \[JavaxInjectOnAbstractMethod\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: @javax.inject.Inject cannot be put on a final field.',
-     'patterns': [r".*: warning: \[JavaxInjectOnFinalField\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: A class may not have more than one injectable constructor.',
-     'patterns': [r".*: warning: \[MoreThanOneInjectableConstructor\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Using more than one qualifier annotation on the same element is not allowed.',
-     'patterns': [r".*: warning: \[InjectMoreThanOneQualifier\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: A class can be annotated with at most one scope annotation',
-     'patterns': [r".*: warning: \[InjectMoreThanOneScopeAnnotationOnClass\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Annotations cannot be both Qualifiers/BindingAnnotations and Scopes',
-     'patterns': [r".*: warning: \[OverlappingQualifierAndScopeAnnotation\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Scope annotation on an interface or abstact class is not allowed',
-     'patterns': [r".*: warning: \[InjectScopeAnnotationOnInterfaceOrAbstractClass\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Scoping and qualifier annotations must have runtime retention.',
-     'patterns': [r".*: warning: \[InjectScopeOrQualifierAnnotationRetention\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Dagger @Provides methods may not return null unless annotated with @Nullable',
-     'patterns': [r".*: warning: \[DaggerProvidesNull\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Scope annotation on implementation class of AssistedInject factory is not allowed',
-     'patterns': [r".*: warning: \[GuiceAssistedInjectScoping\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. ',
-     'patterns': [r".*: warning: \[GuiceAssistedParameters\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: This method is not annotated with @Inject, but it overrides a  method that is  annotated with @javax.inject.Inject.',
-     'patterns': [r".*: warning: \[OverridesJavaxInjectableMethod\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Checks for unguarded accesses to fields and methods with @GuardedBy annotations',
-     'patterns': [r".*: warning: \[GuardedByChecker\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Invalid @GuardedBy expression',
-     'patterns': [r".*: warning: \[GuardedByValidator\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: Type declaration annotated with @Immutable is not immutable',
-     'patterns': [r".*: warning: \[Immutable\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: This method does not acquire the locks specified by its @LockMethod annotation',
-     'patterns': [r".*: warning: \[LockMethodChecker\] .+"]},
-    {'category': 'java',
-     'severity': Severity.HIGH,
-     'description':
-         'Java: This method does not acquire the locks specified by its @UnlockMethod annotation',
-     'patterns': [r".*: warning: \[UnlockMethod\] .+"]},
+
+    # End warnings generated by Error Prone
 
     {'category': 'java',
      'severity': Severity.UNKNOWN,