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

Commit b1aaf9a7 authored by Kwangkyu Park's avatar Kwangkyu Park Committed by Emilian Peev
Browse files

Camera: Prevent simultenous HAL initialization

If camera client fails to initialize then connectHelper just return
error code without explicitly disconnect the client.
This could cause the HAL to be initialized between the conflicting
devies, if multiple camera connect attempt is invoked simultaneously.

This patch will prevent the situation by explicitly disconnecting the
client before returning the error code.

Bug: 290325991
Test: Manual test with the OEM application
Change-Id: I2d7a14c01ed5ae6e0f4335f1f0be5742c637b8ee
parent cbf1eb34
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2040,6 +2040,9 @@ Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String8&
        if (err != OK) {
            ALOGE("%s: Could not initialize client from HAL.", __FUNCTION__);
            // Errors could be from the HAL module open call or from AppOpsManager
            mServiceLock.unlock();
            client->disconnect();
            mServiceLock.lock();
            switch(err) {
                case BAD_VALUE:
                    return STATUS_ERROR_FMT(ERROR_ILLEGAL_ARGUMENT,