//
// 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"],
}

genrule {
    name: "statslog-rkpd-java-gen",
    tools: ["stats-log-api-gen"],
    cmd: "$(location stats-log-api-gen) --java $(out) --module rkpd " +
        "--javaPackage com.android.rkpdapp.metrics --javaClass RkpdStatsLog",
    out: ["com/android/rkpdapp/metrics/RkpdStatsLog.java"],
}

aidl_interface {
    name: "com.android.rkpdapp-aidl",
    srcs: ["aidl/**/*.aidl"],
    local_include_dir: "aidl",
    unstable: true,
    backend: {
        cpp: {
            enabled: false,
        },
        java: {
            enabled: true,
            sdk_version: "module_current",
            min_sdk_version: "33",
            apex_available: [
                "com.android.rkpd",
            ],
        },
        ndk: {
            enabled: false,
        },
        rust: {
            enabled: false,
        },
    },
}

sdk {
    name: "rkpd-sdk",
    apexes: ["com.android.rkpd"],
}

android_app {
    name: "rkpdapp",
    sdk_version: "module_current",
    target_sdk_version: "36",
    min_sdk_version: "33",
    updatable: true,
    privileged: true,
    libs: [
        "framework-annotations-lib",
        "framework-connectivity.stubs.module_lib",
        "framework-connectivity-t.stubs.module_lib",
        "framework-statsd.stubs.module_lib",
    ],
    optimize: {
        proguard_flags_files: ["proguard.flags"],
    },
    static_libs: [
        "android.hardware.security.rkp-V3-java",
        "androidx.room_room-runtime",
        "androidx.sqlite_sqlite",
        "androidx.work_work-runtime",
        "cbor-java",
        "com.android.rkpdapp-aidl-java",
        "rkpd_aconfig_flags_lib",
    ],
    resource_dirs: ["res"],
    srcs: [
        ":statslog-rkpd-java-gen",
        "src/**/*.java",
    ],
    plugins: [
        "androidx.room_room-compiler-plugin",
    ],
    apex_available: [
        "com.android.rkpd",
    ],
    lint: {
        baseline_filename: "lint-baseline.xml",
    },
}
