Merge "Use --sysroot when compiling against the NDK" into main
diff --git a/ci/Android.bp b/ci/Android.bp
index 6d4ac35..0dfbd37 100644
--- a/ci/Android.bp
+++ b/ci/Android.bp
@@ -102,6 +102,7 @@
         "optimized_targets.py",
         "test_mapping_module_retriever.py",
         "build_context.py",
+        "test_discovery_agent.py",
     ],
 }
 
diff --git a/ci/test_discovery_agent.py b/ci/test_discovery_agent.py
new file mode 100644
index 0000000..89d35d7
--- /dev/null
+++ b/ci/test_discovery_agent.py
@@ -0,0 +1,46 @@
+# Copyright 2024, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+class TestDiscoveryAgent:
+  """Test discovery agent."""
+
+  _AOSP_TRADEFED_PREBUILT_JAR_RELATIVE_PATH = (
+      "tools/tradefederation/prebuilts/filegroups/tradefed/"
+  )
+
+  def __init__(
+      self,
+      tradefed_args: list[str],
+      test_mapping_zip_path: str,
+      tradefed_jar_revelant_files_path: str = _AOSP_TRADEFED_PREBUILT_JAR_RELATIVE_PATH,
+  ):
+    self.tradefed_args = tradefed_args
+    self.test_mapping_zip_path = test_mapping_zip_path
+    self.tradefed_jar_relevant_files_path = tradefed_jar_revelant_files_path
+
+  def discover_test_zip_regexes(self) -> list[str]:
+    """Discover test zip regexes from TradeFed.
+
+    Returns:
+      A list of test zip regexes that TF is going to try to pull files from.
+    """
+    return []
+
+  def discover_test_modules(self) -> list[str]:
+    """Discover test modules from TradeFed.
+
+    Returns:
+      A list of test modules that TradeFed is going to execute based on the
+      TradeFed test args.
+    """
+    return []
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 06dc54c..e5a8e44 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -30,13 +30,18 @@
 $(call soong_config_set_bool,ANDROID,BOARD_USES_RECOVERY_AS_BOOT,$(BOARD_USES_RECOVERY_AS_BOOT))
 $(call soong_config_set_bool,ANDROID,BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT,$(BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT))
 $(call add_soong_config_var,ANDROID,CHECK_DEV_TYPE_VIOLATIONS)
+$(call soong_config_set_bool,ANDROID,HAS_BOARD_SYSTEM_EXT_PREBUILT_DIR,$(if $(BOARD_SYSTEM_EXT_PREBUILT_DIR),true,false))
+$(call soong_config_set_bool,ANDROID,HAS_BOARD_PRODUCT_PREBUILT_DIR,$(if $(BOARD_PRODUCT_PREBUILT_DIR),true,false))
 $(call add_soong_config_var,ANDROID,PLATFORM_SEPOLICY_VERSION)
 $(call add_soong_config_var,ANDROID,PLATFORM_SEPOLICY_COMPAT_VERSIONS)
 $(call add_soong_config_var,ANDROID,PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT)
+$(call soong_config_set_bool,ANDROID,RELEASE_BOARD_API_LEVEL_FROZEN,$(RELEASE_BOARD_API_LEVEL_FROZEN))
 $(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_DRMSERVER)
 $(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64)
 $(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_MEDIASERVER)
 
+$(call add_soong_config_var,ANDROID,ADDITIONAL_M4DEFS,$(if $(BOARD_SEPOLICY_M4DEFS),$(addprefix -D,$(BOARD_SEPOLICY_M4DEFS))))
+
 # For Sanitizers
 $(call soong_config_set_bool,ANDROID,ASAN_ENABLED,$(if $(filter address,$(SANITIZE_TARGET)),true,false))
 $(call soong_config_set_bool,ANDROID,HWASAN_ENABLED,$(if $(filter hwaddress,$(SANITIZE_TARGET)),true,false))
@@ -208,3 +213,11 @@
 # Export board_uses_scaler_m2m1shot and board_uses_align_restriction to soong for hardware/google/graphics/common/libscaler:libexynosscaler
 $(call soong_config_set_bool,google_graphics,board_uses_scaler_m2m1shot,$(if $(filter true,$(BOARD_USES_SCALER_M2M1SHOT)),true,false))
 $(call soong_config_set_bool,google_graphics,board_uses_align_restriction,$(if $(filter true,$(BOARD_USES_ALIGN_RESTRICTION)),true,false))
+
+# Export video_codec variables to soong for exynos modules
+$(call soong_config_set,video_codec,target_soc_name,$(TARGET_SOC_NAME))
+$(call soong_config_set_bool,video_codec,board_use_codec2_hidl_1_2,$(if $(filter true,$(BOARD_USE_CODEC2_HIDL_1_2)),true,false))
+$(call soong_config_set_bool,video_codec,board_support_mfc_enc_bt2020,$(if $(filter true,$(BOARD_SUPPORT_MFC_ENC_BT2020)),true,false))
+$(call soong_config_set_bool,video_codec,board_support_flexible_p010,$(if $(filter true,$(BOARD_SUPPORT_FLEXIBLE_P010)),true,false))
+$(call soong_config_set,video_codec,board_support_mfc_version,$(BOARD_SUPPORT_MFC_VERSION))
+$(call soong_config_set_bool,video_codec,board_use_codec2_aidl,$(if $(BOARD_USE_CODEC2_AIDL),true,false))
diff --git a/core/main.mk b/core/main.mk
index 5bbe1b1..6095587 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -981,7 +981,9 @@
 # Returns modules included automatically as a result of certain BoardConfig
 # variables being set.
 define auto-included-modules
-  llndk_in_system \
+  $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),com.android.vndk.v$(vndk_ver)) \
+  $(filter-out $(LLNDK_MOVED_TO_APEX_LIBRARIES),$(LLNDK_LIBRARIES)) \
+  llndk.libraries.txt \
   $(if $(DEVICE_MANIFEST_FILE),vendor_manifest.xml) \
   $(if $(DEVICE_MANIFEST_SKUS),$(foreach sku, $(DEVICE_MANIFEST_SKUS),vendor_manifest_$(sku).xml)) \
   $(if $(ODM_MANIFEST_FILES),odm_manifest.xml) \
diff --git a/core/robolectric_test_config_template.xml b/core/robolectric_test_config_template.xml
index b1d0c2f..257c820 100644
--- a/core/robolectric_test_config_template.xml
+++ b/core/robolectric_test_config_template.xml
@@ -33,5 +33,15 @@
         <option name="java-flags" value="--add-opens=java.base/jdk.internal.util.random=ALL-UNNAMED"/>
         <!-- b/251387255 -->
         <option name="java-flags" value="--add-opens=java.base/java.io=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=java.base/java.net=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=java.base/java.nio=ALL-UNNAMED"/> <!-- required for ShadowVMRuntime -->
+        <option name="java-flags" value="--add-opens=java.base/java.security=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=java.base/java.text=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=java.base/java.util=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=java.base/jdk.internal.access=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=java.desktop/java.awt.font=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+        <option name="java-flags" value="--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
     </test>
 </configuration>
diff --git a/core/soong_config.mk b/core/soong_config.mk
index aaeb70f..8c57ce6 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -316,6 +316,8 @@
 
 $(call add_json_str,  ProductManufacturer, $(PRODUCT_MANUFACTURER))
 $(call add_json_str,  ProductBrand,        $(PRODUCT_BRAND))
+$(call add_json_str,  ProductDevice,       $(PRODUCT_DEVICE))
+$(call add_json_str,  ProductModel,        $(PRODUCT_MODEL))
 
 $(call add_json_str, ReleaseVersion,    $(_RELEASE_VERSION))
 $(call add_json_list, ReleaseAconfigValueSets,    $(RELEASE_ACONFIG_VALUE_SETS))
diff --git a/target/product/gsi/Android.mk b/core/tasks/check-abi-dump-list.mk
similarity index 81%
rename from target/product/gsi/Android.mk
rename to core/tasks/check-abi-dump-list.mk
index 7291059..81d549e 100644
--- a/target/product/gsi/Android.mk
+++ b/core/tasks/check-abi-dump-list.mk
@@ -1,4 +1,16 @@
-LOCAL_PATH:= $(call my-dir)
+# Copyright (C) 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 
 #####################################################################
 # Check the generate list against the latest list stored in the
@@ -109,32 +121,3 @@
 	$(if $(added_vndk_abi_dumps)$(added_platform_abi_dumps),exit 1)
 	$(hide) mkdir -p $(dir $@)
 	$(hide) touch $@
-
-#####################################################################
-# VNDK package and snapshot.
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := vndk_apex_snapshot_package
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),com.android.vndk.v$(vndk_ver))
-include $(BUILD_PHONY_PACKAGE)
-
-#####################################################################
-# Define Phony module to install LLNDK modules which are installed in
-# the system image
-include $(CLEAR_VARS)
-LOCAL_MODULE := llndk_in_system
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-
-# Filter LLNDK libs moved to APEX to avoid pulling them into /system/LIB
-LOCAL_REQUIRED_MODULES := \
-    $(filter-out $(LLNDK_MOVED_TO_APEX_LIBRARIES),$(LLNDK_LIBRARIES)) \
-    llndk.libraries.txt
-
-
-include $(BUILD_PHONY_PACKAGE)
diff --git a/shell_utils.sh b/shell_utils.sh
index c4a6756..9053c42 100644
--- a/shell_utils.sh
+++ b/shell_utils.sh
@@ -178,11 +178,11 @@
         echo -n "${color_failed}#### failed to build some targets "
     fi
     if [ $hours -gt 0 ] ; then
-        printf "(%02g:%02g:%02g (hh:mm:ss))" $hours $mins $secs
+        printf "(%02d:%02d:%02d (hh:mm:ss))" $hours $mins $secs
     elif [ $mins -gt 0 ] ; then
-        printf "(%02g:%02g (mm:ss))" $mins $secs
+        printf "(%02d:%02d (mm:ss))" $mins $secs
     elif [ $secs -gt 0 ] ; then
-        printf "(%s seconds)" $secs
+        printf "(%d seconds)" $secs
     fi
     echo " ####${color_reset}"
     echo
diff --git a/target/product/generic/Android.bp b/target/product/generic/Android.bp
index c14fa17..f86774b 100644
--- a/target/product/generic/Android.bp
+++ b/target/product/generic/Android.bp
@@ -76,6 +76,49 @@
         target: "/product/etc/security/adb_keys",
         name: "adb_keys",
     },
+    // For Treble Generic System Image (GSI), system-as-root GSI needs to work on both devices with
+    // and without /odm partition. Those symlinks are for devices without /odm partition. For
+    // devices with /odm partition, mount odm.img under /odm will hide those symlinks.
+    {
+        target: "/vendor/odm/app",
+        name: "odm/app",
+    },
+    {
+        target: "/vendor/odm/bin",
+        name: "odm/bin",
+    },
+    {
+        target: "/vendor/odm/etc",
+        name: "odm/etc",
+    },
+    {
+        target: "/vendor/odm/firmware",
+        name: "odm/firmware",
+    },
+    {
+        target: "/vendor/odm/framework",
+        name: "odm/framework",
+    },
+    {
+        target: "/vendor/odm/lib",
+        name: "odm/lib",
+    },
+    {
+        target: "/vendor/odm/lib64",
+        name: "odm/lib64",
+    },
+    {
+        target: "/vendor/odm/overlay",
+        name: "odm/overlay",
+    },
+    {
+        target: "/vendor/odm/priv-app",
+        name: "odm/priv-app",
+    },
+    {
+        target: "/vendor/odm/usr",
+        name: "odm/usr",
+    },
 ]
 
 filegroup {
@@ -318,6 +361,11 @@
         ],
         libs: [":framework-res{.export-package.apk}"],
     },
+    type: "erofs",
+    erofs: {
+        compressor: "lz4hc,9",
+        compress_hints: "erofs_compress_hints.txt",
+    },
     build_logtags: true,
     gen_aconfig_flags_pb: true,
 
@@ -405,7 +453,6 @@
         "init.zygote32.rc",
         "init.zygote64.rc",
         "init.zygote64_32.rc",
-        "init_first_stage", // for boot partition
         "initial-package-stopped-states.xml",
         "input",
         "installd",
@@ -419,7 +466,6 @@
         "ld.mc",
         "llkd", // base_system
         "lmkd", // base_system
-        "local_time.default", // handheld_vendo
         "locksettings", // base_system
         "logcat", // base_system
         "logd", // base_system
@@ -481,7 +527,6 @@
         "sm", // base_system
         "snapshotctl", // base_system
         "snapuserd", // base_system
-        "snapuserd_ramdisk", // ramdisk
         "storaged", // base_system
         "surfaceflinger", // base_system
         "svc", // base_system
@@ -581,6 +626,7 @@
                 "ContactsProvider", // base_system
                 "CredentialManager", // handheld_system
                 "DeviceAsWebcam", // handheld_system
+                "DeviceDiagnostics", // handheld_system - internal
                 "DocumentsUI", // handheld_system
                 "DownloadProvider", // base_system
                 "DownloadProviderUi", // handheld_system
@@ -606,7 +652,6 @@
                 "PacProcessor", // handheld_system
                 "PackageInstaller", // base_system
                 "PartnerBookmarksProvider", // generic_system
-                "PhotoTable", // full_base
                 "PrintRecommendationService", // handheld_system
                 "PrintSpooler", // handheld_system
                 "ProxyHandler", // handheld_system
diff --git a/target/product/generic/erofs_compress_hints.txt b/target/product/generic/erofs_compress_hints.txt
new file mode 100644
index 0000000..8b2a711
--- /dev/null
+++ b/target/product/generic/erofs_compress_hints.txt
@@ -0,0 +1 @@
+0 .*\.apex$
\ No newline at end of file
diff --git a/target/product/media_system_ext.mk b/target/product/media_system_ext.mk
index 30dd2e2..e79a7eb 100644
--- a/target/product/media_system_ext.mk
+++ b/target/product/media_system_ext.mk
@@ -20,9 +20,5 @@
 # base_system_ext.mk.
 $(call inherit-product, $(SRC_TARGET_DIR)/product/base_system_ext.mk)
 
-# /system_ext packages
-PRODUCT_PACKAGES += \
-    vndk_apex_snapshot_package \
-
 # Window Extensions
 $(call inherit-product, $(SRC_TARGET_DIR)/product/window_extensions_base.mk)
diff --git a/teams/Android.bp b/teams/Android.bp
index 96d241b..4c40287 100644
--- a/teams/Android.bp
+++ b/teams/Android.bp
@@ -4454,3 +4454,24 @@
     // go/trendy/manage/engineers/5121440647577600
     trendy_team_id: "5121440647577600",
 }
+
+team {
+    name: "trendy_team_ravenwood",
+
+    // go/trendy/manage/engineers/6027181500497920
+    trendy_team_id: "6027181500497920",
+}
+
+team {
+    name: "trendy_team_automotive_cast",
+
+    // go/trendy/manage/engineers/5293683026264064
+    trendy_team_id: "5293683026264064",
+}
+
+team {
+    name: "trendy_team_wear_standalone_kids",
+
+    // go/trendy/manage/engineers/6303298703949824
+    trendy_team_id: "6303298703949824",
+}
diff --git a/tools/aconfig/OWNERS b/tools/aconfig/OWNERS
index 9a76279..c92fc7c 100644
--- a/tools/aconfig/OWNERS
+++ b/tools/aconfig/OWNERS
@@ -1,7 +1,8 @@
-amhk@google.com
 dzshen@google.com
-jham@google.com
-joeo@google.com
 opg@google.com
 tedbauer@google.com
 zhidou@google.com
+
+amhk@google.com  #{LAST_RESORT_SUGGESTION}
+jham@google.com  #{LAST_RESORT_SUGGESTION}
+joeo@google.com  #{LAST_RESORT_SUGGESTION}
diff --git a/tools/aconfig/aconfig/src/codegen/java.rs b/tools/aconfig/aconfig/src/codegen/java.rs
index a34166d..47d4042 100644
--- a/tools/aconfig/aconfig/src/codegen/java.rs
+++ b/tools/aconfig/aconfig/src/codegen/java.rs
@@ -531,15 +531,16 @@
             private static boolean enabledRw = true;
             private void init() {
                 StorageInternalReader reader = null;
+                boolean foundPackage = true;
                 try {
                     reader = new StorageInternalReader("system", "com.android.aconfig.test");
-                    disabledRw = reader.getBooleanFlagValue(1);
-                    disabledRwExported = reader.getBooleanFlagValue(2);
-                    enabledRw = reader.getBooleanFlagValue(8);
-                    disabledRwInOtherNamespace = reader.getBooleanFlagValue(3);
                 } catch (Exception e) {
-                    throw new RuntimeException("Cannot read flag in codegen", e);
+                    foundPackage = false;
                 }
+                disabledRw = foundPackage ? reader.getBooleanFlagValue(1) : false;
+                disabledRwExported = foundPackage ? reader.getBooleanFlagValue(2) : false;
+                enabledRw = foundPackage ? reader.getBooleanFlagValue(8) : true;
+                disabledRwInOtherNamespace = foundPackage ? reader.getBooleanFlagValue(3) : false;
                 isCached = true;
             }
             private void load_overrides_aconfig_test() {
diff --git a/tools/aconfig/aconfig/src/main.rs b/tools/aconfig/aconfig/src/main.rs
index edb4fd3..e184efe 100644
--- a/tools/aconfig/aconfig/src/main.rs
+++ b/tools/aconfig/aconfig/src/main.rs
@@ -51,8 +51,7 @@
         .subcommand(
             Command::new("create-cache")
                 .arg(Arg::new("package").long("package").required(true))
-                // TODO(b/312769710): Make this argument required.
-                .arg(Arg::new("container").long("container"))
+                .arg(Arg::new("container").long("container").required(true))
                 .arg(Arg::new("declarations").long("declarations").action(ArgAction::Append))
                 .arg(Arg::new("values").long("values").action(ArgAction::Append))
                 .arg(
diff --git a/tools/aconfig/aconfig/templates/FeatureFlags.java.template b/tools/aconfig/aconfig/templates/FeatureFlags.java.template
index 38c8f13..d2799b2 100644
--- a/tools/aconfig/aconfig/templates/FeatureFlags.java.template
+++ b/tools/aconfig/aconfig/templates/FeatureFlags.java.template
@@ -19,4 +19,4 @@
 {{ -endif }}
     boolean {item.method_name}();
 {{ -endfor }}
-}
\ No newline at end of file
+}
diff --git a/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template b/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
index d1cf191..26d3069 100644
--- a/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
+++ b/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
@@ -36,18 +36,19 @@
 {{ if not library_exported }}
     private void init() \{
         StorageInternalReader reader = null;
+        boolean foundPackage = true;
         try \{
             reader = new StorageInternalReader("{container}", "{package_name}");
-{{ for namespace_with_flags in namespace_flags }}
-{{ -for flag in namespace_with_flags.flags }}
-{{ if flag.is_read_write }}
-            {flag.method_name} = reader.getBooleanFlagValue({flag.flag_offset});
-{{ endif }}
-{{ -endfor }}
-{{ -endfor }}
         } catch (Exception e) \{
-            throw new RuntimeException("Cannot read flag in codegen", e);
+            foundPackage = false;
         }
+        {{ for namespace_with_flags in namespace_flags }}
+        {{ -for flag in namespace_with_flags.flags }}
+        {{ if flag.is_read_write }}
+            {flag.method_name} = foundPackage ? reader.getBooleanFlagValue({flag.flag_offset}) : {flag.default_value};
+        {{ endif }}
+        {{ -endfor }}
+        {{ -endfor }}
         isCached = true;
     }
 {{ endif }}
diff --git a/tools/aconfig/aconfig_storage_read_api/src/lib.rs b/tools/aconfig/aconfig_storage_read_api/src/lib.rs
index 884f148..ab066c6 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/lib.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/lib.rs
@@ -44,6 +44,7 @@
 
 pub use aconfig_storage_file::{AconfigStorageError, FlagValueType, StorageFileType};
 pub use flag_table_query::FlagReadContext;
+pub use mapped_file::map_file;
 pub use package_table_query::PackageReadContext;
 
 use aconfig_storage_file::read_u32_from_bytes;
diff --git a/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs b/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs
index 32dbed8..2c1884a 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs
@@ -28,7 +28,7 @@
 /// The memory mapped file may have undefined behavior if there are writes to this
 /// file after being mapped. Ensure no writes can happen to this file while this
 /// mapping stays alive.
-unsafe fn map_file(file_path: &str) -> Result<Mmap, AconfigStorageError> {
+pub unsafe fn map_file(file_path: &str) -> Result<Mmap, AconfigStorageError> {
     let file = File::open(file_path)
         .map_err(|errmsg| FileReadFail(anyhow!("Failed to open file {}: {}", file_path, errmsg)))?;
     unsafe {
diff --git a/tools/compliance/go.work b/tools/compliance/go.work
index a24d2ea..506e619 100644
--- a/tools/compliance/go.work
+++ b/tools/compliance/go.work
@@ -1,4 +1,4 @@
-go 1.22
+go 1.23
 
 use (
 	.
diff --git a/tools/edit_monitor/daemon_manager.py b/tools/edit_monitor/daemon_manager.py
index 445d849..892c292 100644
--- a/tools/edit_monitor/daemon_manager.py
+++ b/tools/edit_monitor/daemon_manager.py
@@ -70,6 +70,10 @@
       logging.warning("Block sign found, exiting...")
       return
 
+    if self.binary_path.startswith('/google/cog/'):
+      logging.warning("Edit monitor for cog is not supported, exiting...")
+      return
+
     self._stop_any_existing_instance()
     self._write_pid_to_pidfile()
     self._start_daemon_process()
diff --git a/tools/edit_monitor/daemon_manager_test.py b/tools/edit_monitor/daemon_manager_test.py
index d62eade..72442c6 100644
--- a/tools/edit_monitor/daemon_manager_test.py
+++ b/tools/edit_monitor/daemon_manager_test.py
@@ -131,6 +131,13 @@
     # Verify no daemon process is started.
     self.assertIsNone(dm.daemon_process)
 
+  def test_start_return_directly_if_in_cog_env(self):
+    dm = daemon_manager.DaemonManager(
+        '/google/cog/cloud/user/workspace/edit_monitor')
+    dm.start()
+    # Verify no daemon process is started.
+    self.assertIsNone(dm.daemon_process)
+
   @mock.patch('os.kill')
   def test_start_failed_to_kill_existing_instance(self, mock_kill):
     mock_kill.side_effect = OSError('Unknown OSError')
diff --git a/tools/filelistdiff/file_list_diff.py b/tools/filelistdiff/file_list_diff.py
index 951325f..fbbfedf 100644
--- a/tools/filelistdiff/file_list_diff.py
+++ b/tools/filelistdiff/file_list_diff.py
@@ -31,10 +31,14 @@
             allowed_files.update(set(filter(lambda x: len(x), map(lambda x: x.lstrip().split('#',1)[0].rstrip() , allowlist_file.read().split('\n')))))
 
     def is_unknown_diff(filepath):
-        return not filepath in allowed_files
+        return filepath not in allowed_files
+
+    def is_unnecessary_allowlist(filepath):
+        return filepath not in kati_files.symmetric_difference(soong_files)
 
     unique_in_kati = set(filter(is_unknown_diff, kati_files - soong_files))
     unique_in_soong = set(filter(is_unknown_diff, soong_files - kati_files))
+    unnecessary_allowlists = set(filter(is_unnecessary_allowlist, allowed_files))
 
     if unique_in_kati:
         print('')
@@ -53,7 +57,15 @@
         for item in sorted(unique_in_soong):
             print('  '+item)
 
-    if unique_in_kati or unique_in_soong:
+    if unnecessary_allowlists:
+        print('')
+        print(f'{COLOR_ERROR}Unnecessary files in allowlist.{COLOR_NORMAL}')
+        print('Please remove these entries from build/make/tools/filelistdiff/allowlist')
+        for item in sorted(unnecessary_allowlists):
+            print('  '+item)
+
+
+    if unique_in_kati or unique_in_soong or unnecessary_allowlists:
         print('')
         sys.exit(1)
 
diff --git a/tools/ide_query/ide_query.go b/tools/ide_query/ide_query.go
index 89ac78f..ec937fe 100644
--- a/tools/ide_query/ide_query.go
+++ b/tools/ide_query/ide_query.go
@@ -341,6 +341,8 @@
 			Id:              moduleName,
 			Language:        pb.Language_LANGUAGE_JAVA,
 			SourceFilePaths: m.Srcs,
+			GeneratedFiles:  genFiles(env, m),
+			DependencyIds:   m.Deps,
 		}
 		unitsById[u.Id] = u
 
@@ -355,14 +357,10 @@
 				continue
 			}
 
-			var paths []string
-			paths = append(paths, mod.Srcs...)
-			paths = append(paths, mod.SrcJars...)
-			paths = append(paths, mod.Jars...)
 			unitsById[name] = &pb.BuildableUnit{
 				Id:              name,
 				SourceFilePaths: mod.Srcs,
-				GeneratedFiles:  genFiles(env, paths),
+				GeneratedFiles:  genFiles(env, mod),
 				DependencyIds:   mod.Deps,
 			}
 
@@ -380,8 +378,13 @@
 }
 
 // genFiles returns the generated files (paths that start with outDir/) for the
-// given paths. Generated files that do not exist are ignored.
-func genFiles(env Env, paths []string) []*pb.GeneratedFile {
+// given module. Generated files that do not exist are ignored.
+func genFiles(env Env, mod *javaModule) []*pb.GeneratedFile {
+	var paths []string
+	paths = append(paths, mod.Srcs...)
+	paths = append(paths, mod.SrcJars...)
+	paths = append(paths, mod.Jars...)
+
 	prefix := env.OutDir + "/"
 	var ret []*pb.GeneratedFile
 	for _, p := range paths {