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

Commit a485dfec authored by Ruben Brunk's avatar Ruben Brunk
Browse files

camera: Actually pass device errors to client for Camera2Device.

Bug: 19186859
Change-Id: Ib58588dfd99956b719c34e62c596ea604d97edcb
parent 4f9576bf
Loading
Loading
Loading
Loading
+34 −0
Original line number Original line Diff line number Diff line
@@ -1709,6 +1709,40 @@ status_t Camera2Client::commandSetVideoBufferCountL(size_t count) {
    return mStreamingProcessor->setRecordingBufferCount(count);
    return mStreamingProcessor->setRecordingBufferCount(count);
}
}


void Camera2Client::notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
        const CaptureResultExtras& resultExtras) {
    int32_t err = CAMERA_ERROR_UNKNOWN;
    switch(errorCode) {
        case ICameraDeviceCallbacks::ERROR_CAMERA_DISCONNECTED:
            err = CAMERA_ERROR_RELEASED;
            break;
        case ICameraDeviceCallbacks::ERROR_CAMERA_DEVICE:
            err = CAMERA_ERROR_UNKNOWN;
            break;
        case ICameraDeviceCallbacks::ERROR_CAMERA_SERVICE:
            err = CAMERA_ERROR_SERVER_DIED;
            break;
        case ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST:
        case ICameraDeviceCallbacks::ERROR_CAMERA_RESULT:
        case ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER:
            ALOGW("%s: Received recoverable error %d from HAL - ignoring, requestId %" PRId32,
                    __FUNCTION__, errorCode, resultExtras.requestId);
            return;
        default:
            err = CAMERA_ERROR_UNKNOWN;
            break;
    }

    ALOGE("%s: Error condition %d reported by HAL, requestId %" PRId32, __FUNCTION__, errorCode,
              resultExtras.requestId);

    SharedCameraCallbacks::Lock l(mSharedCameraCallbacks);
    if (l.mRemoteCallback != nullptr) {
        l.mRemoteCallback->notifyCallback(CAMERA_MSG_ERROR, err, 0);
    }
}


/** Device-related methods */
/** Device-related methods */
void Camera2Client::notifyAutoFocus(uint8_t newState, int triggerId) {
void Camera2Client::notifyAutoFocus(uint8_t newState, int triggerId) {
    ALOGV("%s: Autofocus state now %d, last trigger %d",
    ALOGV("%s: Autofocus state now %d, last trigger %d",
+2 −0
Original line number Original line Diff line number Diff line
@@ -77,6 +77,8 @@ public:
    virtual status_t        setParameters(const String8& params);
    virtual status_t        setParameters(const String8& params);
    virtual String8         getParameters() const;
    virtual String8         getParameters() const;
    virtual status_t        sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
    virtual status_t        sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
    virtual void            notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
                                        const CaptureResultExtras& resultExtras);


    /**
    /**
     * Interface used by CameraService
     * Interface used by CameraService