Skip to content
Snippets Groups Projects
Commit 8d4a88ce authored by Dibyendu Roy's avatar Dibyendu Roy Committed by Gerrit - the friendly Code Review server
Browse files

FM: Fix ANR due to incorrect error handling in stopRecording

stopRecording() API gets called from onRecordingStopped() callback
function. As a result, when recording can't be stopped successfully
in error scenarios, stopRecording() gets called in loop.

This fix removes the call stopRecording() from callback function and
does the required UI update.

CRs-Fixed: 943288
Change-Id: I0e2ea2adeb0c603f16541d04a5a244bc1fcd51d7
parent 15a15bda
No related branches found
No related tags found
No related merge requests found
...@@ -1811,15 +1811,6 @@ public class FMRadio extends Activity ...@@ -1811,15 +1811,6 @@ public class FMRadio extends Activity
} }
private void stopRecording() { private void stopRecording() {
mRecording = false;
DebugToasts("Stopped Recording", Toast.LENGTH_SHORT);
if(null != mRecordUpdateHandlerThread) {
mRecordUpdateHandlerThread.interrupt();
}
if(null != mRecordingMsgTV) {
mRecordingMsgTV.setText("");
setRecordingStartImage();
}
if (mService != null) { if (mService != null) {
try { try {
mService.stopRecording(); mService.stopRecording();
...@@ -1827,7 +1818,6 @@ public class FMRadio extends Activity ...@@ -1827,7 +1818,6 @@ public class FMRadio extends Activity
e.printStackTrace(); e.printStackTrace();
} }
} }
invalidateOptionsMenu();
} }
private boolean isRecording() { private boolean isRecording() {
...@@ -3155,7 +3145,15 @@ public class FMRadio extends Activity ...@@ -3155,7 +3145,15 @@ public class FMRadio extends Activity
} }
public void onRecordingStopped() { public void onRecordingStopped() {
Log.d(LOGTAG, "mServiceCallbacks.onRecordingStopped:"); Log.d(LOGTAG, "mServiceCallbacks.onRecordingStopped:");
stopRecording(); mRecording = false;
if(null != mRecordUpdateHandlerThread) {
mRecordUpdateHandlerThread.interrupt();
}
if(null != mRecordingMsgTV) {
mRecordingMsgTV.setText("");
setRecordingStartImage();
}
invalidateOptionsMenu();
} }
public void onRecordingStarted() public void onRecordingStarted()
{ {
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment