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

Commit d5990965 authored by Hao Chen's avatar Hao Chen Committed by Enrico Granata
Browse files

Add headers and macros for building VHAL server for AGL

It won't change the logic of Android codes.

Bug: 148877226
Bug: 150791171

Test: Android build won't break

Change-Id: I07006a4a3e20900a2fa90b84167d114f9ac45cfe
(cherry picked from commit 08096354)
Merged-In: I07006a4a3e20900a2fa90b84167d114f9ac45cfe
parent 4a936e37
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