diff options
Diffstat (limited to 'automotive')
8 files changed, 48 insertions, 45 deletions
diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp index 8b68fd6f0a..948d45ff85 100644 --- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp +++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp @@ -72,6 +72,8 @@ using ::android::hardware::automotive::evs::V1_1::BufferDesc; using ::android::hardware::automotive::evs::V1_0::DisplayDesc; using ::android::hardware::automotive::evs::V1_0::DisplayState; using ::android::hardware::graphics::common::V1_0::PixelFormat; +using ::android::frameworks::automotive::display::V1_0::HwDisplayConfig; +using ::android::frameworks::automotive::display::V1_0::HwDisplayState; using IEvsCamera_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsCamera; using IEvsCamera_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsCamera; using IEvsDisplay_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsDisplay; @@ -605,7 +607,10 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) { LOG(INFO) << "Display " << targetDisplayId << " is alreay in use."; // Get the display descriptor - pDisplay->getDisplayInfo_1_1([](const auto& config, const auto& state) { + pDisplay->getDisplayInfo_1_1([](const HwDisplayConfig& config, const HwDisplayState& state) { + ASSERT_GT(config.size(), 0); + ASSERT_GT(state.size(), 0); + android::DisplayConfig* pConfig = (android::DisplayConfig*)config.data(); const auto width = pConfig->resolution.getWidth(); const auto height = pConfig->resolution.getHeight(); diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp index 246246c12c..4c0963d56d 100644 --- a/automotive/vehicle/2.0/default/Android.bp +++ b/automotive/vehicle/2.0/default/Android.bp @@ -137,7 +137,6 @@ cc_library_static { local_include_dirs: ["common/include/vhal_v2_0"], export_include_dirs: ["impl"], srcs: [ - "impl/vhal_v2_0/EmulatedUserHal.cpp", "impl/vhal_v2_0/GeneratorHub.cpp", "impl/vhal_v2_0/JsonFakeValueGenerator.cpp", "impl/vhal_v2_0/LinearFakeValueGenerator.cpp", diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp index 47133fd162..ef29560588 100644 --- a/automotive/vehicle/2.0/default/VehicleService.cpp +++ b/automotive/vehicle/2.0/default/VehicleService.cpp @@ -34,7 +34,7 @@ using namespace android::hardware::automotive::vehicle::V2_0; int main(int /* argc */, char* /* argv */ []) { auto store = std::make_unique<VehiclePropertyStore>(); - auto connector = impl::makeEmulatedPassthroughConnector(); + auto connector = std::make_unique<impl::EmulatedVehicleConnector>(); auto userHal = connector->getEmulatedUserHal(); auto hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get(), userHal); auto emulator = std::make_unique<impl::VehicleEmulator>(hal.get()); diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index cf1840499c..dec2d8cb78 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -417,7 +417,7 @@ const ConfigDeclaration kVehicleProperties[]{ .minSampleRate = 1.0f, .maxSampleRate = 2.0f, }, - .initialValue = {.floatValues = {100.0f}}}, // units in meters + .initialValue = {.floatValues = {50000.0f}}}, // units in meters {.config = { diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp index 7f9362fdf4..ed3f4a2e8f 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp @@ -35,13 +35,33 @@ namespace V2_0 { namespace impl { -class EmulatedPassthroughConnector : public PassthroughConnector { - public: - bool onDump(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; -}; +EmulatedUserHal* EmulatedVehicleConnector::getEmulatedUserHal() { + return &mEmulatedUserHal; +} + +StatusCode EmulatedVehicleConnector::onSetProperty(const VehiclePropValue& value, + bool updateStatus) { + if (mEmulatedUserHal.isSupported(value.prop)) { + LOG(INFO) << "onSetProperty(): property " << value.prop << " will be handled by UserHal"; -bool EmulatedPassthroughConnector::onDump(const hidl_handle& handle, - const hidl_vec<hidl_string>& options) { + const auto& ret = mEmulatedUserHal.onSetProperty(value); + if (!ret.ok()) { + LOG(ERROR) << "onSetProperty(): HAL returned error: " << ret.error().message(); + return StatusCode(ret.error().code()); + } + auto updatedValue = ret.value().get(); + if (updatedValue != nullptr) { + LOG(INFO) << "onSetProperty(): updating property returned by HAL: " + << toString(*updatedValue); + onPropertyValueFromCar(*updatedValue, updateStatus); + } + return StatusCode::OK; + } + return this->VehicleHalServer::onSetProperty(value, updateStatus); +} + +bool EmulatedVehicleConnector::onDump(const hidl_handle& handle, + const hidl_vec<hidl_string>& options) { int fd = handle->data[0]; if (options.size() > 0) { @@ -68,10 +88,6 @@ bool EmulatedPassthroughConnector::onDump(const hidl_handle& handle, return true; } -PassthroughConnectorPtr makeEmulatedPassthroughConnector() { - return std::make_unique<EmulatedPassthroughConnector>(); -} - } // namespace impl } // namespace V2_0 diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h index 57cbb8b893..4c6c66150b 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h @@ -19,6 +19,7 @@ #include <vhal_v2_0/VehicleConnector.h> +#include "EmulatedUserHal.h" #include "VehicleHalClient.h" #include "VehicleHalServer.h" @@ -30,10 +31,20 @@ namespace V2_0 { namespace impl { -using PassthroughConnector = IPassThroughConnector<VehicleHalClient, VehicleHalServer>; -using PassthroughConnectorPtr = std::unique_ptr<PassthroughConnector>; +class EmulatedVehicleConnector : public IPassThroughConnector<VehicleHalClient, VehicleHalServer> { + public: + EmulatedVehicleConnector() {} -PassthroughConnectorPtr makeEmulatedPassthroughConnector(); + EmulatedUserHal* getEmulatedUserHal(); + + // Methods from VehicleHalServer + StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override; + + bool onDump(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; + + private: + EmulatedUserHal mEmulatedUserHal; +}; } // namespace impl diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp index 36f25345ae..0ee183596a 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp @@ -41,10 +41,6 @@ VehiclePropValuePool* VehicleHalServer::getValuePool() const { return mValuePool; } -EmulatedUserHal* VehicleHalServer::getEmulatedUserHal() { - return &mEmulatedUserHal; -} - void VehicleHalServer::setValuePool(VehiclePropValuePool* valuePool) { if (!valuePool) { LOG(WARNING) << __func__ << ": Setting value pool to nullptr!"; @@ -185,22 +181,6 @@ VehicleHalServer::VehiclePropValuePtr VehicleHalServer::createHwInputKeyProp( } StatusCode VehicleHalServer::onSetProperty(const VehiclePropValue& value, bool updateStatus) { - if (mEmulatedUserHal.isSupported(value.prop)) { - LOG(INFO) << "onSetProperty(): property " << value.prop << " will be handled by UserHal"; - - const auto& ret = mEmulatedUserHal.onSetProperty(value); - if (!ret.ok()) { - LOG(ERROR) << "onSetProperty(): HAL returned error: " << ret.error().message(); - return StatusCode(ret.error().code()); - } - auto updatedValue = ret.value().get(); - if (updatedValue != nullptr) { - LOG(INFO) << "onSetProperty(): updating property returned by HAL: " - << toString(*updatedValue); - onPropertyValueFromCar(*updatedValue, updateStatus); - } - return StatusCode::OK; - } LOG(DEBUG) << "onSetProperty(" << value.prop << ")"; // Some properties need to be treated non-trivially diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h index fca78bc822..117eadb1e2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h @@ -19,7 +19,6 @@ #include <vhal_v2_0/VehicleObjectPool.h> #include <vhal_v2_0/VehicleServer.h> -#include "EmulatedUserHal.h" #include "GeneratorHub.h" namespace android::hardware::automotive::vehicle::V2_0::impl { @@ -38,8 +37,6 @@ class VehicleHalServer : public IVehicleServer { // Set the Property Value Pool used in this server void setValuePool(VehiclePropValuePool* valuePool); - EmulatedUserHal* getEmulatedUserHal(); - private: using VehiclePropValuePtr = recyclable_ptr<VehiclePropValue>; @@ -56,11 +53,6 @@ class VehicleHalServer : public IVehicleServer { VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay); - // data members - - protected: - EmulatedUserHal mEmulatedUserHal; - private: GeneratorHub mGeneratorHub{ std::bind(&VehicleHalServer::onFakeValueGenerated, this, std::placeholders::_1)}; |