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

Commit d3ce9690 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Add headers and macros for building VHAL server for AGL am: d5990965 am:...

Add headers and macros for building VHAL server for AGL am: d5990965 am: 47b61bce am: bd23061f

Change-Id: I2d5157201032e1c1082b6ba62cbf9db8bf17e752
parents 5b6edcbb bd23061f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <deque>
#include <map>
#include <mutex>
#include <memory>

#include <android/hardware/automotive/vehicle/2.0/types.h>

+6 −0
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@

#include <memory>

#ifdef __ANDROID__
#include <hidl/HidlSupport.h>
#endif

#include <android/hardware/automotive/vehicle/2.0/types.h>

@@ -69,6 +71,8 @@ size_t getVehicleRawValueVectorSize(
void copyVehicleRawValue(VehiclePropValue::RawValue* dest,
                                const VehiclePropValue::RawValue& src);

#ifdef __ANDROID__

template<typename T>
void shallowCopyHidlVec(hidl_vec<T>* dest, const hidl_vec<T>& src);

@@ -76,6 +80,8 @@ void shallowCopyHidlStr(hidl_string* dest, const hidl_string& src);

void shallowCopy(VehiclePropValue* dest, const VehiclePropValue& src);

#endif  // __ANDROID__

}  // namespace V2_0
}  // namespace vehicle
}  // namespace automotive
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ void VehiclePropValuePool::InternalPool::recycle(VehiclePropValue* o) {
        ALOGE("Discarding value for prop 0x%x because it contains "
                  "data that is not consistent with this pool. "
                  "Expected type: %d, vector size: %zu",
              o->prop, mPropType, mVectorSize);
              o->prop, toInt(mPropType), mVectorSize);
        delete o;
    } else {
        ObjectPool<VehiclePropValue>::recycle(o);
+11 −8
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ std::unique_ptr<VehiclePropValue> createVehiclePropValue(
        case VehiclePropertyType::MIXED:
            break; // Valid, but nothing to do.
        default:
            ALOGE("createVehiclePropValue: unknown type: %d", type);
            ALOGE("createVehiclePropValue: unknown type: %d", toInt(type));
            val.reset(nullptr);
    }
    return val;
@@ -78,13 +78,6 @@ size_t getVehicleRawValueVectorSize(
    }
}

template<typename T>
inline void copyHidlVec(hidl_vec <T>* dest, const hidl_vec <T>& src) {
    for (size_t i = 0; i < std::min(dest->size(), src.size()); i++) {
        (*dest)[i] = src[i];
    }
}

void copyVehicleRawValue(VehiclePropValue::RawValue* dest,
                         const VehiclePropValue::RawValue& src) {
    dest->int32Values = src.int32Values;
@@ -94,6 +87,15 @@ void copyVehicleRawValue(VehiclePropValue::RawValue* dest,
    dest->stringValue = src.stringValue;
}

#ifdef __ANDROID__

template<typename T>
inline void copyHidlVec(hidl_vec <T>* dest, const hidl_vec <T>& src) {
    for (size_t i = 0; i < std::min(dest->size(), src.size()); i++) {
        (*dest)[i] = src[i];
    }
}

template<typename T>
void shallowCopyHidlVec(hidl_vec <T>* dest, const hidl_vec <T>& src) {
    if (src.size() > 0) {
@@ -123,6 +125,7 @@ void shallowCopy(VehiclePropValue* dest, const VehiclePropValue& src) {
    shallowCopyHidlStr(&dest->value.stringValue, src.value.stringValue);
}

#endif  // __ANDROID__

//}  // namespace utils

+3 −2
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@
#ifndef android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_
#define android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_

#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
#include <android/hardware/automotive/vehicle/2.0/types.h>
#include <vhal_v2_0/VehicleUtils.h>

#include <map>

namespace android {
namespace hardware {
namespace automotive {
@@ -1017,7 +1019,6 @@ const ConfigDeclaration kVehicleProperties[]{
                                .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                        },
        },

};

}  // impl
Loading