// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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

filegroup {
    name: "framework-configinfrastructure-sources",
    srcs: [
        "java/**/*.java",
        "java/**/*.aidl",
    ],
    exclude_srcs: [
        ":framework-configinfrastructure-ravenwood-sources",
    ],
    visibility: ["//visibility:private"],
}

java_sdk_library {
    name: "framework-configinfrastructure",
    srcs: [":framework-configinfrastructure-sources"],
    defaults: ["framework-module-defaults"],
    permitted_packages: [
        "android.internal.configinfra",
        "android.provider",
        "android.provider.flags",
        "android.provider.x",
        "android.provider.aidl",
        "android.os.flagging",
    ],
    apex_available: [
        "com.android.configinfrastructure",
    ],
    min_sdk_version: "34",
    sdk_version: "module_current",
    impl_library_visibility: [
        "//packages/modules/ConfigInfrastructure:__subpackages__",
        "//frameworks/base/ravenwood",
    ],
    libs: [
        "unsupportedappusage",
        "aconfig_storage_stub",
    ],
    static_libs: [
        "aconfigd_java_proto_lib_repackaged",
        "configinfra_framework_flags_java_lib",
        "modules-utils-build",
        "modules-utils-proto",
        "modules-utils-ravenwood",
        "aconfig_storage_file_java",
    ],
    aconfig_declarations: [
        "configinfra_framework_flags",
    ],
    jarjar_rules: ":framework-configinfrastructure-jarjar",
    lint: {
        baseline_filename: "lint-baseline.xml",
    },
}

filegroup {
    name: "framework-configinfrastructure-ravenwood-policies",
    srcs: [
        "framework-configinfrastructure-ravenwood-policies.txt",
    ],
    visibility: ["//frameworks/base/ravenwood"],
}

filegroup {
    name: "framework-configinfrastructure-ravenwood-sources",
    srcs: [
        "java/**/*_ravenwood.java",
        "java/**/RavenwoodConfigDataStore.java",
    ],
    visibility: ["//frameworks/base/ravenwood"],
}

aconfig_declarations {
    name: "configinfra_framework_flags",
    package: "android.provider.flags",
    container: "com.android.configinfrastructure",
    srcs: [
        "flags.aconfig",
    ],
    exportable: true,
}

java_aconfig_library {
    name: "configinfra_framework_flags_java_lib",
    min_sdk_version: "34",
    apex_available: [
        "com.android.configinfrastructure",
        "//apex_available:platform", // Used by DeviceConfigService
    ],
    visibility: [
        "//visibility:public",
    ],
    aconfig_declarations: "configinfra_framework_flags",
    sdk_version: "core_platform",
    libs: [
        "fake_device_config",
    ],
}

java_aconfig_library {
    name: "configinfra_framework_flags_java_exported_lib",
    mode: "exported",
    min_sdk_version: "34",
    apex_available: [
        "com.android.configinfrastructure",
        "//apex_available:platform", // Used by DeviceConfigService
    ],
    visibility: [
        "//visibility:public",
    ],
    aconfig_declarations: "configinfra_framework_flags",
    sdk_version: "core_platform",
    libs: [
        "fake_device_config",
    ],
}

filegroup {
    name: "framework-configinfrastructure-jarjar",
    srcs: [
        "jarjar-rules.txt",
    ],
}
