Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b7dba8d authored by Eric Laurent's avatar Eric Laurent
Browse files

Fix BT SCO audio test application.

Catch exceptions when stopping the MediaRecorder in onPause().

Change-Id: I9f8b3dd4f0919cdc1ef21334be177596bfeef88e
parent 2e29cdae
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -429,7 +429,7 @@ public class ScoAudioTest extends Activity {
                    mMediaRecorder.start();
                    mState = 1;
                } catch (Exception e) {
                    Log.e(TAG, "Could start MediaRecorder: " + e.toString());
                    Log.e(TAG, "Could start MediaRecorder: ", e);
                    mMediaRecorder.release();
                    mMediaRecorder = null;
                    mState = 0;
@@ -439,7 +439,7 @@ public class ScoAudioTest extends Activity {
                    mMediaRecorder.stop();
                    mMediaRecorder.reset();
                } catch (Exception e) {
                    Log.e(TAG, "Could not stop MediaRecorder: " + e.toString());
                    Log.e(TAG, "Could not stop MediaRecorder: ", e);
                    mMediaRecorder.release();
                    mMediaRecorder = null;
                } finally {
@@ -466,7 +466,7 @@ public class ScoAudioTest extends Activity {
                mMediaRecorder.prepare();
            }
            catch (Exception e) {
                Log.e(TAG, "Could not prepare MediaRecorder: " + e.toString());
                Log.e(TAG, "Could not prepare MediaRecorder: ", e);
                mMediaRecorder.release();
                mMediaRecorder = null;
            }
@@ -475,10 +475,15 @@ public class ScoAudioTest extends Activity {
        @Override
        public void stop() {
            if (mMediaRecorder != null) {
                try {
                    mMediaRecorder.stop();
                } catch (Exception e) {
                    Log.e(TAG, "Could not stop MediaRecorder: ", e);
                } finally {
                    mMediaRecorder.release();
                    mMediaRecorder = null;
                }
            }
            updatePlayPauseButton();
        }