Loading audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h +3 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <functional> #include <list> #include <VtsHalHidlTargetTestEnvBase.h> #include <gtest/gtest.h> namespace android { Loading @@ -33,13 +34,13 @@ namespace utility { * Avoid destroying static objects after main return. * Post main return destruction leads to incorrect gtest timing measurements as * well as harder debuging if anything goes wrong during destruction. */ class Environment : public ::testing::Environment { class Environment : public ::testing::VtsHalHidlTargetTestEnvBase { public: using TearDownFunc = std::function<void()>; void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_back(std::move(tearDown)); } private: void TearDown() override { void HidlTearDown() override { // Call the tear downs in reverse order of insertion for (auto& tearDown : tearDowns) { tearDown(); Loading audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp +10 −3 Original line number Diff line number Diff line Loading @@ -88,8 +88,13 @@ using ::android::hardware::audio::common::V2_0::ThreadInfo; using namespace ::android::hardware::audio::common::test::utility; class AudioHidlTestEnvironment : public ::Environment { public: virtual void registerTestServices() override { registerTestService<IDevicesFactory>(); } }; // Instance to register global tearDown static Environment* environment; static AudioHidlTestEnvironment* environment; class HidlTest : public ::testing::VtsHalHidlTargetTestBase { protected: Loading @@ -109,7 +114,8 @@ class AudioHidlTest : public HidlTest { if (devicesFactory == nullptr) { environment->registerTearDown([] { devicesFactory.clear(); }); devicesFactory = ::testing::VtsHalHidlTargetTestBase::getService<IDevicesFactory>(); devicesFactory = ::testing::VtsHalHidlTargetTestBase::getService<IDevicesFactory>( environment->getServiceName<IDevicesFactory>("default")); } ASSERT_TRUE(devicesFactory != nullptr); } Loading Loading @@ -1265,9 +1271,10 @@ TEST_F(BoolAccessorPrimaryHidlTest, setGetHac) { ////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { environment = new Environment; environment = new AudioHidlTestEnvironment; ::testing::AddGlobalTestEnvironment(environment); ::testing::InitGoogleTest(&argc, argv); environment->init(&argc, argv); int status = RUN_ALL_TESTS(); return status; } automotive/vehicle/2.0/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ hidl_interface { "VehiclePropertyChangeMode", "VehiclePropertyGroup", "VehiclePropertyOperation", "VehiclePropertyStatus", "VehiclePropertyType", "VehicleRadioConstants", "VehicleTurnSignal", Loading @@ -66,6 +67,7 @@ hidl_interface { "VmsMessageWithLayerAndPublisherIdIntegerValuesIndex", "VmsMessageWithLayerIntegerValuesIndex", "VmsOfferingMessageIntegerValuesIndex", "VmsPublisherInformationIntegerValuesIndex", "VmsSubscriptionsStateIntegerValuesIndex", "Wheel", ], Loading automotive/vehicle/2.0/default/common/include/vhal_v2_0/SubscriptionManager.h +4 −8 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public: } void addOrUpdateSubscription(const SubscribeOptions &opts); bool isSubscribed(int32_t propId, int32_t areaId, SubscribeFlags flags); bool isSubscribed(int32_t propId, SubscribeFlags flags); std::vector<int32_t> getSubscribedProperties() const; private: Loading Loading @@ -87,8 +87,7 @@ public: /** * Constructs SubscriptionManager * * @param onPropertyUnsubscribed - this callback function will be called when there are no * more client subscribed to particular property. * @param onPropertyUnsubscribed - called when no more clients are subscribed to the property. */ SubscriptionManager(const OnPropertyUnsubscribed& onPropertyUnsubscribed) : mOnPropertyUnsubscribed(onPropertyUnsubscribed), Loading @@ -115,9 +114,7 @@ public: const std::vector<recyclable_ptr<VehiclePropValue>>& propValues, SubscribeFlags flags) const; std::list<sp<HalClient>> getSubscribedClients(int32_t propId, int32_t area, SubscribeFlags flags) const; std::list<sp<HalClient>> getSubscribedClients(int32_t propId, SubscribeFlags flags) const; /** * If there are no clients subscribed to given properties than callback function provided * in the constructor will be called. Loading @@ -125,7 +122,6 @@ public: void unsubscribe(ClientId clientId, int32_t propId); private: std::list<sp<HalClient>> getSubscribedClientsLocked(int32_t propId, int32_t area, SubscribeFlags flags) const; bool updateHalEventSubscriptionLocked(const SubscribeOptions& opts, SubscribeOptions* out); Loading automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHal.h +1 −4 Original line number Diff line number Diff line Loading @@ -48,17 +48,14 @@ public: /** * Subscribe to HAL property events. This method might be called multiple * times for the same vehicle property to update subscribed areas or sample * rate. * times for the same vehicle property to update sample rate. * * @param property to subscribe * @param areas a bitwise vehicle areas or 0 for all supported areas * @param sampleRate sample rate in Hz for properties that support sample * rate, e.g. for properties with * VehiclePropertyChangeMode::CONTINUOUS */ virtual StatusCode subscribe(int32_t property, int32_t areas, float sampleRate) = 0; /** Loading Loading
audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h +3 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <functional> #include <list> #include <VtsHalHidlTargetTestEnvBase.h> #include <gtest/gtest.h> namespace android { Loading @@ -33,13 +34,13 @@ namespace utility { * Avoid destroying static objects after main return. * Post main return destruction leads to incorrect gtest timing measurements as * well as harder debuging if anything goes wrong during destruction. */ class Environment : public ::testing::Environment { class Environment : public ::testing::VtsHalHidlTargetTestEnvBase { public: using TearDownFunc = std::function<void()>; void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_back(std::move(tearDown)); } private: void TearDown() override { void HidlTearDown() override { // Call the tear downs in reverse order of insertion for (auto& tearDown : tearDowns) { tearDown(); Loading
audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp +10 −3 Original line number Diff line number Diff line Loading @@ -88,8 +88,13 @@ using ::android::hardware::audio::common::V2_0::ThreadInfo; using namespace ::android::hardware::audio::common::test::utility; class AudioHidlTestEnvironment : public ::Environment { public: virtual void registerTestServices() override { registerTestService<IDevicesFactory>(); } }; // Instance to register global tearDown static Environment* environment; static AudioHidlTestEnvironment* environment; class HidlTest : public ::testing::VtsHalHidlTargetTestBase { protected: Loading @@ -109,7 +114,8 @@ class AudioHidlTest : public HidlTest { if (devicesFactory == nullptr) { environment->registerTearDown([] { devicesFactory.clear(); }); devicesFactory = ::testing::VtsHalHidlTargetTestBase::getService<IDevicesFactory>(); devicesFactory = ::testing::VtsHalHidlTargetTestBase::getService<IDevicesFactory>( environment->getServiceName<IDevicesFactory>("default")); } ASSERT_TRUE(devicesFactory != nullptr); } Loading Loading @@ -1265,9 +1271,10 @@ TEST_F(BoolAccessorPrimaryHidlTest, setGetHac) { ////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { environment = new Environment; environment = new AudioHidlTestEnvironment; ::testing::AddGlobalTestEnvironment(environment); ::testing::InitGoogleTest(&argc, argv); environment->init(&argc, argv); int status = RUN_ALL_TESTS(); return status; }
automotive/vehicle/2.0/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ hidl_interface { "VehiclePropertyChangeMode", "VehiclePropertyGroup", "VehiclePropertyOperation", "VehiclePropertyStatus", "VehiclePropertyType", "VehicleRadioConstants", "VehicleTurnSignal", Loading @@ -66,6 +67,7 @@ hidl_interface { "VmsMessageWithLayerAndPublisherIdIntegerValuesIndex", "VmsMessageWithLayerIntegerValuesIndex", "VmsOfferingMessageIntegerValuesIndex", "VmsPublisherInformationIntegerValuesIndex", "VmsSubscriptionsStateIntegerValuesIndex", "Wheel", ], Loading
automotive/vehicle/2.0/default/common/include/vhal_v2_0/SubscriptionManager.h +4 −8 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public: } void addOrUpdateSubscription(const SubscribeOptions &opts); bool isSubscribed(int32_t propId, int32_t areaId, SubscribeFlags flags); bool isSubscribed(int32_t propId, SubscribeFlags flags); std::vector<int32_t> getSubscribedProperties() const; private: Loading Loading @@ -87,8 +87,7 @@ public: /** * Constructs SubscriptionManager * * @param onPropertyUnsubscribed - this callback function will be called when there are no * more client subscribed to particular property. * @param onPropertyUnsubscribed - called when no more clients are subscribed to the property. */ SubscriptionManager(const OnPropertyUnsubscribed& onPropertyUnsubscribed) : mOnPropertyUnsubscribed(onPropertyUnsubscribed), Loading @@ -115,9 +114,7 @@ public: const std::vector<recyclable_ptr<VehiclePropValue>>& propValues, SubscribeFlags flags) const; std::list<sp<HalClient>> getSubscribedClients(int32_t propId, int32_t area, SubscribeFlags flags) const; std::list<sp<HalClient>> getSubscribedClients(int32_t propId, SubscribeFlags flags) const; /** * If there are no clients subscribed to given properties than callback function provided * in the constructor will be called. Loading @@ -125,7 +122,6 @@ public: void unsubscribe(ClientId clientId, int32_t propId); private: std::list<sp<HalClient>> getSubscribedClientsLocked(int32_t propId, int32_t area, SubscribeFlags flags) const; bool updateHalEventSubscriptionLocked(const SubscribeOptions& opts, SubscribeOptions* out); Loading
automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHal.h +1 −4 Original line number Diff line number Diff line Loading @@ -48,17 +48,14 @@ public: /** * Subscribe to HAL property events. This method might be called multiple * times for the same vehicle property to update subscribed areas or sample * rate. * times for the same vehicle property to update sample rate. * * @param property to subscribe * @param areas a bitwise vehicle areas or 0 for all supported areas * @param sampleRate sample rate in Hz for properties that support sample * rate, e.g. for properties with * VehiclePropertyChangeMode::CONTINUOUS */ virtual StatusCode subscribe(int32_t property, int32_t areas, float sampleRate) = 0; /** Loading