package {
    default_team: "trendy_team_android_media_audio_framework",
    default_applicable_licenses: ["Android-Apache-2.0"],
}

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

cc_library {
    name: "libaudiopermission",

    srcs: [
        "NativePermissionController.cpp",
        "ValidatedAttributionSourceState.cpp",
    ],
    export_include_dirs: [
        "include",
    ],

    header_libs: [
        "libcutils_headers",
        "liberror_headers",
    ],
    export_header_lib_headers: [
        "liberror_headers",
    ],
    static_libs: [
        "audio-permission-aidl-cpp",
        "framework-permission-aidl-cpp",
    ],
    shared_libs: [
        "libbase",
        "libbinder",
        "liblog",
        "libutils",
    ],

    host_supported: true,
    sanitize: {
        integer_overflow: true,
    },
    cflags: [
        "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
        "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
        "-Wall",
        "-Wconditional-uninitialized",
        "-Wdeprecated",
        "-Werror",
        "-Werror=format",
        "-Werror=reorder-init-list",
        "-Wextra",
        "-Wextra-semi",
        "-Wimplicit-fallthrough",
        "-Wreorder-init-list",
        "-Wshadow-all",
        "-Wthread-safety",
        "-Wunreachable-code-aggressive",
    ],
    tidy: true,
    tidy_checks: [
        "android-*",
        "bugprone-*",
        "cert-*",
        "clang-analyzer-security*",
        "google-*",
        "misc-*",
        "modernize-*",
        "performance-*",
    ],
    tidy_checks_as_errors: [
        "android-*",
        "bugprone-*",
        "cert-*",
        "clang-analyzer-security*",
        "google-*",
        "misc-*",
        "modernize-*",
        "performance-*",
    ],
}

cc_test {
    name: "libaudiopermission_test",
    host_supported: true,
    defaults: [
        "libmediautils_tests_config",
    ],
    static_libs: [
        "audio-permission-aidl-cpp",
        "libaudiopermission",
        "framework-permission-aidl-cpp",
        "libgmock",
    ],
    shared_libs: [
        "libbase",
        "libbinder",
        "liblog",
        "libutils",
    ],
    srcs: [
        "tests/NativePermissionControllerTest.cpp",
        "tests/ValidatedAttributionSourceStateTest.cpp",
    ],
    test_options: {
        unit_test: true,
    },
    test_suites: ["general-tests"],
}
