From b440b234cadb7b450670590b3348d6936d663605 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Tue, 10 May 2022 22:49:28 -0700 Subject: [PATCH 1/2] Corrects CameraStreamBuffering test case EvsManager returns BUFFER_NOT_AVAILABLE to AIDL clients when it fails to process setMaxFramesInFlight() call. Fix: 232021994 Test: atest VtsHalEvsTargetTest Change-Id: I8c6760a77e413cc168f40166e6e9eb472d3e6a12 --- automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index 09e1088ee4..d963253abd 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -528,7 +528,7 @@ TEST_P(EvsAidlTest, CameraStreamBuffering) { // Ask for a very large number of buffers in flight to ensure it errors correctly auto badResult = pCam->setMaxFramesInFlight(std::numeric_limits::max()); EXPECT_TRUE(!badResult.isOk() && badResult.getServiceSpecificError() == - static_cast(EvsResult::INVALID_ARG)); + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); // Now ask for exactly two buffers in flight as we'll test behavior in that case ASSERT_TRUE(pCam->setMaxFramesInFlight(kBuffersToHold).isOk()); From dbcf52c2b152e8422de909fa5dea83a599f5d13e Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Wed, 11 May 2022 00:01:31 -0700 Subject: [PATCH 2/2] Add a test to verify a status callback registration Bug: 195672428 Test: atest VtsHalEvsTargetTest Change-Id: I0f86c82379bbfa249f159cac0bd0564711394caa --- .../evs/aidl/vts/VtsHalEvsTargetTest.cpp | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index d963253abd..9c6c573174 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -19,9 +19,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -30,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -77,11 +80,11 @@ typedef struct { } RawStreamConfig; constexpr size_t kStreamCfgSz = sizeof(RawStreamConfig) / sizeof(int32_t); -} // namespace - +using ::aidl::android::hardware::automotive::evs::BnEvsEnumeratorStatusCallback; using ::aidl::android::hardware::automotive::evs::BufferDesc; using ::aidl::android::hardware::automotive::evs::CameraDesc; using ::aidl::android::hardware::automotive::evs::CameraParam; +using ::aidl::android::hardware::automotive::evs::DeviceStatus; using ::aidl::android::hardware::automotive::evs::DisplayDesc; using ::aidl::android::hardware::automotive::evs::DisplayState; using ::aidl::android::hardware::automotive::evs::EvsEventDesc; @@ -90,6 +93,7 @@ using ::aidl::android::hardware::automotive::evs::EvsResult; using ::aidl::android::hardware::automotive::evs::IEvsCamera; using ::aidl::android::hardware::automotive::evs::IEvsDisplay; using ::aidl::android::hardware::automotive::evs::IEvsEnumerator; +using ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback; using ::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray; using ::aidl::android::hardware::automotive::evs::ParameterRange; using ::aidl::android::hardware::automotive::evs::Stream; @@ -99,6 +103,8 @@ using ::aidl::android::hardware::graphics::common::HardwareBufferDescription; using ::aidl::android::hardware::graphics::common::PixelFormat; using std::chrono_literals::operator""s; +} // namespace + // The main test class for EVS class EvsAidlTest : public ::testing::TestWithParam { public: @@ -239,6 +245,13 @@ class EvsAidlTest : public ::testing::TestWithParam { return targetCfg; } + class DeviceStatusCallback : public BnEvsEnumeratorStatusCallback { + ndk::ScopedAStatus deviceStatusChanged(const std::vector&) override { + // This empty implementation returns always ok(). + return ndk::ScopedAStatus::ok(); + } + }; + // Every test needs access to the service std::shared_ptr mEnumerator; // Empty unless/util loadCameraList() is called @@ -2064,6 +2077,20 @@ TEST_P(EvsAidlTest, CameraStreamExternalBuffering) { } } +TEST_P(EvsAidlTest, DeviceStatusCallbackRegistration) { + std::shared_ptr cb = + ndk::SharedRefBase::make(); + ndk::ScopedAStatus status = mEnumerator->registerStatusCallback(cb); + if (mIsHwModule) { + ASSERT_TRUE(status.isOk()); + } else { + // A callback registration may fail if a HIDL EVS HAL implementation is + // running. + ASSERT_TRUE(status.isOk() || + status.getServiceSpecificError() == static_cast(EvsResult::NOT_SUPPORTED)); + } +} + /* * UltrasonicsArrayOpenClean: * Opens each ultrasonics arrays reported by the enumerator and then explicitly closes it via a