Camera: Try adding a passthrough legacy service

Listing by interface on passthrough only devices doesn't
return the legacy implementation that might be present.
For this case try to connect to the legacy provider and
check whether such implementation does in fact exist.

Bug: 62835396
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check
--skip-preconditions --module VtsHalCameraProviderV2_4Target -l INFO

Change-Id: Ifdc1b15392f5418fd0d949953bb6bdb1f3612ee8
This commit is contained in:
Emilian Peev
2017-06-30 08:19:19 -07:00
parent cb4ac8559d
commit 48a0992dd4

View File

@@ -100,6 +100,7 @@ using ::android::hardware::kSynchronizedReadWrite;
using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
using ::android::hidl::manager::V1_0::IServiceManager;
const char kCameraPassthroughServiceName[] = "legacy/0";
const char *kProviderFQName = "android.hardware.camera.provider@2.4::ICameraProvider";
const uint32_t kMaxPreviewWidth = 1920;
const uint32_t kMaxPreviewHeight = 1080;
@@ -257,6 +258,20 @@ void CameraHidlEnvironment::SetUp() {
}
});
std::string legacyName;
uint32_t legacyId;
ASSERT_TRUE(parseProviderName(kCameraPassthroughServiceName,
&legacyName /*out*/, &legacyId /*out*/));
auto legacyIt = mProviders.find(legacyName);
//Add any legacy passthrough implementations
if (legacyIt == mProviders.end()) {
sp<ICameraProvider> provider = ICameraProvider::tryGetService(
kCameraPassthroughServiceName);
if (nullptr != provider.get()) {
mProviders.emplace(legacyName, provider);
}
}
ASSERT_FALSE(mProviders.empty());
}