/*
 * 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_android_sensors",
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["hardware_interfaces_license"],
}

cc_library_static {
    name: "libsensorsexampleimpl",
    vendor: true,
    shared_libs: [
        "libbase",
        "libfmq",
        "libpower",
        "libbinder_ndk",
        "android.hardware.sensors-V3-ndk",
    ],
    export_include_dirs: ["include"],
    srcs: [
        "Sensors.cpp",
        "Sensor.cpp",
    ],
    visibility: [
        ":__subpackages__",
        "//hardware/interfaces/tests/extension/sensors:__subpackages__",
    ],
}

cc_binary {
    name: "android.hardware.sensors-service.example",
    relative_install_path: "hw",
    installable: false, // install APEX below

    vendor: true,
    shared_libs: [
        "libbinder_ndk",
        "liblog",
    ],
    static_libs: [
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "android.hardware.sensors-V3-ndk",
        "android.system.suspend-V1-ndk",
        "libbase",
        "libcutils",
        "libfmq",
        "libpower",
        "libsensorsexampleimpl",
        "libutils",
    ],
    srcs: ["main.cpp"],
}

prebuilt_etc {
    name: "sensors-default.rc",
    src: "sensors-default.rc",
    installable: false,
}

prebuilt_etc {
    name: "sensors-default.xml",
    src: "sensors-default.xml",
    sub_dir: "vintf",
    installable: false,
}

// Default vendor APEX for android.hardware.sensors.
// Custom implementations may use override_apex based on this APEX.
apex {
    name: "com.android.hardware.sensors",
    manifest: "apex_manifest.json",
    key: "com.android.hardware.key",
    certificate: ":com.android.hardware.certificate",
    file_contexts: "file_contexts",
    updatable: false,
    vendor: true,

    binaries: ["android.hardware.sensors-service.example"],
    prebuilts: [
        "sensors-default.rc", // init rc
        "sensors-default.xml", // vintf fragment
    ],
}
