From 30f8443b4154a87653e72a301d53f6cf22eb8a18 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Thu, 1 Oct 2020 13:28:55 -0700 Subject: [PATCH] Handle the empty display information When the underlying display is not ready yet, IEvsDisplay::getDisplayInfo_1_1() returns an empty display information. When this happens, CameraToDisplayRoundTrip test case must fail because it verifies the camera and display hardware devices both. Fix: 169877399 Test: m -j vts and run CameraToDisplayRoundTrip Change-Id: I2ecb03d19a9088436e7701003944cd76af6c260a --- .../evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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();