Conditionally add the car bcpf to platform bootclasspath

Previously, the com.android.car.framework was always added to the
platform bootclasspath and then Soong ignored errors that arose when
the android.car-module was not listed in PRODUCT_APEX_BOOT_JARS. This
changes uses the target_board_auto Soong config variable to control
whether the car fragment is added or not.

Test: none
Bug: 264598408
Change-Id: Ie2819215ae399cf50ff17ca47551947773cae80d
diff --git a/boot/Android.bp b/boot/Android.bp
index 24ad9de..851294c 100644
--- a/boot/Android.bp
+++ b/boot/Android.bp
@@ -23,6 +23,18 @@
     default_applicable_licenses: ["frameworks_base_license"],
 }
 
+soong_config_module_type {
+    name: "custom_platform_bootclasspath",
+    module_type: "platform_bootclasspath",
+    config_namespace: "AUTO",
+    bool_variables: [
+        "car_bootclasspath_fragment",
+    ],
+    properties: [
+        "fragments",
+    ],
+}
+
 // This module provides access to information Soong has related to the
 // whole platform bootclasspath. Currently, that information is provided solely
 // through configuration but additional information will be added here.
@@ -41,7 +53,7 @@
 //
 // This module needs to be present in the build for the above processing to be
 // done correctly.
-platform_bootclasspath {
+custom_platform_bootclasspath {
     name: "platform-bootclasspath",
 
     // The bootclasspath_fragments that contribute to the platform
@@ -115,17 +127,24 @@
             apex: "com.android.wifi",
             module: "com.android.wifi-bootclasspath-fragment",
         },
-        // only used for auto
-        {
-            apex: "com.android.car.framework",
-            module: "com.android.car.framework-bootclasspath-fragment",
-        },
         {
             apex: "com.android.virt",
             module: "com.android.virt-bootclasspath-fragment",
         },
     ],
 
+    soong_config_variables: {
+        car_bootclasspath_fragment: {
+            fragments: [
+                // only used for auto
+                {
+                    apex: "com.android.car.framework",
+                    module: "com.android.car.framework-bootclasspath-fragment",
+                },
+            ],
+        },
+    },
+
     // Additional information needed by hidden api processing.
     hidden_api: {
         unsupported: [