Merge "Add trendy team for desktop wifi team" into main
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 0cae816..d81248b 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -298,7 +298,7 @@
   build_command.append(get_top().joinpath(SOONG_UI_EXE_REL_PATH))
   build_command.append('--make-mode')
   build_command.extend(build_plan.build_targets)
-
+  logging.info(f'Running build command: {build_command}')
   try:
     run_command(build_command)
   except subprocess.CalledProcessError as e:
diff --git a/core/Makefile b/core/Makefile
index c56c782..5d82c21 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3602,7 +3602,7 @@
 endif
 SOONG_DEFINED_SYSTEM_IMAGE_PATH := $(call intermediates-dir-for,ETC,$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE))/$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE)
 SOONG_DEFINED_SYSTEM_IMAGE_BASE := $(dir $(ALL_MODULES.$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE).FILESYSTEM_FILELIST))
-$(BUILT_SYSTEMIMAGE): $(INSTALLED_FILES_FILE) $(systemimage_intermediates)/file_list.txt $(SOONG_DEFINED_SYSTEM_IMAGE_PATH)
+$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(systemimage_intermediates)/file_list.txt $(SOONG_DEFINED_SYSTEM_IMAGE_PATH)
 $(eval $(call copy-one-file, $(SOONG_DEFINED_SYSTEM_IMAGE_PATH), $(BUILT_SYSTEMIMAGE)))
 else
 $(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(systemimage_intermediates)/file_list.txt
@@ -5034,6 +5034,10 @@
 	    $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
 	        --include_descriptors_from_image $(call images-for-partitions,$(image))) \
 	    --output $@
+      # libavb expects to be able to read the maximum vbmeta size, so we must provide a partition
+      # which matches this or the read will fail.
+      # See external/avb/libavb/avb_slot_verify.c#VBMETA_MAX_SIZE
+      truncate -s 65536 $@
 endef
 
 ifdef BUILDING_SYSTEM_IMAGE
@@ -5092,6 +5096,10 @@
     $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
     $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
     --output $@
+    # libavb expects to be able to read the maximum vbmeta size, so we must provide a partition
+    # which matches this or the read will fail.
+    # See external/avb/libavb/avb_slot_verify.c#VBMETA_MAX_SIZE
+    truncate -s 65536 $@
   $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
 endef
 
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index b30e025..6c350f0 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -42,6 +42,7 @@
 $(call soong_config_set_bool,ANDROID,TARGET_SUPPORTS_32_BIT_APPS,$(if $(filter true,$(TARGET_SUPPORTS_32_BIT_APPS)),true,false))
 $(call soong_config_set_bool,ANDROID,TARGET_SUPPORTS_64_BIT_APPS,$(if $(filter true,$(TARGET_SUPPORTS_64_BIT_APPS)),true,false))
 $(call add_soong_config_var,ANDROID,BOARD_GENFS_LABELS_VERSION)
+$(call soong_config_set_bool,ANDROID,PRODUCT_FSVERITY_GENERATE_METADATA,$(if $(filter true,$(PRODUCT_FSVERITY_GENERATE_METADATA)),true,false))
 
 $(call add_soong_config_var,ANDROID,ADDITIONAL_M4DEFS,$(if $(BOARD_SEPOLICY_M4DEFS),$(addprefix -D,$(BOARD_SEPOLICY_M4DEFS))))
 
@@ -193,6 +194,14 @@
 $(call add_soong_config_var_value,ANDROID,include_nonpublic_framework_api,true)
 endif
 
+# Add nfc build flag to soong
+ifneq ($(RELEASE_PACKAGE_NFC_STACK),NfcNci)
+  $(call soong_config_set,bootclasspath,nfc_apex_bootclasspath_fragment,true)
+endif
+
+# Add uwb build flag to soong
+$(call soong_config_set,bootclasspath,release_ranging_stack,$(RELEASE_RANGING_STACK))
+
 # Add crashrecovery build flag to soong
 $(call soong_config_set,ANDROID,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE))
 # Add crashrecovery file move flags to soong, for both platform and module
diff --git a/core/config.mk b/core/config.mk
index 454c0e5..f94eacf 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -763,50 +763,23 @@
 .KATI_READONLY := \
     PRODUCT_COMPATIBLE_PROPERTY
 
-# Boolean variable determining if Treble is fully enabled
-PRODUCT_FULL_TREBLE := false
-ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),)
-  PRODUCT_FULL_TREBLE := $(PRODUCT_FULL_TREBLE_OVERRIDE)
-else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
-  #$(warning no product shipping level defined)
-else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),)
-  PRODUCT_FULL_TREBLE := true
-endif
-
-requirements := \
-    PRODUCT_TREBLE_LINKER_NAMESPACES \
-    PRODUCT_ENFORCE_VINTF_MANIFEST
-
-# If it is overriden, then the requirement override is taken, otherwise it's
-# PRODUCT_FULL_TREBLE
-$(foreach req,$(requirements),$(eval \
-    $(req) := $(if $($(req)_OVERRIDE),$($(req)_OVERRIDE),$(PRODUCT_FULL_TREBLE))))
-# If the requirement is false for any reason, then it's not PRODUCT_FULL_TREBLE
-$(foreach req,$(requirements),$(eval \
-    PRODUCT_FULL_TREBLE := $(if $(filter false,$($(req))),false,$(PRODUCT_FULL_TREBLE))))
-
-PRODUCT_FULL_TREBLE_OVERRIDE ?=
-$(foreach req,$(requirements),$(eval $(req)_OVERRIDE ?=))
-
-# used to be a part of PRODUCT_FULL_TREBLE, but now always set it
+# TODO: remove all code referencing these, and remove override variables
+PRODUCT_FULL_TREBLE := true
 PRODUCT_NOTICE_SPLIT := true
+PRODUCT_TREBLE_LINKER_NAMESPACES := true
+PRODUCT_ENFORCE_VINTF_MANIFEST := true
 
 # TODO(b/114488870): disallow PRODUCT_FULL_TREBLE_OVERRIDE from being used.
 .KATI_READONLY := \
-    PRODUCT_FULL_TREBLE_OVERRIDE \
-    $(foreach req,$(requirements),$(req)_OVERRIDE) \
-    $(requirements) \
     PRODUCT_FULL_TREBLE \
+    PRODUCT_TREBLE_LINKER_NAMESPACES \
+    PRODUCT_ENFORCE_VINTF_MANIFEST \
     PRODUCT_NOTICE_SPLIT \
 
-ifneq ($(PRODUCT_FULL_TREBLE),true)
-    $(warning This device does not have Treble enabled. This is unsafe.)
-endif
-
-$(KATI_obsolete_var $(foreach req,$(requirements),$(req)_OVERRIDE) \
-    ,This should be referenced without the _OVERRIDE suffix.)
-
-requirements :=
+# TODO(b/114488870): remove all sets of these everwhere, and disallow them to be used
+$(KATI_obsolete_var PRODUCT_TREBLE_LINKER_NAMESPACES_OVERRIDE,Deprecated.)
+$(KATI_obsolete_var PRODUCT_ENFORCE_VINTF_MANIFEST_OVERRIDE,Deprecated.)
+$(KATI_obsolete_var PRODUCT_FULL_TREBLE_OVERRIDE,Deprecated.)
 
 # BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED can be true only if early-mount of
 # partitions is supported. But the early-mount must be supported for full
diff --git a/core/main.mk b/core/main.mk
index cdf6acd..5ab807e 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1916,7 +1916,7 @@
 	  $(eval _is_system_other_odex_marker := $(if $(findstring $f,$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)),Y)) \
 	  $(eval _is_kernel_modules_blocklist := $(if $(findstring $f,$(ALL_KERNEL_MODULES_BLOCKLIST)),Y)) \
 	  $(eval _is_fsverity_build_manifest_apk := $(if $(findstring $f,$(ALL_FSVERITY_BUILD_MANIFEST_APK)),Y)) \
-	  $(eval _is_linker_config := $(if $(findstring $f,$(SYSTEM_LINKER_CONFIG) $(vendor_linker_config_file)),Y)) \
+	  $(eval _is_linker_config := $(if $(findstring $f,$(SYSTEM_LINKER_CONFIG) $(vendor_linker_config_file) $(product_linker_config_file)),Y)) \
 	  $(eval _is_partition_compat_symlink := $(if $(findstring $f,$(PARTITION_COMPAT_SYMLINKS)),Y)) \
 	  $(eval _is_flags_file := $(if $(findstring $f, $(ALL_FLAGS_FILES)),Y)) \
 	  $(eval _is_rootdir_symlink := $(if $(findstring $f, $(ALL_ROOTDIR_SYMLINKS)),Y)) \
diff --git a/core/project_definitions.mk b/core/project_definitions.mk
index 184b03e..5728b67 100644
--- a/core/project_definitions.mk
+++ b/core/project_definitions.mk
@@ -22,6 +22,3 @@
 # Include definitions for prebuilt SDK, if present.
 #
 -include prebuilts/sdk/current/definitions.mk
-
-# SDV-specific config.
--include system/software_defined_vehicle/platform/config.mk
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 48565f4..4537824 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -360,8 +360,6 @@
 $(call add_json_list, OdmPropFiles, $(TARGET_ODM_PROP))
 $(call add_json_list, VendorPropFiles, $(TARGET_VENDOR_PROP))
 
-$(call add_json_str, ExtraAllowedDepsTxt, $(EXTRA_ALLOWED_DEPS_TXT))
-
 # Do not set ArtTargetIncludeDebugBuild into any value if PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD is not set,
 # to have the same behavior from runtime_libart.mk.
 ifneq ($(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD),)
@@ -385,7 +383,7 @@
   $(call add_json_str,  ProductDirectory,    $(dir $(INTERNAL_PRODUCT)))
 
   $(call add_json_map,PartitionQualifiedVariables)
-  $(foreach image_type,INIT_BOOT BOOT VENDOR_BOOT SYSTEM VENDOR CACHE USERDATA PRODUCT SYSTEM_EXT OEM ODM VENDOR_DLKM ODM_DLKM SYSTEM_DLKM, \
+  $(foreach image_type,INIT_BOOT BOOT VENDOR_BOOT SYSTEM VENDOR CACHE USERDATA PRODUCT SYSTEM_EXT OEM ODM VENDOR_DLKM ODM_DLKM SYSTEM_DLKM VBMETA VBMETA_SYSTEM VBMETA_SYSTEM_DLKM VBMETA_VENDOR_DLKM, \
     $(call add_json_map,$(call to-lower,$(image_type))) \
     $(call add_json_bool, BuildingImage, $(filter true,$(BUILDING_$(image_type)_IMAGE))) \
     $(call add_json_str, BoardErofsCompressor, $(BOARD_$(image_type)IMAGE_EROFS_COMPRESSOR)) \
@@ -460,6 +458,8 @@
   $(call add_json_list, InternalBootconfig, $(INTERNAL_BOOTCONFIG))
   $(call add_json_str, InternalBootconfigFile, $(INTERNAL_BOOTCONFIG_FILE))
 
+  $(call add_json_bool, BuildingSystemOtherImage, $(BUILDING_SYSTEM_OTHER_IMAGE))
+
   # super image stuff
   $(call add_json_bool, ProductUseDynamicPartitions, $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)))
   $(call add_json_bool, ProductRetrofitDynamicPartitions, $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)))
@@ -477,6 +477,10 @@
     $(call end_json_map)
   $(call add_json_bool, ProductVirtualAbOta, $(filter true,$(PRODUCT_VIRTUAL_AB_OTA)))
   $(call add_json_bool, ProductVirtualAbOtaRetrofit, $(filter true,$(PRODUCT_VIRTUAL_AB_OTA_RETROFIT)))
+  $(call add_json_bool, ProductVirtualAbCompression, $(filter true,$(PRODUCT_VIRTUAL_AB_COMPRESSION)))
+  $(call add_json_str, ProductVirtualAbCompressionMethod, $(PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD))
+  $(call add_json_str, ProductVirtualAbCompressionFactor, $(PRODUCT_VIRTUAL_AB_COMPRESSION_FACTOR))
+  $(call add_json_str, ProductVirtualAbCowVersion, $(PRODUCT_VIRTUAL_AB_COW_VERSION))
   $(call add_json_bool, AbOtaUpdater, $(filter true,$(AB_OTA_UPDATER)))
 
   # Avb (android verified boot) stuff
@@ -551,6 +555,11 @@
 
   $(call add_json_str, PrebuiltBootloader, $(BOARD_PREBUILT_BOOTLOADER))
 
+  # Used to generate userdata partition
+  $(call add_json_str, ProductFsCasefold, $(PRODUCT_FS_CASEFOLD))
+  $(call add_json_str, ProductQuotaProjid, $(PRODUCT_QUOTA_PROJID))
+  $(call add_json_str, ProductFsCompression, $(PRODUCT_FS_COMPRESSION))
+
 $(call end_json_map)
 
 # For converting vintf_data
diff --git a/target/product/generic/Android.bp b/target/product/generic/Android.bp
index 314816d..978d3b1 100644
--- a/target/product/generic/Android.bp
+++ b/target/product/generic/Android.bp
@@ -416,6 +416,19 @@
     }),
 }
 
+system_image_fsverity_default = {
+    inputs: [
+        "etc/boot-image.prof",
+        "etc/classpaths/*.pb",
+        "etc/dirty-image-objects",
+        "etc/preloaded-classes",
+        "framework/*",
+        "framework/*/*", // framework/{arch}
+        "framework/oat/*/*", // framework/oat/{arch}
+    ],
+    libs: [":framework-res{.export-package.apk}"],
+}
+
 android_filesystem_defaults {
     name: "system_image_defaults",
     partition_name: "system",
@@ -428,16 +441,22 @@
         linker_config_srcs: [":system_linker_config_json_file"],
     },
     fsverity: {
-        inputs: [
-            "etc/boot-image.prof",
-            "etc/classpaths/*.pb",
-            "etc/dirty-image-objects",
-            "etc/preloaded-classes",
-            "framework/*",
-            "framework/*/*", // framework/{arch}
-            "framework/oat/*/*", // framework/oat/{arch}
-        ],
-        libs: [":framework-res{.export-package.apk}"],
+        inputs: select(soong_config_variable("ANDROID", "PRODUCT_FSVERITY_GENERATE_METADATA"), {
+            true: [
+                "etc/boot-image.prof",
+                "etc/classpaths/*.pb",
+                "etc/dirty-image-objects",
+                "etc/preloaded-classes",
+                "framework/*",
+                "framework/*/*", // framework/{arch}
+                "framework/oat/*/*", // framework/oat/{arch}
+            ],
+            default: [],
+        }),
+        libs: select(soong_config_variable("ANDROID", "PRODUCT_FSVERITY_GENERATE_METADATA"), {
+            true: [":framework-res{.export-package.apk}"],
+            default: [],
+        }),
     },
     build_logtags: true,
     gen_aconfig_flags_pb: true,
diff --git a/target/product/generic_ramdisk.mk b/target/product/generic_ramdisk.mk
index 5ecb55f..32277ec 100644
--- a/target/product/generic_ramdisk.mk
+++ b/target/product/generic_ramdisk.mk
@@ -24,6 +24,7 @@
     init_first_stage \
     snapuserd_ramdisk \
     ramdisk-build.prop \
+    toolbox_ramdisk \
 
 # Debug ramdisk
 PRODUCT_PACKAGES += \
diff --git a/target/product/gsi/Android.bp b/target/product/gsi/Android.bp
index c6fc021..a119832 100644
--- a/target/product/gsi/Android.bp
+++ b/target/product/gsi/Android.bp
@@ -130,12 +130,6 @@
         "com.android.vndk.v34",
 
         ///////////////////////////////////////////
-        // AVF
-        ///////////////////////////////////////////
-        "com.android.compos",
-        "features_com.android.virt.xml",
-
-        ///////////////////////////////////////////
         // gsi_product
         ///////////////////////////////////////////
         "Browser2",
@@ -145,6 +139,15 @@
         "apns-full-conf.xml",
     ],
     multilib: {
+        lib64: {
+            deps: [
+                ///////////////////////////////////////////
+                // AVF
+                ///////////////////////////////////////////
+                "com.android.compos",
+                "features_com.android.virt.xml",
+            ],
+        },
         both: {
             // PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34
             deps: ["android.hidl.memory@1.0-impl"],
diff --git a/tools/aconfig/aconfig_protos/protos/aconfig_internal.proto b/tools/aconfig/aconfig_protos/protos/aconfig_internal.proto
new file mode 100644
index 0000000..7930f56
--- /dev/null
+++ b/tools/aconfig/aconfig_protos/protos/aconfig_internal.proto
@@ -0,0 +1,42 @@
+// Copyright (C) 2023 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
+
+// This is the schema definition for protos intended for internal aconfig
+// use ONLY. There are no guarantees regarding backwards compatibility.
+// Do not put protos here intended for storage or communication.
+
+syntax = "proto2";
+
+package android.aconfig_internal;
+
+
+// This protobuf defines messages used to store data about flags used to guard
+// APIs which are finalized for a given SDK.
+message finalized_flag {
+  // Name of the flag (required). Does not include package name.
+  // Must match flag name in the aconfig declaration header.
+  optional string name = 1;
+
+  // Package the flag belongs to (required).  Must match package in the aconfig declaration header.
+  optional string package = 2;
+
+  // SDK level in which the flag was finalized.
+  optional int32 min_sdk = 3;
+
+  // TODO - b/378936061: Add support for minor SDK version & SDK extension.
+};
+
+message finalized_flags {
+  repeated finalized_flag finalized_flag = 1;
+}
diff --git a/tools/aconfig/aflags/src/main.rs b/tools/aconfig/aflags/src/main.rs
index e4af2a7..568ad99 100644
--- a/tools/aconfig/aflags/src/main.rs
+++ b/tools/aconfig/aflags/src/main.rs
@@ -320,7 +320,10 @@
         .wait_with_output()
         .expect("failed to execute command");
 
-    println!("{}", String::from_utf8_lossy(&output.stdout).trim());
+    let output_str = String::from_utf8_lossy(&output.stdout).trim().to_string();
+    if !output_str.is_empty() {
+        println!("{}", output_str);
+    }
 }
 
 fn main() -> Result<()> {
diff --git a/tools/record-finalized-flags/Android.bp b/tools/record-finalized-flags/Android.bp
new file mode 100644
index 0000000..63bcc2d
--- /dev/null
+++ b/tools/record-finalized-flags/Android.bp
@@ -0,0 +1,4 @@
+sh_binary_host {
+    name: "record-finalized-flags",
+    src: "record-finalized-flags.sh",
+}
diff --git a/tools/record-finalized-flags/OWNERS b/tools/record-finalized-flags/OWNERS
new file mode 100644
index 0000000..2864a2c
--- /dev/null
+++ b/tools/record-finalized-flags/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/base:/SDK_OWNERS
diff --git a/tools/record-finalized-flags/record-finalized-flags.sh b/tools/record-finalized-flags/record-finalized-flags.sh
new file mode 100644
index 0000000..1d85ae9
--- /dev/null
+++ b/tools/record-finalized-flags/record-finalized-flags.sh
@@ -0,0 +1,18 @@
+#!/bin/bash -e
+#
+# Copyright 2024 Google Inc. All rights reserved.
+#
+# 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.
+
+# TODO: implement this tool
+echo "record-finalized-flags.sh $*"
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index f04dfb7..b6cbb15 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -23,7 +23,7 @@
 import getopt
 import getpass
 import gzip
-import imp
+import importlib.util
 import json
 import logging
 import logging.config
@@ -3132,16 +3132,19 @@
         return
       try:
         if os.path.isdir(path):
-          info = imp.find_module("releasetools", [path])
-        else:
-          d, f = os.path.split(path)
-          b, x = os.path.splitext(f)
-          if x == ".py":
-            f = b
-          info = imp.find_module(f, [d])
+          path = os.path.join(path, "releasetools")
+          if os.path.isdir(path):
+            path = os.path.join(path, "__init__.py")
+        if not os.path.exists(path) and os.path.exists(path + ".py"):
+          path = path + ".py"
+        spec = importlib.util.spec_from_file_location("device_specific", path)
+        if not spec:
+          raise FileNotFoundError(path)
         logger.info("loaded device-specific extensions from %s", path)
-        self.module = imp.load_module("device_specific", *info)
-      except ImportError:
+        module = importlib.util.module_from_spec(spec)
+        spec.loader.exec_module(module)
+        self.module = module
+      except (ImportError, FileNotFoundError):
         logger.info("unable to load device-specific module; assuming none")
 
   def _DoCall(self, function_name, *args, **kwargs):
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 89933a0..62f425a 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -2157,3 +2157,11 @@
         'google/coral/coral:10/RP1A.200325.001/6337676:user/dev-keys',
         'ro.product.odm.device': 'coral',
     }, copied_props.build_props)
+
+
+class DeviceSpecificParamsTest(test_utils.ReleaseToolsTestCase):
+
+  def test_missingSource(self):
+    common.OPTIONS.device_specific = '/does_not_exist'
+    ds = DeviceSpecificParams()
+    self.assertIsNone(ds.module)
diff --git a/tools/sbom/gen_sbom.py b/tools/sbom/gen_sbom.py
index 9c3a8be..756d9db 100644
--- a/tools/sbom/gen_sbom.py
+++ b/tools/sbom/gen_sbom.py
@@ -709,7 +709,13 @@
         'is_prebuilt_make_module': False
     }
     file_metadata.update(db.get_soong_module_of_built_file(dep_file))
-    add_package_of_file(file_id, file_metadata, doc, report)
+    if is_source_package(file_metadata) or is_prebuilt_package(file_metadata):
+      add_package_of_file(file_id, file_metadata, doc, report)
+    else:
+      # Other static lib files are generated from the platform
+      doc.add_relationship(sbom_data.Relationship(id1=file_id,
+                                                  relationship=sbom_data.RelationshipType.GENERATED_FROM,
+                                                  id2=sbom_data.SPDXID_PLATFORM))
 
     # Add relationships for static deps of static libraries
     add_static_deps_of_file(file_id, file_metadata, doc)