public void pauseAndWait() {
        CameraInstance instance = getCameraInstance();
        pause();
        long startTime = System.nanoTime();
        while(instance != null && !instance.isCameraClosed()) {
            if (System.nanoTime() - startTime > 2000000000) {
                // Don't wait for longer than 2 seconds
                break;
            }
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                break;
            }
        }
    }
Pause scanning and preview; waiting for the Camera to be closed.

This blocks the main thread.
zxing-android-embedded/src/com/journeyapps/barcodescanner/CameraPreview.java