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

Commit d58b2ac7 authored by Ruben Brunk's avatar Ruben Brunk Committed by Android (Google) Code Review
Browse files

Merge "camera2: Add camera client eviction enforcement."

parents 377165c2 cc776718
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -530,4 +530,8 @@ int CameraParameters::previewFormatToEnum(const char* format) {
        -1;
}

bool CameraParameters::isEmpty() const {
    return mMap.isEmpty();
}

}; // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -108,6 +108,9 @@ public:
     */
    void getSupportedPreviewFormats(Vector<int>& formats) const;

    // Returns true if no keys are present
    bool isEmpty() const;

    // Parameter keys to communicate between camera application and driver.
    // The access (read/write, read only, or write only) is viewed from the
    // perspective of applications, not driver.
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ LOCAL_SRC_FILES:= \
    device3/StatusTracker.cpp \
    gui/RingBufferConsumer.cpp \
    utils/CameraTraces.cpp \
    utils/AutoConditionLock.cpp \

LOCAL_SHARED_LIBRARIES:= \
    libui \
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ sp<CameraDeviceBase> CameraDeviceFactory::createDevice(int cameraId) {
        case CAMERA_DEVICE_API_VERSION_3_0:
        case CAMERA_DEVICE_API_VERSION_3_1:
        case CAMERA_DEVICE_API_VERSION_3_2:
        case CAMERA_DEVICE_API_VERSION_3_3:
            device = new Camera3Device(cameraId);
            break;
        default:
+14 −0
Original line number Diff line number Diff line
@@ -110,6 +110,20 @@ status_t CameraFlashlight::setTorchMode(const String8& cameraId, bool enabled) {
    status_t res = OK;
    Mutex::Autolock l(mLock);

    if (mOpenedCameraIds.indexOf(cameraId) != NAME_NOT_FOUND) {
        // This case is needed to avoid state corruption during the following call sequence:
        // CameraService::setTorchMode for camera ID 0 begins, does torch status checks
        // CameraService::connect for camera ID 0 begins, calls prepareDeviceOpen, ends
        // CameraService::setTorchMode for camera ID 0 continues, calls
        //        CameraFlashlight::setTorchMode

        // TODO: Move torch status checks and state updates behind this CameraFlashlight lock
        // to avoid other similar race conditions.
        ALOGE("%s: Camera device %s is in use, cannot set torch mode.",
                __FUNCTION__, cameraId.string());
        return -EBUSY;
    }

    if (mFlashControl == NULL) {
        if (enabled == false) {
            return OK;
Loading