package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["hardware_interfaces_license"],
}

cc_defaults {
    name: "aidlaudioservice_defaults",
    vendor: true,
    shared_libs: [
        "libalsautilsv2",
        "libaudioaidlcommon",
        "libaudioutils",
        "libbase",
        "libbinder_ndk",
        "libcutils",
        "libfmq",
        "libstagefright_foundation",
        "libtinyalsav2",
        "libutils",
        "libxml2",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
    ],
    header_libs: [
        "libaudio_system_headers",
        "libaudioaidl_headers",
        "libxsdc-utils",
    ],
}

cc_library {
    name: "libaudioservicesounddoseimpl",
    vendor: true,
    defaults: [
        "latest_android_media_audio_common_types_ndk_shared",
        "latest_android_hardware_audio_core_sounddose_ndk_shared",
        "latest_android_hardware_audio_sounddose_ndk_shared",
    ],
    export_include_dirs: ["include"],
    srcs: [
        "SoundDose.cpp",
    ],
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "libcutils",
        "libutils",
    ],
    visibility: [
        "//hardware/interfaces/audio/aidl/sounddose/default",
    ],
}

cc_library {
    name: "libaudioserviceexampleimpl",
    defaults: [
        "aidlaudioservice_defaults",
        "latest_android_media_audio_common_types_ndk_shared",
        "latest_android_hardware_audio_core_ndk_shared",
        "latest_android_hardware_audio_core_sounddose_ndk_shared",
    ],
    export_include_dirs: ["include"],
    srcs: [
        "AudioPolicyConfigXmlConverter.cpp",
        "Bluetooth.cpp",
        "Config.cpp",
        "Configuration.cpp",
        "EngineConfigXmlConverter.cpp",
        "Module.cpp",
        "SoundDose.cpp",
        "Stream.cpp",
        "StreamStub.cpp",
        "Telephony.cpp",
        "usb/ModuleUsb.cpp",
        "usb/StreamUsb.cpp",
        "usb/UsbAlsaMixerControl.cpp",
        "usb/UsbAlsaUtils.cpp",
    ],
    generated_sources: [
        "audio_policy_configuration_aidl_default",
        "audio_policy_engine_configuration_aidl_default",
    ],
    generated_headers: [
        "audio_policy_configuration_aidl_default",
        "audio_policy_engine_configuration_aidl_default",
    ],
    export_generated_headers: [
        "audio_policy_configuration_aidl_default",
        "audio_policy_engine_configuration_aidl_default",
    ],
    visibility: [
        ":__subpackages__",
    ],
}

cc_binary {
    name: "android.hardware.audio.service-aidl.example",
    relative_install_path: "hw",
    init_rc: ["android.hardware.audio.service-aidl.example.rc"],
    vintf_fragments: ["android.hardware.audio.service-aidl.xml"],
    defaults: [
        "aidlaudioservice_defaults",
        "latest_android_media_audio_common_types_ndk_shared",
        "latest_android_hardware_audio_core_sounddose_ndk_shared",
        "latest_android_hardware_audio_core_ndk_shared",
    ],
    static_libs: [
        "libaudioserviceexampleimpl",
    ],
    srcs: ["main.cpp"],
}

cc_defaults {
    name: "aidlaudioeffectservice_defaults",
    defaults: [
        "latest_android_media_audio_common_types_ndk_shared",
        "latest_android_hardware_audio_effect_ndk_shared",
    ],
    vendor: true,
    shared_libs: [
        "libaudioaidlcommon",
        "libbase",
        "libbinder_ndk",
        "libcutils",
        "libfmq",
        "liblog",
        "libutils",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
    ],
    header_libs: [
        "libaudioaidl_headers",
        "libaudio_system_headers",
        "libsystem_headers",
    ],
    cflags: [
        "-Wall",
        "-Wextra",
        "-Werror",
        "-Wthread-safety",
    ],
}

filegroup {
    name: "effectCommonFile",
    srcs: [
        "EffectThread.cpp",
        "EffectImpl.cpp",
    ],
}

cc_binary {
    name: "android.hardware.audio.effect.service-aidl.example",
    relative_install_path: "hw",
    init_rc: ["android.hardware.audio.effect.service-aidl.example.rc"],
    vintf_fragments: ["android.hardware.audio.effect.service-aidl.xml"],
    defaults: ["aidlaudioeffectservice_defaults"],
    shared_libs: [
        "libtinyxml2",
    ],
    srcs: [
        "EffectConfig.cpp",
        "EffectFactory.cpp",
        "EffectMain.cpp",
    ],
}

cc_library_headers {
    name: "libaudioaidl_headers",
    export_include_dirs: ["include"],
    vendor_available: true,
    host_supported: true,
}
