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

Commit 4c5b1c77 authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

Camera: remove wait for remote HIDL interface

The new getService implementation does it.

Test: fixing Marlin flashlight control
Bug: 34821019
Change-Id: Ifd21f41313b85ef0abbd306d2862524e19b94e7d
parent e4806bbc
Loading
Loading
Loading
Loading
+19 −39
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ CameraProviderManager::~CameraProviderManager() {

status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListener> listener,
        ServiceInteractionProxy* proxy) {
    int numProviders = 0;
    {
    std::lock_guard<std::mutex> lock(mInterfaceMutex);
    if (proxy == nullptr) {
        ALOGE("%s: No valid service interaction proxy provided", __FUNCTION__);
@@ -66,24 +64,8 @@ status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListe
                "about camera providers", __FUNCTION__);
        return INVALID_OPERATION;
    }
        numProviders = mProviders.size();
    }

    if (numProviders == 0) {
        // Remote provider might have not been initialized
        // Wait for a bit and see if we get one registered
        std::mutex mtx;
        std::unique_lock<std::mutex> lock(mtx);
        mProviderRegistered.wait_for(lock, std::chrono::seconds(15));
        if (mProviders.size() == 0) {
            ALOGI("%s: Unable to get one registered provider within timeout!",
                    __FUNCTION__);
            std::lock_guard<std::mutex> lock(mInterfaceMutex);
    // See if there's a passthrough HAL, but let's not complain if there's not
    addProvider(kLegacyProviderName, /*expected*/ false);
        }
    }

    return OK;
}

@@ -294,7 +276,6 @@ hardware::Return<void> CameraProviderManager::onRegistration(
    std::lock_guard<std::mutex> lock(mInterfaceMutex);

    addProvider(name);
    mProviderRegistered.notify_one();
    return hardware::Return<void>();
}

@@ -335,12 +316,11 @@ status_t CameraProviderManager::addProvider(const std::string& newProvider, bool
            mServiceProxy->getService(newProvider);

    if (interface == nullptr) {
        if (expected) {
        ALOGW("%s: Camera provider HAL '%s' is not actually available", __FUNCTION__,
                newProvider.c_str());
        if (expected) {
            return BAD_VALUE;
        } else {
            // Not guaranteed to be found, so not an error if it wasn't
            return OK;
        }
    }
+0 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include <vector>
#include <string>
#include <mutex>
#include <condition_variable>

#include <camera/CameraParameters2.h>
#include <camera/CameraMetadata.h>
@@ -220,8 +219,6 @@ private:
    // All private members, unless otherwise noted, expect mInterfaceMutex to be locked before use
    mutable std::mutex mInterfaceMutex;

    std::condition_variable mProviderRegistered;

    // the status listener update callbacks will lock mStatusMutex
    mutable std::mutex mStatusListenerMutex;
    wp<StatusListener> mListener;