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

java_library {
    name: "crashrecovery-statslog",
    srcs: [
        ":statslog-crashrecovery-java-gen",
    ],
    libs: [
        "framework-statsd.stubs.module_lib",
    ],
    apex_available: [
        "com.android.crashrecovery",
    ],
    installable: false,
    min_sdk_version: "35",
    sdk_version: "system_server_current",
}

java_defaults {
    name: "service-crashrecovery-shared",
    srcs: [
        ":service-crashrecovery-shared-srcs",
        ":services-crashrecovery-module-sources",
        "java/**/*.java",
    ],
    defaults: [
        "framework-system-server-module-defaults",
        "framework-system-server-module-optimize-defaults",
    ],
    static_libs: [
        "PlatformProperties",
        "com.android.crashrecovery.flags-aconfig-java",
        "crashrecovery-statslog",
        "libaconfig_java_proto_lite",
        "modules-utils-backgroundthread",
        "modules-utils-binary-xml",
        "modules-utils-fastxmlserializer",
        "modules-utils-handlerexecutor",
        "modules-utils-preconditions",
    ],
    libs: [
        "android.crashrecovery.flags-aconfig-java",
        "framework-configinfrastructure.stubs.module_lib",
        "framework-crashrecovery.impl",
        "framework-statsd.stubs.module_lib",
        "unsupportedappusage",
    ],
    min_sdk_version: "36",
    sdk_version: "system_server_current",
}

java_sdk_library {
    name: "service-crashrecovery",
    defaults: ["service-crashrecovery-shared"],
    permitted_packages: [
        "android.crashrecovery",
        "com.android.crashrecovery",
        "com.android.server",
    ],
    apex_available: [
        "com.android.crashrecovery",
    ],
    impl_library_visibility: [
        "//cts:__subpackages__",
        "//frameworks/base/services/tests:__subpackages__",
        "//frameworks/base/tests:__subpackages__",
        "//packages/modules/CrashRecovery:__subpackages__",
        "//test/cts-root/tests/packagewatchdog",
    ],
    aconfig_declarations: [
        "android.crashrecovery.flags-aconfig",
        "com.android.crashrecovery.flags-aconfig",
    ],
    jarjar_rules: "jarjar-rules.txt",
}

java_library {
    name: "service-crashrecovery-pre-jarjar",
    defaults: ["service-crashrecovery-shared"],
}
