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

Commit 49a49a86 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Android (Google) Code Review
Browse files

Merge "Camera: remove the camera device version check during statusCallback" into sc-dev

parents 1f4ba5f9 b8259798
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -4051,25 +4051,13 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId,
        ALOGE("%s: Invalid camera id %s, skipping", __FUNCTION__, cameraId.string());
        return;
    }
    bool supportsHAL3 = false;
    // supportsCameraApi also holds mInterfaceMutex, we can't call it in the
    // HIDL onStatusChanged wrapper call (we'll hold mStatusListenerLock and
    // mInterfaceMutex together, which can lead to deadlocks)
    binder::Status sRet =
            supportsCameraApi(String16(cameraId), hardware::ICameraService::API_VERSION_2,
                    &supportsHAL3);
    if (!sRet.isOk()) {
        ALOGW("%s: Failed to determine if device supports HAL3 %s, supportsCameraApi call failed",
                __FUNCTION__, cameraId.string());
        return;
    }

    // Collect the logical cameras without holding mStatusLock in updateStatus
    // as that can lead to a deadlock(b/162192331).
    auto logicalCameraIds = getLogicalCameras(cameraId);
    // Update the status for this camera state, then send the onStatusChangedCallbacks to each
    // of the listeners with both the mStatusLock and mStatusListenerLock held
    state->updateStatus(status, cameraId, rejectSourceStates, [this, &deviceKind, &supportsHAL3,
    state->updateStatus(status, cameraId, rejectSourceStates, [this, &deviceKind,
                        &logicalCameraIds]
            (const String8& cameraId, StatusInternal status) {

@@ -4097,8 +4085,8 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId,
                bool isVendorListener = listener->isVendorListener();
                if (shouldSkipStatusUpdates(deviceKind, isVendorListener,
                        listener->getListenerPid(), listener->getListenerUid()) ||
                        (isVendorListener && !supportsHAL3)) {
                    ALOGV("Skipping discovery callback for system-only camera/HAL1 device %s",
                        isVendorListener) {
                    ALOGV("Skipping discovery callback for system-only camera device %s",
                            cameraId.c_str());
                    continue;
                }