Java Code Examples for android.hardware.Camera#CAMERA_ERROR_EVICTED

The following examples show how to use android.hardware.Camera#CAMERA_ERROR_EVICTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Camera1.java    From Lassi-Android with MIT License 6 votes vote down vote up
@Override
public void onError(int error, Camera camera) {
    if (error == Camera.CAMERA_ERROR_SERVER_DIED) {
        // Looks like this is recoverable.
        LOG.w("Recoverable error inside the onError callback.", "CAMERA_ERROR_SERVER_DIED");
        stopImmediately();
        start();
        return;
    }

    LOG.e("Internal Camera1 error.", error);
    Exception runtime = new RuntimeException(CameraLogger.lastMessage);
    int reason;
    switch (error) {
        case Camera.CAMERA_ERROR_EVICTED:
            reason = CameraException.REASON_DISCONNECTED;
            break;
        case Camera.CAMERA_ERROR_UNKNOWN:
            reason = CameraException.REASON_UNKNOWN;
            break;
        default:
            reason = CameraException.REASON_UNKNOWN;
    }
    throw new CameraException(runtime, reason);
}
 
Example 2
Source File: RequestThreadManager.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void onError(int i, Camera camera) {
    switch(i) {
        case Camera.CAMERA_ERROR_EVICTED: {
            flush();
            mDeviceState.setError(
                    CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DISCONNECTED);
        } break;
        case Camera.CAMERA_ERROR_DISABLED: {
            flush();
            mDeviceState.setError(
                    CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DISABLED);
        } break;
        default:  {
            Log.e(TAG, "Received error " + i + " from the Camera1 ErrorCallback");
            mDeviceState.setError(
                    CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE);
        } break;
    }
}