Merge "Remove generation of the dexpreopt tool paths from make."
diff --git a/core/definitions.mk b/core/definitions.mk
index 20b8cf6..ff435e2 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2628,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 $$@
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/target/product/base_system.mk b/target/product/base_system.mk
index 6d134dd..2895801 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 \
@@ -331,8 +333,6 @@
     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.tethering:framework-tethering
 
 PRODUCT_COPY_FILES += \
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/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/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',