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

audioflinger_datapath_tidy_errors = audioflinger_base_tidy_errors + [
    "modernize-avoid-c-arrays",
    "modernize-deprecated-headers",
    "modernize-pass-by-value",
    "modernize-use-auto",
    "modernize-use-nodiscard",

    // TODO(b/275642749) Reenable these warnings
    "-misc-non-private-member-variables-in-classes",
]

// Eventually use common tidy defaults
cc_defaults {
    name: "audioflinger_datapath_flags_defaults",
    // https://clang.llvm.org/docs/UsersManual.html#command-line-options
    // https://clang.llvm.org/docs/DiagnosticsReference.html
    cflags: audioflinger_base_cflags,
    // https://clang.llvm.org/extra/clang-tidy/
    tidy: true,
    tidy_checks: audioflinger_datapath_tidy_errors,
    tidy_checks_as_errors: audioflinger_datapath_tidy_errors,
    tidy_flags: [
        "-format-style=file",
    ],
}

cc_library {
    name: "libaudioflinger_datapath",

    defaults: [
        "audioflinger_datapath_flags_defaults",
        "latest_android_media_audio_common_types_cpp_shared",
    ],

    srcs: [
        "AudioHwDevice.cpp",
        "AudioStreamIn.cpp",
        "AudioStreamOut.cpp",
        "SpdifStreamIn.cpp",
        "SpdifStreamOut.cpp",
    ],

    header_libs: [
        "libaudioclient_headers",
        "libaudiohal_headers",
        "liberror_headers",
    ],

    shared_libs: [
        "audioclient-types-aidl-cpp",
        "av-types-aidl-cpp",
        "libaudioflinger_utils", // NBAIO_Tee
        "libaudioprocessing",
        "libaudiospdif",
        "libaudioutils",
        "libbase",
        "libcutils",
        "liblog",
        "libnbaio",
        "libutils", // refbase
    ],

    include_dirs: [
        "frameworks/av/services/audioflinger", // for configuration
    ],
}
