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

Commit 0019c711 authored by Tyler Trephan's avatar Tyler Trephan Committed by Android (Google) Code Review
Browse files

Merge "Provide an incomplete V4 VHAL default implementation." into main

parents ab50c03c 00283f81
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ cc_defaults {
cc_defaults {
    name: "VehicleHalInterfaceDefaults",
    static_libs: [
        "android.hardware.automotive.vehicle-V3-ndk",
        "android.hardware.automotive.vehicle-V4-ndk",
        "android.hardware.automotive.vehicle.property-V4-ndk",
    ],
}
@@ -45,7 +45,7 @@ rust_defaults {
aidl_interface_defaults {
    name: "android.hardware.automotive.vehicle-latest-defaults",
    imports: [
        "android.hardware.automotive.vehicle-V3",
        "android.hardware.automotive.vehicle-V4",
        "android.hardware.automotive.vehicle.property-V4",
    ],
}
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ android_test {
        ":IVehicleGeneratedJavaFiles-V4",
    ],
    static_libs: [
        "android.hardware.automotive.vehicle-V3-java",
        "android.hardware.automotive.vehicle-V4-java",
        "android.hardware.automotive.vehicle.property-V4-java",
        "androidx.test.runner",
        "truth",
+12 −0
Original line number Diff line number Diff line
@@ -70,6 +70,18 @@ class DefaultVehicleHal final : public aidlvhal::BnVehicle {
                                   const std::vector<int32_t>& propIds) override;
    ndk::ScopedAStatus returnSharedMemory(const CallbackType& callback,
                                          int64_t sharedMemoryId) override;
    ndk::ScopedAStatus getSupportedValuesLists(
            const std::vector<aidlvhal::PropIdAreaId>& propIdAreaIds,
            aidlvhal::SupportedValuesListResults* supportedValuesListResults) override;
    ndk::ScopedAStatus getMinMaxSupportedValue(
            const std::vector<aidlvhal::PropIdAreaId>& propIdAreaIds,
            aidlvhal::MinMaxSupportedValueResults* minMaxSupportedValueResults) override;
    ndk::ScopedAStatus registerSupportedValueChangeCallback(
            const std::shared_ptr<aidlvhal::IVehicleCallback>& callback,
            const std::vector<aidlvhal::PropIdAreaId>& propIdAreaIds) override;
    ndk::ScopedAStatus unregisterSupportedValueChangeCallback(
            const std::shared_ptr<aidlvhal::IVehicleCallback>& callback,
            const std::vector<aidlvhal::PropIdAreaId>& propIdAreaIds) override;
    binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;

    IVehicleHardware* getHardware();
+31 −0
Original line number Diff line number Diff line
@@ -49,12 +49,15 @@ using ::aidl::android::hardware::automotive::vehicle::GetValueRequest;
using ::aidl::android::hardware::automotive::vehicle::GetValueRequests;
using ::aidl::android::hardware::automotive::vehicle::GetValueResult;
using ::aidl::android::hardware::automotive::vehicle::GetValueResults;
using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback;
using ::aidl::android::hardware::automotive::vehicle::MinMaxSupportedValueResults;
using ::aidl::android::hardware::automotive::vehicle::SetValueRequest;
using ::aidl::android::hardware::automotive::vehicle::SetValueRequests;
using ::aidl::android::hardware::automotive::vehicle::SetValueResult;
using ::aidl::android::hardware::automotive::vehicle::SetValueResults;
using ::aidl::android::hardware::automotive::vehicle::StatusCode;
using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions;
using ::aidl::android::hardware::automotive::vehicle::SupportedValuesListResults;
using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs;
@@ -961,6 +964,34 @@ ScopedAStatus DefaultVehicleHal::returnSharedMemory(const CallbackType&, int64_t
    return ScopedAStatus::ok();
}

ScopedAStatus DefaultVehicleHal::getSupportedValuesLists(
        const std::vector<::aidl::android::hardware::automotive::vehicle::PropIdAreaId>&,
        SupportedValuesListResults*) {
    // TODO(b/381020465): Add relevant implementation.
    return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

ScopedAStatus DefaultVehicleHal::getMinMaxSupportedValue(
        const std::vector<::aidl::android::hardware::automotive::vehicle::PropIdAreaId>&,
        MinMaxSupportedValueResults*) {
    // TODO(b/381020465): Add relevant implementation.
    return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

ScopedAStatus DefaultVehicleHal::registerSupportedValueChangeCallback(
        const std::shared_ptr<IVehicleCallback>&,
        const std::vector<::aidl::android::hardware::automotive::vehicle::PropIdAreaId>&) {
    // TODO(b/381020465): Add relevant implementation.
    return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

ScopedAStatus DefaultVehicleHal::unregisterSupportedValueChangeCallback(
        const std::shared_ptr<IVehicleCallback>&,
        const std::vector<::aidl::android::hardware::automotive::vehicle::PropIdAreaId>&) {
    // TODO(b/381020465): Add relevant implementation.
    return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

IVehicleHardware* DefaultVehicleHal::getHardware() {
    return mVehicleHardware.get();
}
+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ namespace vehicle {
namespace {

using ::aidl::android::hardware::automotive::vehicle::GetValueResults;
using ::aidl::android::hardware::automotive::vehicle::PropIdAreaId;
using ::aidl::android::hardware::automotive::vehicle::SetValueResults;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues;
@@ -91,6 +92,11 @@ ScopedAStatus MockVehicleCallback::onPropertySetError(const VehiclePropErrors& r
    return result;
}

ScopedAStatus MockVehicleCallback::onSupportedValueChange(const std::vector<PropIdAreaId>&) {
    // TODO(b/381020465): Add relevant implementation.
    return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

std::optional<GetValueResults> MockVehicleCallback::nextGetValueResults() {
    std::scoped_lock<std::mutex> lockGuard(mLock);
    return pop(mGetValueResults);
Loading