generic_rootdirs = [
    "acct",
    "apex",
    "bootstrap-apex",
    "config",
    "data",
    "data_mirror",
    "debug_ramdisk",
    "dev",
    "linkerconfig",
    "metadata",
    "mnt",
    "odm",
    "odm_dlkm",
    "oem",
    "postinstall",
    "proc",
    "second_stage_resources",
    "storage",
    "sys",
    "system",
    "system_dlkm",
    "tmp",
    "vendor",
    "vendor_dlkm",
]

android_rootdirs = [
    "system_ext",
    "product",
]

generic_symlinks = [
    {
        target: "/system/bin/init",
        name: "init",
    },
    {
        target: "/system/etc",
        name: "etc",
    },
    {
        target: "/system/bin",
        name: "bin",
    },
    {
        target: "/vendor",
        name: "system/vendor",
    },
    {
        target: "/system_dlkm/lib/modules",
        name: "system/lib/modules",
    },
    {
        target: "/data/user_de/0/com.android.shell/files/bugreports",
        name: "bugreports",
    },
    {
        target: "/sys/kernel/debug",
        name: "d",
    },
    {
        target: "/storage/self/primary",
        name: "sdcard",
    },
    {
        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",
    },
]

android_symlinks = [
    {
        target: "/product",
        name: "system/product",
    },
    {
        target: "/system_ext",
        name: "system/system_ext",
    },
    {
        target: "/data/cache",
        name: "cache",
    },
]

filegroup {
    name: "generic_system_sign_key",
    srcs: [":avb_testkey_rsa4096"],
}

phony {
    name: "generic_system_fonts",
    required: [
        "AndroidClock.ttf",
        "CarroisGothicSC-Regular.ttf",
        "ComingSoon.ttf",
        "CutiveMono.ttf",
        "DancingScript-Regular.ttf",
        "DroidSansMono.ttf",
        "NotoColorEmoji.ttf",
        "NotoColorEmojiFlags.ttf",
        "NotoNaskhArabic-Bold.ttf",
        "NotoNaskhArabic-Regular.ttf",
        "NotoNaskhArabicUI-Bold.ttf",
        "NotoNaskhArabicUI-Regular.ttf",
        "NotoSansAdlam-VF.ttf",
        "NotoSansAhom-Regular.otf",
        "NotoSansAnatolianHieroglyphs-Regular.otf",
        "NotoSansArmenian-VF.ttf",
        "NotoSansAvestan-Regular.ttf",
        "NotoSansBalinese-Regular.ttf",
        "NotoSansBamum-Regular.ttf",
        "NotoSansBassaVah-Regular.otf",
        "NotoSansBatak-Regular.ttf",
        "NotoSansBengali-VF.ttf",
        "NotoSansBengaliUI-VF.ttf",
        "NotoSansBhaiksuki-Regular.otf",
        "NotoSansBrahmi-Regular.ttf",
        "NotoSansBuginese-Regular.ttf",
        "NotoSansBuhid-Regular.ttf",
        "NotoSansCJK-Regular.ttc",
        "NotoSansCanadianAboriginal-Regular.ttf",
        "NotoSansCarian-Regular.ttf",
        "NotoSansChakma-Regular.otf",
        "NotoSansCham-Bold.ttf",
        "NotoSansCham-Regular.ttf",
        "NotoSansCherokee-Regular.ttf",
        "NotoSansCoptic-Regular.ttf",
        "NotoSansCuneiform-Regular.ttf",
        "NotoSansCypriot-Regular.ttf",
        "NotoSansDeseret-Regular.ttf",
        "NotoSansDevanagari-VF.ttf",
        "NotoSansDevanagariUI-VF.ttf",
        "NotoSansEgyptianHieroglyphs-Regular.ttf",
        "NotoSansElbasan-Regular.otf",
        "NotoSansEthiopic-VF.ttf",
        "NotoSansGeorgian-VF.ttf",
        "NotoSansGlagolitic-Regular.ttf",
        "NotoSansGothic-Regular.ttf",
        "NotoSansGrantha-Regular.ttf",
        "NotoSansGujarati-Bold.ttf",
        "NotoSansGujarati-Regular.ttf",
        "NotoSansGujaratiUI-Bold.ttf",
        "NotoSansGujaratiUI-Regular.ttf",
        "NotoSansGunjalaGondi-Regular.otf",
        "NotoSansGurmukhi-VF.ttf",
        "NotoSansGurmukhiUI-VF.ttf",
        "NotoSansHanifiRohingya-Regular.otf",
        "NotoSansHanunoo-Regular.ttf",
        "NotoSansHatran-Regular.otf",
        "NotoSansHebrew-Bold.ttf",
        "NotoSansHebrew-Regular.ttf",
        "NotoSansImperialAramaic-Regular.ttf",
        "NotoSansInscriptionalPahlavi-Regular.ttf",
        "NotoSansInscriptionalParthian-Regular.ttf",
        "NotoSansJavanese-Regular.otf",
        "NotoSansKaithi-Regular.ttf",
        "NotoSansKannada-VF.ttf",
        "NotoSansKannadaUI-VF.ttf",
        "NotoSansKayahLi-Regular.ttf",
        "NotoSansKharoshthi-Regular.ttf",
        "NotoSansKhmer-VF.ttf",
        "NotoSansKhmerUI-Bold.ttf",
        "NotoSansKhmerUI-Regular.ttf",
        "NotoSansKhojki-Regular.otf",
        "NotoSansLao-Bold.ttf",
        "NotoSansLao-Regular.ttf",
        "NotoSansLaoUI-Bold.ttf",
        "NotoSansLaoUI-Regular.ttf",
        "NotoSansLepcha-Regular.ttf",
        "NotoSansLimbu-Regular.ttf",
        "NotoSansLinearA-Regular.otf",
        "NotoSansLinearB-Regular.ttf",
        "NotoSansLisu-Regular.ttf",
        "NotoSansLycian-Regular.ttf",
        "NotoSansLydian-Regular.ttf",
        "NotoSansMalayalam-VF.ttf",
        "NotoSansMalayalamUI-VF.ttf",
        "NotoSansMandaic-Regular.ttf",
        "NotoSansManichaean-Regular.otf",
        "NotoSansMarchen-Regular.otf",
        "NotoSansMasaramGondi-Regular.otf",
        "NotoSansMedefaidrin-VF.ttf",
        "NotoSansMeeteiMayek-Regular.ttf",
        "NotoSansMeroitic-Regular.otf",
        "NotoSansMiao-Regular.otf",
        "NotoSansModi-Regular.ttf",
        "NotoSansMongolian-Regular.ttf",
        "NotoSansMro-Regular.otf",
        "NotoSansMultani-Regular.otf",
        "NotoSansMyanmar-Bold.otf",
        "NotoSansMyanmar-Medium.otf",
        "NotoSansMyanmar-Regular.otf",
        "NotoSansMyanmarUI-Bold.otf",
        "NotoSansMyanmarUI-Medium.otf",
        "NotoSansMyanmarUI-Regular.otf",
        "NotoSansNKo-Regular.ttf",
        "NotoSansNabataean-Regular.otf",
        "NotoSansNewTaiLue-Regular.ttf",
        "NotoSansNewa-Regular.otf",
        "NotoSansOgham-Regular.ttf",
        "NotoSansOlChiki-Regular.ttf",
        "NotoSansOldItalic-Regular.ttf",
        "NotoSansOldNorthArabian-Regular.otf",
        "NotoSansOldPermic-Regular.otf",
        "NotoSansOldPersian-Regular.ttf",
        "NotoSansOldSouthArabian-Regular.ttf",
        "NotoSansOldTurkic-Regular.ttf",
        "NotoSansOriya-Bold.ttf",
        "NotoSansOriya-Regular.ttf",
        "NotoSansOriyaUI-Bold.ttf",
        "NotoSansOriyaUI-Regular.ttf",
        "NotoSansOsage-Regular.ttf",
        "NotoSansOsmanya-Regular.ttf",
        "NotoSansPahawhHmong-Regular.otf",
        "NotoSansPalmyrene-Regular.otf",
        "NotoSansPauCinHau-Regular.otf",
        "NotoSansPhagsPa-Regular.ttf",
        "NotoSansPhoenician-Regular.ttf",
        "NotoSansRejang-Regular.ttf",
        "NotoSansRunic-Regular.ttf",
        "NotoSansSamaritan-Regular.ttf",
        "NotoSansSaurashtra-Regular.ttf",
        "NotoSansSharada-Regular.otf",
        "NotoSansShavian-Regular.ttf",
        "NotoSansSinhala-VF.ttf",
        "NotoSansSinhalaUI-VF.ttf",
        "NotoSansSoraSompeng-Regular.otf",
        "NotoSansSoyombo-VF.ttf",
        "NotoSansSundanese-Regular.ttf",
        "NotoSansSylotiNagri-Regular.ttf",
        "NotoSansSymbols-Regular-Subsetted.ttf",
        "NotoSansSymbols-Regular-Subsetted2.ttf",
        "NotoSansSyriacEastern-Regular.ttf",
        "NotoSansSyriacEstrangela-Regular.ttf",
        "NotoSansSyriacWestern-Regular.ttf",
        "NotoSansTagalog-Regular.ttf",
        "NotoSansTagbanwa-Regular.ttf",
        "NotoSansTaiLe-Regular.ttf",
        "NotoSansTaiTham-Regular.ttf",
        "NotoSansTaiViet-Regular.ttf",
        "NotoSansTakri-VF.ttf",
        "NotoSansTamil-VF.ttf",
        "NotoSansTamilUI-VF.ttf",
        "NotoSansTelugu-VF.ttf",
        "NotoSansTeluguUI-VF.ttf",
        "NotoSansThaana-Bold.ttf",
        "NotoSansThaana-Regular.ttf",
        "NotoSansThai-Bold.ttf",
        "NotoSansThai-Regular.ttf",
        "NotoSansThaiUI-Bold.ttf",
        "NotoSansThaiUI-Regular.ttf",
        "NotoSansTifinagh-Regular.otf",
        "NotoSansUgaritic-Regular.ttf",
        "NotoSansVai-Regular.ttf",
        "NotoSansWancho-Regular.otf",
        "NotoSansWarangCiti-Regular.otf",
        "NotoSansYi-Regular.ttf",
        "NotoSerif-Bold.ttf",
        "NotoSerif-BoldItalic.ttf",
        "NotoSerif-Italic.ttf",
        "NotoSerif-Regular.ttf",
        "NotoSerifArmenian-VF.ttf",
        "NotoSerifBengali-VF.ttf",
        "NotoSerifCJK-Regular.ttc",
        "NotoSerifDevanagari-VF.ttf",
        "NotoSerifDogra-Regular.ttf",
        "NotoSerifEthiopic-VF.ttf",
        "NotoSerifGeorgian-VF.ttf",
        "NotoSerifGujarati-VF.ttf",
        "NotoSerifGurmukhi-VF.ttf",
        "NotoSerifHebrew-Bold.ttf",
        "NotoSerifHebrew-Regular.ttf",
        "NotoSerifHentaigana.ttf",
        "NotoSerifKannada-VF.ttf",
        "NotoSerifKhmer-Bold.otf",
        "NotoSerifKhmer-Regular.otf",
        "NotoSerifLao-Bold.ttf",
        "NotoSerifLao-Regular.ttf",
        "NotoSerifMalayalam-VF.ttf",
        "NotoSerifMyanmar-Bold.otf",
        "NotoSerifMyanmar-Regular.otf",
        "NotoSerifNyiakengPuachueHmong-VF.ttf",
        "NotoSerifSinhala-VF.ttf",
        "NotoSerifTamil-VF.ttf",
        "NotoSerifTelugu-VF.ttf",
        "NotoSerifThai-Bold.ttf",
        "NotoSerifThai-Regular.ttf",
        "NotoSerifTibetan-VF.ttf",
        "NotoSerifYezidi-VF.ttf",
        "Roboto-Regular.ttf",
        "RobotoFlex-Regular.ttf",
        "RobotoStatic-Regular.ttf",
        "SourceSansPro-Bold.ttf",
        "SourceSansPro-BoldItalic.ttf",
        "SourceSansPro-Italic.ttf",
        "SourceSansPro-Regular.ttf",
        "SourceSansPro-SemiBold.ttf",
        "SourceSansPro-SemiBoldItalic.ttf",
        "font_fallback.xml",
        "fonts.xml",
    ],
}

android_filesystem_defaults {
    name: "system_image_defaults",
    partition_name: "system",
    base_dir: "system",
    dirs: generic_rootdirs,
    symlinks: generic_symlinks,
    file_contexts: ":plat_file_contexts",
    linker_config: {
        gen_linker_config: true,
        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}"],
    },
    build_logtags: true,
    gen_aconfig_flags_pb: true,

    compile_multilib: "both",

    use_avb: true,
    avb_private_key: ":generic_system_sign_key",
    avb_algorithm: "SHA256_RSA4096",
    avb_hash_algorithm: "sha256",

    deps: [
        "abx",
        "aconfigd-system",
        "aflags",
        "am",
        "android.software.credentials.prebuilt.xml", // generic_system
        "android.software.webview.prebuilt.xml", // media_system
        "android.software.window_magnification.prebuilt.xml", // handheld_system
        "android.system.suspend-service",
        "apexd",
        "appops",
        "approved-ogki-builds.xml", // base_system
        "appwidget",
        "atrace",
        "audioserver",
        "bcc",
        "blank_screen",
        "blkid",
        "bmgr",
        "bootanimation",
        "bootstat",
        "bpfloader",
        "bu",
        "bugreport",
        "bugreportz",
        "cameraserver",
        "cgroups.json",
        "cmd",
        "content",
        "cppreopts.sh", // generic_system
        "credstore",
        "debuggerd",
        "device_config",
        "dirty-image-objects",
        "dmctl",
        "dmesgd",
        "dnsmasq",
        "dpm",
        "dump.erofs",
        "dumpstate",
        "dumpsys",
        "e2fsck",
        "enhanced-confirmation.xml", // base_system
        "etc_hosts",
        "flags_health_check",
        "framework-audio_effects.xml", // for handheld // handheld_system
        "framework-sysconfig.xml",
        "fs_config_dirs_system",
        "fs_config_files_system",
        "fsck.erofs",
        "fsck.f2fs", // for media_system
        "fsck_msdos",
        "fsverity-release-cert-der",
        "gatekeeperd",
        "gpu_counter_producer",
        "gpuservice",
        "group_system",
        "gsi_tool",
        "gsid",
        "heapprofd",
        "hid",
        "hiddenapi-package-whitelist.xml", // from runtime_libart
        "idc_data",
        "idmap2",
        "idmap2d",
        "ime",
        "incident",
        "incident-helper-cmd",
        "incident_helper",
        "incidentd",
        "init.environ.rc-soong",
        "init.usb.configfs.rc",
        "init.usb.rc",
        "init.zygote32.rc",
        "init.zygote64.rc",
        "init.zygote64_32.rc",
        "initial-package-stopped-states.xml",
        "input",
        "installd",
        "ip", // base_system
        "iptables",
        "kcmdlinectrl",
        "kernel-lifetimes.xml", // base_system
        "keychars_data",
        "keylayout_data",
        "keystore2",
        "ld.mc",
        "llkd", // base_system
        "lmkd", // base_system
        "locksettings", // base_system
        "logcat", // base_system
        "logd", // base_system
        "logpersist.start",
        "lpdump", // base_system
        "lshal", // base_system
        "make_f2fs", // media_system
        "mdnsd", // base_system
        "media_profiles_V1_0.dtd", // base_system
        "mediacodec.policy", // base_system
        "mediaextractor", // base_system
        "mediametrics", // base_system
        "misctrl", // from base_system
        "mke2fs", // base_system
        "mkfs.erofs", // base_system
        "monkey", // base_system
        "mtectrl", // base_system
        "ndc", // base_system
        "netd", // base_system
        "netutils-wrapper-1.0", // full_base
        "notice_xml_system",
        "odsign", // base_system
        "otapreopt_script", // generic_system
        "package-shareduid-allowlist.xml", // base_system
        "passwd_system", // base_system
        "perfetto", // base_system
        "ping", // base_system
        "ping6", // base_system
        "pintool", // base_system
        "platform.xml", // base_system
        "pm", // base_system
        "prefetch", //base_system
        "preinstalled-packages-asl-files.xml", // base_system
        "preinstalled-packages-platform-generic-system.xml", // generic_system
        "preinstalled-packages-platform-handheld-system.xml", // handheld_system
        "preinstalled-packages-platform.xml", // base_system
        "preinstalled-packages-strict-signature.xml", // base_system
        "preloaded-classes", // ok
        "printflags", // base_system
        "privapp-permissions-platform.xml", // base_system
        "prng_seeder", // base_system
        "public.libraries.android.txt",
        "recovery-persist", // base_system
        "recovery-refresh", // generic_system
        "requestsync", // media_system
        "resize2fs", // base_system
        "rss_hwm_reset", // base_system
        "run-as", // base_system
        "schedtest", // base_system
        "screencap", // base_system
        "screenrecord", // handheld_system
        "sdcard", // base_system
        "secdiscard", // base_system
        "sensorservice", // base_system
        "service", // base_system
        "servicemanager", // base_system
        "settings", // base_system
        "sfdo", // base_system
        "sgdisk", // base_system
        "sm", // base_system
        "snapshotctl", // base_system
        "snapuserd", // base_system
        "storaged", // base_system
        "surfaceflinger", // base_system
        "svc", // base_system
        "system_manifest.xml", // base_system
        "task_profiles.json", // base_system
        "tc", // base_system
        "telecom", // base_system
        "tombstoned", // base_system
        "traced", // base_system
        "traced_probes", // base_system
        "tradeinmode", // base_system
        "tune2fs", // base_system
        "uiautomator", // base_system
        "uinput", // base_system
        "uncrypt", // base_system
        "update_engine", // generic_system
        "update_engine_sideload", // recovery
        "update_verifier", // generic_system
        "usbd", // base_system
        "vdc", // base_system
        "virtual_camera", // handheld_system // release_package_virtual_camera
        "vold", // base_system
        "vr", // handheld_system
        "watchdogd", // base_system
        "wifi.rc", // base_system
        "wificond", // base_system
        "wm", // base_system
    ] + select(release_flag("RELEASE_PLATFORM_VERSION_CODENAME"), {
        "REL": [],
        default: [
            "android.software.preview_sdk.prebuilt.xml", // media_system
        ],
    }) + select(soong_config_variable("ANDROID", "release_package_profiling_module"), {
        "true": [
            "trace_redactor", // base_system (RELEASE_PACKAGE_PROFILING_MODULE)
        ],
        default: [],
    }) + select(release_flag("RELEASE_MEMORY_MANAGEMENT_DAEMON"), {
        true: [
            "mm_daemon", // base_system (RELEASE_MEMORY_MANAGEMENT_DAEMON)
        ],
        default: [],
    }) + select(product_variable("debuggable"), {
        true: [
            "adevice_fingerprint",
            "arping",
            "avbctl",
            "bootctl",
            "dmuserd",
            "evemu-record",
            "idlcli",
            "init-debug.rc",
            "iotop",
            "iperf3",
            "iw",
            "layertracegenerator",
            "logtagd.rc",
            "ot-cli-ftd",
            "ot-ctl",
            "procrank",
            "profcollectctl",
            "profcollectd",
            "record_binder",
            "sanitizer-status",
            "servicedispatcher",
            "showmap",
            "sqlite3",
            "ss",
            "start_with_lockagent",
            "strace",
            "su",
            "tinycap",
            "tinyhostless",
            "tinymix",
            "tinypcminfo",
            "tinyplay", // host
            "tracepath",
            "tracepath6",
            "traceroute6",
            "unwind_info",
            "unwind_reg_info",
            "unwind_symbols",
            "update_engine_client",
        ],
        default: [],
    }),
    multilib: {
        common: {
            deps: [
                "BackupRestoreConfirmation", // base_system
                "BasicDreams", // handheld_system
                "BlockedNumberProvider", // handheld_system
                "BluetoothMidiService", // handheld_system
                "BookmarkProvider", // handheld_system
                "BuiltInPrintService", // handheld_system
                "CalendarProvider", // handheld_system
                "CallLogBackup", // telephony_system
                "CameraExtensionsProxy", // handheld_system
                "CaptivePortalLogin", // handheld_system
                "CarrierDefaultApp", // telephony_system
                "CellBroadcastLegacyApp", // telephony_system
                "CertInstaller", // handheld_system
                "CompanionDeviceManager", // media_system
                "ContactsProvider", // base_system
                "CredentialManager", // handheld_system
                "DeviceAsWebcam", // handheld_system
                "DeviceDiagnostics", // handheld_system - internal
                "DocumentsUI", // handheld_system
                "DownloadProvider", // base_system
                "DownloadProviderUi", // handheld_system
                "DynamicSystemInstallationService", // base_system
                "E2eeContactKeysProvider", // base_system
                "EasterEgg", // handheld_system
                "ExtShared", // base_system
                "ExternalStorageProvider", // handheld_system
                "FusedLocation", // handheld_system
                "HTMLViewer", // media_system
                "InputDevices", // handheld_system
                "IntentResolver", // base_system
                "KeyChain", // handheld_system
                "LiveWallpapersPicker", // generic_system, full_base
                "LocalTransport", // base_system
                "ManagedProvisioning", // handheld_system
                "MediaProviderLegacy", // base_system
                "MmsService", // handheld_system
                "MtpService", // handheld_system
                "MusicFX", // handheld_system
                "NetworkStack", // base_system
                "ONS", // telephony_system
                "PacProcessor", // handheld_system
                "PackageInstaller", // base_system
                "PartnerBookmarksProvider", // generic_system
                "PrintRecommendationService", // handheld_system
                "PrintSpooler", // handheld_system
                "ProxyHandler", // handheld_system
                "SecureElement", // handheld_system
                "SettingsProvider", // base_system
                "SharedStorageBackup", // handheld_system
                "Shell", // base_system
                "SimAppDialog", // handheld_system
                "SoundPicker", // not installed by anyone
                "StatementService", // media_system
                "Stk", // generic_system
                "Tag", // generic_system
                "TeleService", // handheld_system
                "Telecom", // handheld_system
                "TelephonyProvider", // handheld_system
                "Traceur", // handheld_system
                "UserDictionaryProvider", // handheld_system
                "VpnDialogs", // handheld_system
                "WallpaperBackup", // base_system
                "adbd_system_api", // base_system
                "android.hidl.base-V1.0-java", // base_system
                "android.hidl.manager-V1.0-java", // base_system
                "android.test.base", // from runtime_libart
                "android.test.mock", // base_system
                "android.test.runner", // base_system
                "aosp_mainline_modules", // ok
                "build_flag_system", // base_system
                "charger_res_images", // generic_system
                "com.android.apex.cts.shim.v1_prebuilt", // ok
                "com.android.cellbroadcast", // telephony_system
                "com.android.future.usb.accessory", // media_system
                "com.android.location.provider", // base_system
                "com.android.media.remotedisplay", // media_system
                "com.android.media.remotedisplay.xml", // media_system
                "com.android.mediadrm.signer", // media_system
                "com.android.nfc_extras", // ok
                "com.android.nfcservices", // base_system (RELEASE_PACKAGE_NFC_STACK != NfcNci)
                "com.android.runtime", // ok
                "dex_bootjars",
                "ext", // from runtime_libart
                "framework-graphics", // base_system
                "framework-location", // base_system
                "framework-minus-apex-install-dependencies", // base_system
                "framework-connectivity-b", // base_system
                "framework_compatibility_matrix.device.xml",
                "generic_system_fonts", // ok
                "hwservicemanager_compat_symlink_module", // base_system
                "hyph-data",
                "ims-common", // base_system
                "init_system", // base_system
                "javax.obex", // base_system
                "llndk.libraries.txt", //ok
                "org.apache.http.legacy", // base_system
                "perfetto-extras", // system
                "sanitizer.libraries.txt", // base_system
                "selinux_policy_system_soong", // ok
                "services", // base_system
                "shell_and_utilities_system", // ok
                "system-build.prop",
                "system_compatibility_matrix.xml", //base_system
                "telephony-common", // libs from TeleService
                "voip-common", // base_system
            ] + select(soong_config_variable("ANDROID", "release_crashrecovery_module"), {
                "true": [
                    "com.android.crashrecovery", // base_system (RELEASE_CRASHRECOVERY_MODULE)
                ],
                default: [],
            }) + select(soong_config_variable("ANDROID", "release_package_profiling_module"), {
                "true": [
                    "com.android.profiling", // base_system (RELEASE_PACKAGE_PROFILING_MODULE)
                ],
                default: [],
            }) + select(release_flag("RELEASE_AVATAR_PICKER_APP"), {
                true: [
                    "AvatarPicker", // generic_system (RELEASE_AVATAR_PICKER_APP)
                ],
                default: [],
            }),
        },
        prefer32: {
            deps: [
                "drmserver", // media_system
                "mediaserver", // base_system
            ],
        },
        lib64: {
            deps: [
                "android.system.virtualizationcommon-ndk",
                "android.system.virtualizationservice-ndk",
                "libgsi",
                "servicemanager",
            ],
        },
        both: {
            deps: [
                "android.hardware.biometrics.fingerprint@2.1", // generic_system
                "android.hardware.radio.config@1.0", // generic_system
                "android.hardware.radio.deprecated@1.0", // generic_system
                "android.hardware.radio@1.0", // generic_system
                "android.hardware.radio@1.1", // generic_system
                "android.hardware.radio@1.2", // generic_system
                "android.hardware.radio@1.3", // generic_system
                "android.hardware.radio@1.4", // generic_system
                "android.hardware.secure_element@1.0", // generic_system
                "app_process", // base_system
                "boringssl_self_test", // base_system
                "heapprofd_client", // base_system
                "libEGL", // base_system
                "libEGL_angle", // base_system
                "libETC1", // base_system
                "libFFTEm", // base_system
                "libGLESv1_CM", // base_system
                "libGLESv1_CM_angle", // base_system
                "libGLESv2", // base_system
                "libGLESv2_angle", // base_system
                "libGLESv3", // base_system
                "libOpenMAXAL", // base_system
                "libOpenSLES", // base_system
                "libaaudio", // base_system
                "libalarm_jni", // base_system
                "libamidi", // base_system
                "libandroid",
                "libandroid_runtime",
                "libandroid_servers",
                "libandroidfw",
                "libartpalette-system",
                "libaudio-resampler", // generic-system
                "libaudioeffect_jni",
                "libaudiohal", // generic-system
                "libaudiopolicyengineconfigurable", // generic-system
                "libbinder",
                "libbinder_ndk",
                "libbinder_rpc_unstable",
                "libcamera2ndk",
                "libcgrouprc", // llndk library
                "libclang_rt.asan",
                "libcompiler_rt",
                "libcutils", // used by many libs
                "libdmabufheap", // used by many libs
                "libdrm", // used by many libs // generic_system
                "libdrmframework", // base_system
                "libdrmframework_jni", // base_system
                "libfdtrack", // base_system
                "libfilterfw", // base_system
                "libfilterpack_imageproc", // media_system
                "libfwdlockengine", // generic_system
                "libgatekeeper", // base_system
                "libgui", // base_system
                "libhardware", // base_system
                "libhardware_legacy", // base_system
                "libhidltransport", // generic_system
                "libhwbinder", // generic_system
                "libinput", // base_system
                "libinputflinger", // base_system
                "libiprouteutil", // base_system
                "libjnigraphics", // base_system
                "libjpeg", // base_system
                "liblog", // base_system
                "liblogwrap", // generic_system
                "liblz4", // generic_system
                "libmedia", // base_system
                "libmedia_jni", // base_system
                "libmediandk", // base_system
                "libminui", // generic_system
                "libmtp", // base_system
                "libnetd_client", // base_system
                "libnetlink", // base_system
                "libnetutils", // base_system
                "libneuralnetworks_packageinfo", // base_system
                "libnl", // generic_system
                "libpdfium", // base_system
                "libpolicy-subsystem", // generic_system
                "libpower", // base_system
                "libpowermanager", // base_system
                "libprotobuf-cpp-full", // generic_system
                "libradio_metadata", // base_system
                "librs_jni", // handheld_system
                "librtp_jni", // base_system
                "libsensorservice", // base_system
                "libsfplugin_ccodec", // base_system
                "libskia", // base_system
                "libsonic", // base_system
                "libsonivox", // base_system
                "libsoundpool", // base_system
                "libspeexresampler", // base_system
                "libsqlite", // base_system
                "libstagefright", // base_system
                "libstagefright_foundation", // base_system
                "libstagefright_omx", // base_system
                "libstdc++", // base_system
                "libsysutils", // base_system
                "libui", // base_system
                "libusbhost", // base_system
                "libutils", // base_system
                "libvendorsupport", // llndk library
                "libvintf_jni", // base_system
                "libvulkan", // base_system
                "libwebviewchromium_loader", // media_system
                "libwebviewchromium_plat_support", // media_system
                "libwilhelm", // base_system
                "linker", // base_system
            ] + select(soong_config_variable("ANDROID", "TARGET_DYNAMIC_64_32_DRMSERVER"), {
                "true": ["drmserver"],
                default: [],
            }) + select(soong_config_variable("ANDROID", "TARGET_DYNAMIC_64_32_MEDIASERVER"), {
                "true": ["mediaserver"],
                default: [],
            }),
        },
    },
    arch: {
        arm64: {
            deps: [
                "libclang_rt.hwasan",
                "libc_hwasan",
            ],
        },
    },
}

android_system_image {
    name: "aosp_shared_system_image",
    defaults: ["system_image_defaults"],
    dirs: android_rootdirs,
    symlinks: android_symlinks,
    type: "erofs",
    erofs: {
        compressor: "lz4hc,9",
        compress_hints: "erofs_compress_hints.txt",
    },
}
