Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48a0992d authored by Emilian Peev's avatar Emilian Peev
Browse files

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
parent cb4ac855
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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());
}