question: @ WorkerThread public synchronized int stopRecord ( ) { if ( mRecorder == null ) { mState = STATE_IDLE ; return - 1 ; } int length = - 1 ; switch ( mState ) { case STATE_RECORDING : try { Thread . sleep ( STOP_AUDIO_RECORD_DELAY_MILLIS ) ; mRecorder . stop ( ) ; length = ( int ) ( ( System . currentTimeMillis ( ) - mSampleStart ) / 1000 ) ; } catch ( RuntimeException e ) { Log . w ( TAG , "stopRecord fail, stop fail(no audio data recorded): " + e . getMessage ( ) ) ; } catch ( InterruptedException e ) { Log . w ( TAG , "stopRecord fail, stop fail(InterruptedException): " + e . getMessage ( ) ) ; } case STATE_PREPARED : case STATE_IDLE : default : try { mRecorder . reset ( ) ; } catch ( RuntimeException e ) { Log . w ( TAG , "stopRecord fail, reset fail " + e . getMessage ( ) ) ; } mRecorder . release ( ) ; mRecorder = null ; mState = STATE_IDLE ; break ; } return length ; }
target:  stop record, and save audio file.