Merge "Add license metadata declarations which are moved from device/google/redfin/Android.mk." into main
diff --git a/CleanSpec.mk b/CleanSpec.mk
index dfc0cd0..19fc639 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -779,6 +779,10 @@
 # Clear out rustc compiler intermediates after reverting rust compiler/linker split.
 $(call add-clean-step, find $(OUT_DIR) -name "*.rsp.whole.a" -print0 | xargs -0 /bin/bash -c 'rm -f $$$${@}; rm -f $$$${@/.rsp.whole.a/.rsp.a}; rm -f $$$${@/.rsp.whole.a/.rsp}')
 
+# Remove obsolete java compilation artifacts
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/)
+$(call add-clean-step, find $(OUT_DIR) -type f -name "*.jar" -print0 | xargs -0 rm -f)
+
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/core/product.mk b/core/product.mk
index f8634ef..0a761fb 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -418,8 +418,9 @@
 # /system/etc/security/fsverity/BuildManifest.apk
 _product_single_value_vars += PRODUCT_FSVERITY_GENERATE_METADATA
 
-# If true, sets the default for MODULE_BUILD_FROM_SOURCE. This overrides
-# BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE but not an explicitly set value.
+# If true, this builds the mainline modules from source. This overrides any
+# prebuilts selected via RELEASE_APEX_CONTRIBUTIONS_* build flags for the
+# current release config.
 _product_single_value_vars += PRODUCT_MODULE_BUILD_FROM_SOURCE
 
 # If true, installs a full version of com.android.virt APEX.
diff --git a/envsetup.sh b/envsetup.sh
index 1ef9a54..50fec51 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1112,8 +1112,8 @@
   local tool_binary="$1"
   shift
 
-  # If logging is not enabled or the logger is not configured, run the original command and return.
-  if [[ "${ANDROID_ENABLE_TOOL_LOGGING}" != "true" ]] || [[ -z "${ANDROID_TOOL_LOGGER}" ]]; then
+  # If the logger is not configured, run the original command and return.
+  if [[ -z "${ANDROID_TOOL_LOGGER}" ]]; then
      "${tool_binary}" "${@}"
      return $?
   fi
diff --git a/target/product/module_common.mk b/target/product/module_common.mk
index bf146a0..da4ea23 100644
--- a/target/product/module_common.mk
+++ b/target/product/module_common.mk
@@ -24,8 +24,9 @@
 # uses -DENFORCE_VINTF_MANIFEST. See b/185759877
 PRODUCT_SHIPPING_API_LEVEL := 29
 
-# Builds using a module product should build modules from source, even if
-# BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE says otherwise.
+# If true, this builds the mainline modules from source. This overrides any
+# prebuilts selected via RELEASE_APEX_CONTRIBUTIONS_* build flags for the
+# current release config.
 PRODUCT_MODULE_BUILD_FROM_SOURCE := true
 
 # Build sdk from source if the branch is not using slim manifests.
diff --git a/tests/run_tool_with_logging_test.py b/tests/run_tool_with_logging_test.py
index 215d992..18abd8e 100644
--- a/tests/run_tool_with_logging_test.py
+++ b/tests/run_tool_with_logging_test.py
@@ -59,37 +59,10 @@
     self.working_dir.cleanup()
     super().tearDown()
 
-  def test_does_not_log_when_logging_disabled(self):
-    test_tool = TestScript.create(self.working_dir)
-    test_logger = TestScript.create(self.working_dir)
-
-    self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=false
-      ANDROID_TOOL_LOGGER="{test_logger.executable}"
-      run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
-    """)
-
-    test_tool.assert_called_once_with_args("arg1 arg2")
-    test_logger.assert_not_called()
-
-  def test_does_not_log_when_logger_var_unset(self):
-    test_tool = TestScript.create(self.working_dir)
-    test_logger = TestScript.create(self.working_dir)
-
-    self._run_script_and_wait(f"""
-      unset ANDROID_ENABLE_TOOL_LOGGING
-      ANDROID_TOOL_LOGGER="{test_logger.executable}"
-      run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
-    """)
-
-    test_tool.assert_called_once_with_args("arg1 arg2")
-    test_logger.assert_not_called()
-
   def test_does_not_log_when_logger_var_empty(self):
     test_tool = TestScript.create(self.working_dir)
 
     self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER=""
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -100,7 +73,6 @@
     test_tool = TestScript.create(self.working_dir)
 
     self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       unset ANDROID_TOOL_LOGGER
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -112,7 +84,6 @@
     test_logger = TestScript.create(self.working_dir)
 
     self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -130,7 +101,6 @@
 
     run_tool_with_logging_stdout, run_tool_with_logging_stderr = (
         self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -138,7 +108,6 @@
 
     run_tool_without_logging_stdout, run_tool_without_logging_stderr = (
         self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
       {test_tool.executable} arg1 arg2
     """)
@@ -156,7 +125,6 @@
     test_logger = TestScript.create(self.working_dir, "echo 'logger called'")
 
     run_tool_with_logging_output, _ = self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -170,7 +138,6 @@
     )
 
     _, err = self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -182,7 +149,6 @@
     test_logger = TestScript.create(self.working_dir)
 
     process = self._run_script_in_build_env(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
@@ -207,9 +173,8 @@
     test_logger = TestScript.create(self.working_dir)
 
     self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=false
+      ANDROID_TOOL_LOGGER=""
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
-      ANDROID_ENABLE_TOOL_LOGGING=true
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
 
@@ -220,9 +185,8 @@
     test_logger = TestScript.create(self.working_dir)
 
     self._run_script_and_wait(f"""
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{test_logger.executable}"
-      ANDROID_ENABLE_TOOL_LOGGING=false
+      ANDROID_TOOL_LOGGER=""
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
     """)
 
@@ -234,7 +198,6 @@
 
     self._run_script_and_wait(f"""
       TMPDIR="{self.working_dir.name}"
-      ANDROID_ENABLE_TOOL_LOGGING=true
       ANDROID_TOOL_LOGGER="{logger_path}"
       ANDROID_TOOL_LOGGER_EXTRA_ARGS="--dry_run"
       run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2