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

Commit 6566536c authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Cameraserver: Use multiple hwbinder threads

Some interactions between camera service and hwservicemanager require
multiple threads to execute without deadlocks, such as calling
getService() from within an onRegistered() callback.

Increase thread count to 3 to accomodate.

Also switch the order of listener registration and legacy provider
addition back to what it was originally.

Test: No deadlock when camera service is restarted
Bug: 35096594
Change-Id: I6def961d5765958fef284c0a1820e903abc851ef
parent b4d5ec0d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ LOCAL_SHARED_LIBRARIES := \
	libutils \
	libui \
	libbinder \
	libhidltransport \
	android.hardware.camera.common@1.0 \
	android.hardware.camera.provider@2.4 \
	android.hardware.camera.device@1.0 \
+4 −1
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
#define LOG_TAG "cameraserver"
//#define LOG_NDEBUG 0

// from LOCAL_C_INCLUDES
#include "CameraService.h"
#include <hidl/HidlTransportSupport.h>

using namespace android;

@@ -26,6 +26,9 @@ int main(int argc __unused, char** argv __unused)
{
    signal(SIGPIPE, SIG_IGN);

    // Set 3 threads for HIDL calls
    hardware::configureRpcThreadpool(3, /*willjoin*/ false);

    sp<ProcessState> proc(ProcessState::self());
    sp<IServiceManager> sm = defaultServiceManager();
    ALOGI("ServiceManager: %p", sm.get());
+3 −3
Original line number Diff line number Diff line
@@ -54,9 +54,6 @@ status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListe
    mListener = listener;
    mServiceProxy = proxy;

    // See if there's a passthrough HAL, but let's not complain if there's not
    addProvider(kLegacyProviderName, /*expected*/ false);

    // Registering will trigger notifications for all already-known providers
    bool success = mServiceProxy->registerForNotifications(
        /* instance name, empty means no filter */ "",
@@ -67,6 +64,9 @@ status_t CameraProviderManager::initialize(wp<CameraProviderManager::StatusListe
        return INVALID_OPERATION;
    }

    // See if there's a passthrough HAL, but let's not complain if there's not
    addProvider(kLegacyProviderName, /*expected*/ false);

    return OK;
}