// Copyright (C) 2021 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_team: "trendy_team_aaos_framework",
    default_applicable_licenses: ["Android-Apache-2.0"],
}

apex {
    name: "com.android.car.framework",
    defaults: ["com.android.car.framework-defaults"],
    manifest: "apex_manifest.json",
}

apex_defaults {
    bootclasspath_fragments: ["com.android.car.framework-bootclasspath-fragment"],
    systemserverclasspath_fragments: ["com.android.car.framework-systemserverclasspath-fragment"],

    // TODO(b/202031799) Fix jni dependencies
    //jni_libs: [
    //    "libcarservicejni",
    //],

    apps: [
        "CarServiceUpdatable",
        "ScriptExecutor",
    ],
    compile_multilib: "both",
    name: "com.android.car.framework-defaults",

    // TODO(b/288271411): enable it when car mainline module is supported
    // min_sdk_version: "33",
    file_contexts: ":com.android.car.framework-file_contexts",
    key: "com.android.car.framework.key",
    certificate: ":com.android.car.framework.certificate",

    // TODO(b/202773532) Enable this after all dependencies are resolved.
    updatable: false,
}

apex_key {
    name: "com.android.car.framework.key",
    public_key: "com.android.car.framework.avbpubkey",
    private_key: "com.android.car.framework.pem",
}

android_app_certificate {
    name: "com.android.car.framework.certificate",
    // This will use com.android.car.framework.x509.pem (the cert) and
    // com.android.car.framework.pk8 (the private key)
    certificate: "com.android.car.framework",
}

systemserverclasspath_fragment {
    name: "com.android.car.framework-systemserverclasspath-fragment",
    contents: ["car-frameworks-service-module"],
    apex_available: ["com.android.car.framework"],
}

bootclasspath_fragment {
    name: "com.android.car.framework-bootclasspath-fragment",
    contents: ["android.car-module"],
    apex_available: ["com.android.car.framework"],

    // The bootclasspath_fragments that provide APIs on which this depends.
    fragments: [
        {
            apex: "com.android.art",
            module: "art-bootclasspath-fragment",
        },
        // framework-statsd
        {
            apex: "com.android.os.statsd",
            module: "com.android.os.statsd-bootclasspath-fragment",
        },
        // frameworks-wifi
        {
            apex: "com.android.wifi",
            module: "com.android.wifi-bootclasspath-fragment",
        },
    ],

    // Additional stubs libraries that this fragment's contents use which are
    // not provided by another bootclasspath_fragment.
    additional_stubs: [
        "android-non-updatable",
    ],
    hidden_api: {

        // This module does not contain any split packages.
        split_packages: [],

        // The following packages currently only contain classes from this
        // bootclasspath_fragment but some of their sub-packages contain classes
        // from other bootclasspath modules. Packages should only be listed here
        // when necessary for legacy purposes, new packages should match a
        // package prefix.
        single_packages: [
            "android.car",
        ],

        // The following packages and all their subpackages currently only
        // contain classes from this bootclasspath_fragment. Listing a package
        // here won't prevent other bootclasspath modules from adding classes in
        // any of those packages but it will prevent them from adding those
        // classes into an API surface, e.g. public, system, etc.. Doing so will
        // result in a build failure due to inconsistent flags.
        package_prefixes: [
            "android.car.admin",
            "android.car.annotation",
            "android.car.app",
            "android.car.cluster",
            "android.car.content",
            "android.car.diagnostic",
            "android.car.drivingstate",
            "android.car.evs",
            "android.car.hardware",
            "android.car.input",
            "android.car.media",
            "android.car.navigation",
            "android.car.occupantawareness",
            "android.car.occupantconnection",
            "android.car.oem",
            "android.car.os",
            "android.car.projection",
            "android.car.remoteaccess",
            "android.car.settings",
            "android.car.storagemonitoring",
            "android.car.telemetry",
            "android.car.test",
            "android.car.user",
            "android.car.util",
            "android.car.view",
            "android.car.vms",
            "android.car.watchdog",
            "com.android.car",
        ],
    },

}
