question: public void stopSnapshots ( ) { try { if ( CaptureSession != null ) CaptureSession . stopRepeating ( ) ; } catch ( CameraAccessException ex ) { ex . printStackTrace ( ) ; } try { if ( ( Recording ) && ( CaptureSession != null ) ) { InSession . acquire ( ) ; } } catch ( InterruptedException ex ) { ex . printStackTrace ( ) ; } if ( SnapHandler != null ) { try { long complete = CompletedFrame . get ( ) ; int delay = 0 ; while ( ImagedFrame . get ( ) < complete ) { synchronized ( CaptureResults ) { if ( CaptureResults . size ( ) == 0 ) break ; } synchronized ( this ) { wait ( 250 ) ; delay += 250 ; } if ( delay > MAX_WAIT_COMPLETION ) { Log . w ( LOGTAG , "Waited for " + delay + "ms for completion. Getting impatient and bailing out." ) ; break ; } } } catch ( InterruptedException ex ) { } SnapHandler . rollDone ( ) ; SnapHandler . waitRoll ( ) ; SnapHandler . cleanUp ( ) ; } synchronized ( CaptureResults ) { CaptureResults . clear ( ) ; } Recording = false ; synchronized ( PendingImages ) { processPendingImages ( ) ; } InSession . release ( ) ; try { if ( CaptureSession != null ) { if ( PreState == PreviewState . AAA_COMPLETE ) { PreviewBuilder . set ( CaptureRequest . CONTROL_AF_TRIGGER , CameraMetadata . CONTROL_AF_TRIGGER_CANCEL ) ; PreState = PreviewState . PREVIEW ; CaptureSession . capture ( PreviewBuilder . build ( ) , PreviewCallback , CameraHandler ) ; } CaptureSession . setRepeatingRequest ( PreviewRequest , PreviewCallback , CameraHandler ) ; } } catch ( CameraAccessException ex ) { ex . printStackTrace ( ) ; } }
target:  Stop the recording of snapshots and wait until all images have been saved.