Merge "Mark BUILD_HOST_EXECUTABLE as deprecated"
diff --git a/core/Makefile b/core/Makefile
index 0aa06d9..c862e97 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -16,7 +16,28 @@
 define check-product-copy-files
 $(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
   $(if $(filter %.apk, $(2)),$(error \
-     Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
+     Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))) \
+$(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \
+  $(if $(filter $(TARGET_COPY_OUT_SYSTEM)/etc/vintf/% \
+                $(TARGET_COPY_OUT_SYSTEM)/manifest.xml \
+                $(TARGET_COPY_OUT_SYSTEM)/compatibility_matrix.xml,$(2)), \
+    $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), use vintf_fragments instead!)) \
+  $(if $(filter $(TARGET_COPY_OUT_PRODUCT)/etc/vintf/%,$(2)), \
+    $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+      use PRODUCT_MANIFEST_FILES / DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
+  $(if $(filter $(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/%,$(2)), \
+    $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+      use vintf_compatibility_matrix / vintf_fragments instead!)) \
+  $(if $(filter $(TARGET_COPY_OUT_VENDOR)/etc/vintf/% \
+                $(TARGET_COPY_OUT_VENDOR)/manifest.xml \
+                $(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml,$(2)), \
+    $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+      use DEVICE_MANIFEST_FILE / DEVICE_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
+  $(if $(filter $(TARGET_COPY_OUT_ODM)/etc/vintf/% \
+                $(TARGET_COPY_OUT_ODM)/etc/manifest%,$(2)), \
+    $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
+      use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
+)
 endef
 # filter out the duplicate <source file>:<dest file> pairs.
 unique_product_copy_files_pairs :=
@@ -3809,6 +3830,7 @@
   mkbootfs \
   mkbootimg \
   mke2fs \
+  mke2fs.conf \
   mkf2fsuserimg.sh \
   mksquashfs \
   mksquashfsimage.sh \
diff --git a/core/board_config.mk b/core/board_config.mk
index 63d7e07..5d658dc 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -87,10 +87,11 @@
 
 _build_broken_var_list := \
   BUILD_BROKEN_DUP_RULES \
+  BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
   BUILD_BROKEN_PREBUILT_ELF_FILES \
   BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
   BUILD_BROKEN_USES_NETWORK \
-  BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
+  BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
 
 _build_broken_var_list += \
   $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index c880971..ccbc907 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -24,9 +24,6 @@
 # Enable updating of APEXes
 $(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
 
-# Mainline devices support userspace reboot
-$(call inherit-product, $(SRC_TARGET_DIR)/product/userspace_reboot.mk)
-
 # Shared java libs
 PRODUCT_PACKAGES += \
     com.android.nfc_extras \
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 113f78b..cf10386 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -133,7 +133,6 @@
     arguments_dict = {
         'manifest': os.path.join(apex_dir, 'apex_manifest.pb'),
         'build_info': os.path.join(apex_dir, 'apex_build_info.pb'),
-        'assets_dir': os.path.join(apex_dir, 'assets'),
         'android_jar_path': android_jar_path,
         'key': payload_key,
         'pubkey': payload_public_key,
@@ -156,10 +155,16 @@
     for key, val in arguments_dict.items():
       repack_cmd.append('--' + key)
       repack_cmd.append(val)
+    # optional arguments for apex repacking
     manifest_json = os.path.join(apex_dir, 'apex_manifest.json')
     if os.path.exists(manifest_json):
       repack_cmd.append('--manifest_json')
       repack_cmd.append(manifest_json)
+    assets_dir = os.path.join(apex_dir, 'assets')
+    if os.path.isdir(assets_dir):
+      repack_cmd.append('--assets_dir')
+      repack_cmd.append(assets_dir)
+
     repack_cmd.append(payload_dir)
     repack_cmd.append(repacked_apex)
     common.RunAndCheckOutput(repack_cmd)
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index df61ac0..cc28f3f 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -16,6 +16,7 @@
 
 import os
 import os.path
+import zipfile
 
 import apex_utils
 import common
@@ -155,3 +156,23 @@
     payload_pubkey = common.ExtractAvbPublicKey('avbtool',
                                                 self.payload_key)
     signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
+
+  @test_utils.SkipIfExternalToolsUnavailable()
+  def test_ApexApkSigner_noAssetDir(self):
+    apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+    no_asset = common.MakeTempFile(suffix='.apex')
+    with zipfile.ZipFile(no_asset, 'w') as output_zip:
+      with zipfile.ZipFile(apex_path, 'r') as input_zip:
+        name_list = input_zip.namelist()
+        for name in name_list:
+          if not name.startswith('assets'):
+            output_zip.writestr(name, input_zip.read(name))
+
+    signer = apex_utils.ApexApkSigner(no_asset, None, None)
+    apk_keys = {'wifi-service-resources.apk': os.path.join(
+        self.testdata_dir, 'testkey')}
+
+    self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+    payload_pubkey = common.ExtractAvbPublicKey('avbtool',
+                                                self.payload_key)
+    signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
diff --git a/tools/warn/cpp_warn_patterns.py b/tools/warn/cpp_warn_patterns.py
index 0c458fb..65ce73a 100644
--- a/tools/warn/cpp_warn_patterns.py
+++ b/tools/warn/cpp_warn_patterns.py
@@ -435,6 +435,30 @@
            [r".*: warning: template argument.+Wunnamed-type-template-args"]),
     medium('Unannotated fall-through between switch labels',
            [r".*: warning: unannotated fall-through between switch labels.+Wimplicit-fallthrough"]),
+    medium('Invalid partial specialization',
+           [r".*: warning: class template partial specialization.+Winvalid-partial-specialization"]),
+    medium('Overlapping compatisons',
+           [r".*: warning: overlapping comparisons.+Wtautological-overlap-compare"]),
+    medium('int in bool context',
+           [r".*: warning: converting.+to a boolean.+Wint-in-bool-context"]),
+    medium('bitwise conditional parentheses',
+           [r".*: warning: operator.+has lower precedence.+Wbitwise-conditional-parentheses"]),
+    medium('sizeof array div',
+           [r".*: warning: .+number of elements in.+array.+Wsizeof-array-div"]),
+    medium('bool operation',
+           [r".*: warning: .+boolean.+always.+Wbool-operation"]),
+    medium('Undefined bool conversion',
+           [r".*: warning: .+may be.+always.+true.+Wundefined-bool-conversion"]),
+    medium('Typedef requires a name',
+           [r".*: warning: typedef requires a name.+Wmissing-declaration"]),
+    medium('Unknown escape sequence',
+           [r".*: warning: unknown escape sequence.+Wunknown-escape-sequence"]),
+    medium('Unicode whitespace',
+           [r".*: warning: treating Unicode.+as whitespace.+Wunicode-whitespace"]),
+    medium('Unused local typedef',
+           [r".*: warning: unused typedef.+Wunused-local-typedef"]),
+    medium('varargs warnings',
+           [r".*: warning: .*argument to 'va_start'.+\[-Wvarargs\]"]),
     harmless('Discarded qualifier from pointer target type',
              [r".*: warning: .+ discards '.+' qualifier from pointer target type"]),
     harmless('Use snprintf instead of sprintf',
diff --git a/tools/warn/java_warn_patterns.py b/tools/warn/java_warn_patterns.py
index 0a443d4..96510b4 100644
--- a/tools/warn/java_warn_patterns.py
+++ b/tools/warn/java_warn_patterns.py
@@ -38,6 +38,10 @@
   return java_warn(Severity.MEDIUM, description, pattern_list)
 
 
+def java_medium_type(name):
+  return java_medium(name, [r'.*\.java:.*: warning: .+ \[' + name + r'\]$'])
+
+
 def java_low(description, pattern_list):
   return java_warn(Severity.LOW, description, pattern_list)
 
@@ -457,6 +461,13 @@
                 [r".*: warning: \[WaitNotInLoop\] .+"]),
     java_medium('A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block.',
                 [r".*: warning: \[WakelockReleasedDangerously\] .+"]),
+    java_medium_type('CallbackName'),
+    java_medium_type('ExecutorRegistration'),
+    java_medium_type('ListenerLast'),
+    java_medium_type('MissingBuildMethod'),
+    java_medium_type('NoByteOrShort'),
+    java_medium_type('SetterReturnsThis'),
+    java_medium_type('UseIcu'),
     java_high('AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()',
               [r".*: warning: \[AndroidInjectionBeforeSuper\] .+"]),
     java_high('Use of class, field, or method that is not compatible with legacy Android devices',