// media_audio namespace flags

cc_defaults {
    name: "audio-aconfig-cc-defaults",
    host_supported: true,
}

aconfig_declarations {
    name: "com.android.media.audioclient-aconfig",
    package: "com.android.media.audioclient",
    container: "system",
    srcs: ["audioclient.aconfig"],
}

aconfig_declarations {
    name: "com.android.media.audioserver-aconfig",
    package: "com.android.media.audioserver",
    container: "system",
    srcs: ["audioserver.aconfig"],
}

aconfig_declarations {
    name: "com.android.media.audio-aconfig",
    package: "com.android.media.audio",
    container: "system",
    srcs: ["audio.aconfig"],
}

aconfig_declarations {
    name: "com.android.media.aaudio-aconfig",
    package: "com.android.media.aaudio",
    container: "system",
    srcs: ["aaudio.aconfig"],
}

cc_aconfig_library {
    name: "com.android.media.audioserver-aconfig-cc",
    aconfig_declarations: "com.android.media.audioserver-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
    double_loadable: true,
    host_supported: true,
    product_available: true,
    vendor_available: true,
    apex_available: [
        "//apex_available:platform",
        "com.android.media",
        "com.android.media.swcodec",
    ],
    min_sdk_version: "29",
}

cc_aconfig_library {
    name: "com.android.media.audioserver-aconfig-cc-ro",
    aconfig_declarations: "com.android.media.audioserver-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
    double_loadable: true,
    host_supported: true,
    product_available: true,
    vendor_available: true,
    apex_available: [
        "//apex_available:platform",
        "com.android.media",
        "com.android.media.swcodec",
    ],
    min_sdk_version: "29",
    mode: "force-read-only",
}

cc_aconfig_library {
    name: "com.android.media.audio-aconfig-cc",
    aconfig_declarations: "com.android.media.audio-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
    double_loadable: true,
    host_supported: true,
    product_available: true,
    vendor_available: true,
    // TODO(b/316909431) native_bridge_supported: true,
    apex_available: [
        "//apex_available:platform",
        "com.android.btservices",
        "com.android.media",
        "com.android.media.swcodec",
    ],
    min_sdk_version: "29",
}

cc_aconfig_library {
    name: "com.android.media.aaudio-aconfig-cc",
    aconfig_declarations: "com.android.media.aaudio-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
}

cc_aconfig_library {
    name: "com.android.media.audioclient-aconfig-cc",
    aconfig_declarations: "com.android.media.audioclient-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
}

java_aconfig_library {
    name: "com.android.media.audio-aconfig-java",
    aconfig_declarations: "com.android.media.audio-aconfig",
}

// For CTS usage
java_aconfig_library {
    name: "com.android.media.audioserver-aconfig-java",
    aconfig_declarations: "com.android.media.audioserver-aconfig",
}

// Framework available flags to follow
// Care must be taken to avoid namespace conflicts.
// These flags are accessible outside of the platform! Limit usage to @FlaggedApi wherever possible

aconfig_declarations {
    name: "android.media.audio-aconfig",
    package: "android.media.audio",
    container: "system",
    srcs: ["audio_framework.aconfig"],
    visibility: [
        "//frameworks/base/api",
        "//frameworks/base/core/res",
    ],
    exportable: true,
}

aconfig_declarations {
    name: "android.media.audiopolicy-aconfig",
    package: "android.media.audiopolicy",
    container: "system",
    srcs: ["audiopolicy_framework.aconfig"],
    visibility: ["//frameworks/base/api"],
}

aconfig_declarations {
    name: "android.media.midi-aconfig",
    package: "android.media.midi",
    container: "system",
    srcs: ["midi_flags.aconfig"],
    visibility: ["//frameworks/base/api"],
}

aconfig_declarations {
    name: "android.media.soundtrigger-aconfig",
    package: "android.media.soundtrigger",
    container: "system",
    srcs: ["soundtrigger.aconfig"],
}

java_aconfig_library {
    name: "android.media.audio-aconfig-java",
    aconfig_declarations: "android.media.audio-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

java_aconfig_library {
    name: "android.media.audio-aconfig-exported-java",
    aconfig_declarations: "android.media.audio-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
    min_sdk_version: "Tiramisu",
    mode: "exported",
    apex_available: [
        "com.android.btservices",
    ],
    visibility: [
        "//packages/modules/Bluetooth:__subpackages__",
    ],
}

java_aconfig_library {
    name: "android.media.audiopolicy-aconfig-java",
    aconfig_declarations: "android.media.audiopolicy-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
    min_sdk_version: "VanillaIceCream",
    apex_available: [
        "//apex_available:platform",
        "com.android.car.framework",
    ],
}

java_aconfig_library {
    name: "android.media.midi-aconfig-java",
    aconfig_declarations: "android.media.midi-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

java_aconfig_library {
    name: "android.media.soundtrigger-aconfig-java",
    aconfig_declarations: "android.media.soundtrigger-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

cc_aconfig_library {
    name: "android.media.audio-aconfig-cc",
    aconfig_declarations: "android.media.audio-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
}

cc_aconfig_library {
    name: "android.media.audiopolicy-aconfig-cc",
    aconfig_declarations: "android.media.audiopolicy-aconfig",
    defaults: ["audio-aconfig-cc-defaults"],
}

aconfig_declarations_group {
    name: "audio-framework-aconfig",
    java_aconfig_libraries: [
        "android.media.audio-aconfig-java",
        "android.media.audiopolicy-aconfig-java",
        "android.media.midi-aconfig-java",
        "android.media.soundtrigger-aconfig-java",
    ],
}
