Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 808bb6d0 authored by shrikar's avatar shrikar
Browse files

Separated current and V3 VHAL impls

This allows us to define V3-specific modules so that we can create
reference VHAL implementations that do not depend on implementing V4
(current) AIDL APIs

Bug: 381304103
Test: m
Change-Id: Ibe80d472ccf36ca30c753e8510aac1fbdf4b175f
parent 4979c77a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,14 @@ package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

cc_defaults {
    name: "VehicleHalInterfaceDefaults-V3",
    static_libs: [
        "android.hardware.automotive.vehicle-V3-ndk",
        "android.hardware.automotive.vehicle.property-V4-ndk",
    ],
}

cc_defaults {
    name: "VehicleHalInterfaceDefaults",
    static_libs: [
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,15 @@ package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

cc_library_headers {
    name: "IVehicleGeneratedHeaders-V3-default",
    vendor_available: true,
    local_include_dirs: ["."],
    export_include_dirs: ["."],
    defaults: ["VehicleHalInterfaceDefaults-V3"],
    host_supported: true,
}

cc_library_headers {
    name: "IVehicleGeneratedHeaders-V3",
    vendor_available: true,
+42 −0
Original line number Diff line number Diff line
/*
 * 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_applicable_licenses: ["Android-Apache-2.0"],
}

cc_defaults {
    name: "VehicleHalDefaults-V3",
    static_libs: [
        "android-automotive-large-parcelable-lib",
        "libmath",
    ],
    shared_libs: [
        "libbase",
        "liblog",
        "libutils",
    ],
    cflags: [
        "-Wall",
        "-Wextra",
        "-Werror",
        "-Wthread-safety",
    ],
    defaults: [
        "VehicleHalInterfaceDefaults-V3",
        "android-automotive-large-parcelable-defaults",
    ],
}
+58 −0
Original line number Diff line number Diff line
# AIDL VHAL libraries and reference implementation.
---

This directory stores the libraries useful for implementing vendor AIDL VHAL.
This directory also stores a reference fake implementation for AIDL VHAL.

## default_config

Stores the default vehicle property configurations for reference vehicle HAL.
Vendor implementation could copy this library but must update the configuration
to meet their own requirements, e.g. enable or disable certain properties or
update the initial value for certain properties.

##	fake_impl

Contains libraries used specifically for the fake reference VHAL implementation.
These libraries are for test only and must not be directly used for vendor
VHAL implementation.

These libraries contain test-spcific logic and must not run directly on a real
vehicle.

## grpc

Stores code for GRPC based VHAL implementation.

## hardware

Defines an interface `IVehicleHardware.h` which vendor must implement for
vehicle-specific logic if they want to follow our reference VHAL design.

## proto

Stores Some protobuf files translated from AIDL VHAL interface types. These
files are used in GRPC VHAL implementation.

## utils

Defines a library `VehicleHalUtils-V3` which provides useful utility functions for
VHAL implementation. Vendor VHAL could use this library.

## vhal

Defines a library `DefaultVehicleHal` which provides generic logic for all VHAL
implementations (including reference VHAL). Vendor VHAL implementation could
use this library, along with their own implementation for `IVehicleHardware`
interface.

Also defines a binary `android.hardware.automotive.vehicle@V3-default-service`
which is the reference VHAL implementation. It implements `IVehicle.aidl`
interface. It uses `DefaultVehicleHal`, along with `FakeVehicleHardware`
(in fake_impl). It simulates the vehicle bus interaction by using an
in-memory map. Meaning that all properties (except for some special ones) are
just written into a hash map and read from a hash map without relying on any
hardware. As a result, the reference implementation can run on emulator or
any host environment.

Vendor must not directly use the reference implementation for a real vehicle.
 No newline at end of file
+66 −0
Original line number Diff line number Diff line
/*
 * 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"],
}

cc_library {
    name: "VehicleHalJsonConfigLoader-V3",
    vendor: true,
    srcs: ["src/*.cpp"],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
    defaults: ["VehicleHalDefaults-V3"],
    static_libs: ["VehicleHalUtils-V3"],
    header_libs: [
        "IVehicleGeneratedHeaders-V3-default",
    ],
    shared_libs: ["libjsoncpp"],
}

cc_library {
    name: "VehicleHalJsonConfigLoaderEnableTestProperties-V3",
    vendor: true,
    srcs: [
        "src/*.cpp",
        ":VhalTestVendorProperties-V3",
    ],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
    defaults: ["VehicleHalDefaults-V3"],
    static_libs: ["VehicleHalUtils-V3"],
    header_libs: [
        "IVehicleGeneratedHeaders-V3-default",
        "libbinder_headers",
    ],
    cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"],
    shared_libs: ["libjsoncpp"],
    host_supported: true,
}

cc_library_headers {
    name: "VehicleHalJsonConfigLoaderHeaders-V3",
    vendor: true,
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
    defaults: ["VehicleHalDefaults-V3"],
    static_libs: ["VehicleHalUtils-V3"],
    header_libs: [
        "IVehicleGeneratedHeaders-V3-default",
    ],
    shared_libs: ["libjsoncpp"],
}
Loading