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

Commit b8259798 authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Camera: remove the camera device version check during statusCallback

Since HAL1 support has been removed, we don't need to check the device
version in statusCallback any more.

This has the good side effect of fixing a bug during hotplug camera
removal. A hotplug camera may be removed from ProviderInfo::mDevices,
and when getDeviceVersion() is called, the camera ID cannot be found.

Test: Camera CTS
Bug: 189460959
Change-Id: I9b679f5e0276cfcae7a93b8c80b4847f3291c1e4
parent 844ef1be
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;
                }