From cf3916a1fd35685d0dc6867d030edee066c0d271 Mon Sep 17 00:00:00 2001 From: Jeff Tinker Date: Fri, 7 Apr 2017 17:41:49 -0700 Subject: [PATCH] Support binderized and passthrough vendor services Previously only the vendor service name was used to get the drm and crypto services, which would work either for binderized or passthrough devices, but not both. With this change, the vendor service name is tried first, and failing that the default passthrough service is used. Change-Id: I05e9552da992e8d9dbba0f8dde485406262410a9 related-to-bug:34178477 Test: drm vts test --- .../vts/functional/drm_hal_vendor_test.cpp | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp index 7448c4253a..c8a5c59d09 100644 --- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp +++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp @@ -76,6 +76,7 @@ using std::vector; using ContentConfiguration = ::DrmHalVTSVendorModule_V1::ContentConfiguration; using Key = ::DrmHalVTSVendorModule_V1::ContentConfiguration::Key; +using VtsTestBase = ::testing::VtsHalHidlTargetTestBase; #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) #define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk()) @@ -104,14 +105,22 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam { GetParam().c_str()); ASSERT_NE(vendorModule, nullptr); + + // First try the binderized service name provided by the vendor module. + // If that fails, which it can on non-binderized devices, try the default + // service. string name = vendorModule->getServiceName(); - drmFactory = - ::testing::VtsHalHidlTargetTestBase::getService( - name != "default" ? name : "drm"); + drmFactory = VtsTestBase::getService(name); + if (drmFactory == nullptr) { + drmFactory = VtsTestBase::getService("drm"); + } ASSERT_NE(drmFactory, nullptr); - cryptoFactory = - ::testing::VtsHalHidlTargetTestBase::getService( - name != "default" ? name : "crypto"); + + // Dot the same for the crypto factory + cryptoFactory = VtsTestBase::getService(name); + if (cryptoFactory == nullptr) { + VtsTestBase::getService("crypto"); + } ASSERT_NE(cryptoFactory, nullptr); }