Merge "Add default modules for system_ext and product" into main
diff --git a/target/product/generic/Android.bp b/target/product/generic/Android.bp
index 5d7ec9a..7407d7f 100644
--- a/target/product/generic/Android.bp
+++ b/target/product/generic/Android.bp
@@ -346,6 +346,77 @@
 }
 
 android_filesystem_defaults {
+    name: "system_ext_image_defaults",
+    deps: [
+        ///////////////////////////////////////////
+        // base_system_ext
+        ///////////////////////////////////////////
+        "build_flag_system_ext",
+        "fs_config_dirs_system_ext",
+        "fs_config_files_system_ext",
+        "group_system_ext",
+        "passwd_system_ext",
+        "SatelliteClient",
+        "selinux_policy_system_ext",
+        "system_ext_manifest.xml",
+        "system_ext-build.prop",
+        // Base modules when shipping api level is less than or equal to 34
+        "hwservicemanager",
+        "android.hidl.allocator@1.0-service",
+
+        ///////////////////////////////////////////
+        // window_extensions_base
+        ///////////////////////////////////////////
+        "androidx.window.extensions",
+        "androidx.window.sidecar",
+
+        ///////////////////////////////////////////
+        // base_system
+        ///////////////////////////////////////////
+        "charger",
+    ] + select(release_flag("RELEASE_APPFUNCTION_SIDECAR"), {
+        true: [
+            "com.android.extensions.appfunctions",
+            "appfunctions.extension.xml",
+        ],
+        default: [],
+    }),
+}
+
+android_filesystem_defaults {
+    name: "product_image_defaults",
+    deps: [
+        ///////////////////////////////////////////
+        // media_product
+        ///////////////////////////////////////////
+        "webview",
+
+        ///////////////////////////////////////////
+        // base_product
+        ///////////////////////////////////////////
+
+        // Base modules and settings for the product partition.
+        "build_flag_product",
+        "fs_config_dirs_product",
+        "fs_config_files_product",
+        "group_product",
+        "ModuleMetadata",
+        "passwd_product",
+        "product_compatibility_matrix.xml",
+        "product_manifest.xml",
+        "selinux_policy_product",
+        "product-build.prop",
+
+        // AUDIO
+        "frameworks_sounds",
+    ] + select(product_variable("debuggable"), {
+        // Packages included only for eng or userdebug builds, previously debug tagged
+        true: ["adb_keys"],
+        default: [],
+    }),
+}
+
+android_filesystem_defaults {
     name: "system_image_defaults",
     partition_name: "system",
     base_dir: "system",
diff --git a/target/product/gsi/Android.bp b/target/product/gsi/Android.bp
index 9e8946d..c6fc021 100644
--- a/target/product/gsi/Android.bp
+++ b/target/product/gsi/Android.bp
@@ -83,7 +83,11 @@
 
 android_system_image {
     name: "android_gsi",
-    defaults: ["system_image_defaults"],
+    defaults: [
+        "system_image_defaults",
+        "system_ext_image_defaults",
+        "product_image_defaults",
+    ],
     symlinks: gsi_symlinks,
     dirs: ["cache"],
     deps: [
@@ -107,28 +111,6 @@
         "system_ext_userdebug_plat_sepolicy.cil",
 
         ///////////////////////////////////////////
-        // base_system_ext
-        ///////////////////////////////////////////
-        "build_flag_system_ext",
-        "fs_config_dirs_system_ext",
-        "fs_config_files_system_ext",
-        "group_system_ext",
-        "passwd_system_ext",
-        "SatelliteClient",
-        "selinux_policy_system_ext",
-        "system_ext_manifest.xml",
-        "system_ext-build.prop",
-        // Base modules when shipping api level is less than or equal to 34
-        "hwservicemanager",
-        "android.hidl.allocator@1.0-service",
-
-        ///////////////////////////////////////////
-        // window_extensions_base
-        ///////////////////////////////////////////
-        "androidx.window.extensions",
-        "androidx.window.sidecar",
-
-        ///////////////////////////////////////////
         // gsi_release
         ///////////////////////////////////////////
         "gsi_skip_mount.cfg",
@@ -161,40 +143,7 @@
         "Dialer",
         "LatinIME",
         "apns-full-conf.xml",
-
-        ///////////////////////////////////////////
-        // media_product
-        ///////////////////////////////////////////
-        "webview",
-
-        ///////////////////////////////////////////
-        // base_product
-        ///////////////////////////////////////////
-
-        // Base modules and settings for the product partition.
-        "build_flag_product",
-        "fs_config_dirs_product",
-        "fs_config_files_product",
-        "group_product",
-        "ModuleMetadata",
-        "passwd_product",
-        "product_compatibility_matrix.xml",
-        "product_manifest.xml",
-        "selinux_policy_product",
-        "product-build.prop",
-
-        // AUDIO
-        "frameworks_sounds",
-
-        ///////////////////////////////////////////
-        // base_system
-        ///////////////////////////////////////////
-        "charger",
-    ] + select(product_variable("debuggable"), {
-        // Packages included only for eng or userdebug builds, previously debug tagged
-        true: ["adb_keys"],
-        default: [],
-    }),
+    ],
     multilib: {
         both: {
             // PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34