Java Code Examples for android.hardware.camera2.CameraDevice#close()

The following examples show how to use android.hardware.camera2.CameraDevice#close() . 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: BlockingCameraManager.java    From Camera2 with Apache License 2.0 6 votes vote down vote up
@Override
public void onDisconnected(CameraDevice camera) {
    if (VERBOSE) {
        Log.v(TAG, "onDisconnected: camera "
                + ((camera != null) ? camera.getId() : "null"));
    }

    synchronized (mLock) {
        // Don't assert all initial states. onDisconnected can be called after camera
        // is successfully opened.
        assertEquals(false, mDisconnected);
        mNoReply = false;
        mDisconnected = true;
        mDevice = camera;
        mDeviceReady.open();

        if (mTimedOut && camera != null) {
            camera.close();
            return;
        }
    }

    if (mProxy != null) mProxy.onDisconnected(camera);
}
 
Example 2
Source File: Camera2Manager.java    From sandriosCamera with MIT License 5 votes vote down vote up
@Override
public void onDisconnected(@NonNull CameraDevice cameraDevice) {
    cameraDevice.close();
    currentInstance.cameraDevice = null;

    uiHandler.post(new Runnable() {
        @Override
        public void run() {
            cameraOpenListener.onCameraOpenError();
        }
    });
}
 
Example 3
Source File: Camera2Controller.java    From pixelvisualcorecamera with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(@NonNull CameraDevice cameraDevice, int error) {
  Log.w(TAG, "CameraDevice onError() id: " + cameraDevice.getId() + " error: " + error);
  openCloseLock.release();
  cameraDevice.close();
  Camera2Controller.this.cameraDevice = null;
}
 
Example 4
Source File: Camera2RawFragment.java    From android-Camera2Raw with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(CameraDevice cameraDevice, int error) {
    Log.e(TAG, "Received camera device error: " + error);
    synchronized (mCameraStateLock) {
        mState = STATE_CLOSED;
        mCameraOpenCloseLock.release();
        cameraDevice.close();
        mCameraDevice = null;
    }
    Activity activity = getActivity();
    if (null != activity) {
        activity.finish();
    }
}
 
Example 5
Source File: CameraTexture2.java    From PHONK with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onError(@NonNull CameraDevice cameraDevice, int error) {
    MLog.d(TAG, "onError");
    mCameraOpenCloseLock.release();
    cameraDevice.close();
    mCameraDevice = null;
}
 
Example 6
Source File: Camera2Renderer.java    From LPR with Apache License 2.0 4 votes vote down vote up
@Override
public void onDisconnected(CameraDevice cameraDevice) {
    cameraDevice.close();
    mCameraDevice = null;
    mCameraOpenCloseLock.release();
}
 
Example 7
Source File: JavaCamera2View.java    From pasm-yolov3-Android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onError(CameraDevice cameraDevice, int error) {
    cameraDevice.close();
    mCameraDevice = null;
}
 
Example 8
Source File: CameraHandler.java    From androidthings-imageclassifier with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(@NonNull CameraDevice cameraDevice, int i) {
    Log.d(TAG, "Camera device error, closing.");
    closeCaptureSession();
    cameraDevice.close();
}
 
Example 9
Source File: Camera2Renderer.java    From ml-authentication with Apache License 2.0 4 votes vote down vote up
@Override
public void onDisconnected(CameraDevice cameraDevice) {
    cameraDevice.close();
    mCameraDevice = null;
    mCameraOpenCloseLock.release();
}
 
Example 10
Source File: VideoCameraActivity.java    From Wrox-ProfessionalAndroid-4E with Apache License 2.0 4 votes vote down vote up
@Override
public void onDisconnected(@NonNull CameraDevice camera) {
  camera.close();
  mCamera = null;
}
 
Example 11
Source File: JavaCamera2View.java    From VIA-AI with MIT License 4 votes vote down vote up
@Override
public void onDisconnected(CameraDevice cameraDevice) {
    cameraDevice.close();
    mCameraDevice = null;
}
 
Example 12
Source File: Camera2Renderer.java    From OpenCvFaceDetect with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(CameraDevice cameraDevice, int error) {
    cameraDevice.close();
    mCameraDevice = null;
    mCameraOpenCloseLock.release();
}
 
Example 13
Source File: CameraThread.java    From CameraRecorder-android with MIT License 4 votes vote down vote up
@Override
public void onDisconnected(CameraDevice camera) {
    Log.d(TAG, "cameraDeviceCallback onDisconnected");
    camera.close();
    CameraThread.this.cameraDevice = null;
}
 
Example 14
Source File: FDCamera2Presenter.java    From Image-Detection-Samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onDisconnected(@NonNull CameraDevice camera) {
    cameraOpenCloseLock.release();
    camera.close();
    cameraDevice = null;
}
 
Example 15
Source File: Camera2Renderer.java    From faceswap with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(CameraDevice cameraDevice, int error) {
    cameraDevice.close();
    mCameraDevice = null;
    mCameraOpenCloseLock.release();
}
 
Example 16
Source File: DoorbellCamera.java    From androidthings-cameraCar with Apache License 2.0 4 votes vote down vote up
@Override
public void onDisconnected(CameraDevice cameraDevice) {
    Log.d(TAG, "Camera disconnected, closing.");
    cameraDevice.close();
}
 
Example 17
Source File: ScanQRActivity.java    From ScreenCapture with MIT License 4 votes vote down vote up
@Override
public void onError(@NonNull CameraDevice cameraDevice, int error) {
    cameraDevice.close();
    mCameraDevice = null;
    finish();
}
 
Example 18
Source File: Camera2Renderer.java    From ml-authentication with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(CameraDevice cameraDevice, int error) {
    cameraDevice.close();
    mCameraDevice = null;
    mCameraOpenCloseLock.release();
}
 
Example 19
Source File: CameraOps.java    From android-HdrViewfinder with Apache License 2.0 4 votes vote down vote up
@Override
public void onDisconnected(@NonNull CameraDevice camera) {
    mErrorDisplayer.showErrorDialog("The camera device has been disconnected.");
    camera.close();
    mCameraDevice = null;
}
 
Example 20
Source File: DoorbellCamera.java    From doorbell with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(CameraDevice cameraDevice, int i) {
    Log.d(TAG, "Camera device error, closing.");
    cameraDevice.close();
}