mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Discard voice note recording on error.
This commit is contained in:
@@ -48,14 +48,14 @@ public class AudioRecorder {
|
||||
if (this.uiHandler != null) {
|
||||
onAudioFocusChangeListener = focusChange -> {
|
||||
if (focusChange == AudioManager.AUDIOFOCUS_LOSS) {
|
||||
Log.i(TAG, "Audio focus change " + focusChange + " stopping recording");
|
||||
Log.i(TAG, "Audio focus change " + focusChange + " stopping recording via UI handler.");
|
||||
this.uiHandler.onRecordCanceled(false);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
onAudioFocusChangeListener = focusChange -> {
|
||||
if (focusChange == AudioManager.AUDIOFOCUS_LOSS) {
|
||||
Log.i(TAG, "Audio focus change " + focusChange + " stopping recording");
|
||||
Log.i(TAG, "Audio focus change " + focusChange + " stopping recording.");
|
||||
stopRecording();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3730,6 +3730,7 @@ public class ConversationParentFragment extends Fragment
|
||||
public void onError(Throwable t) {
|
||||
Toast.makeText(requireContext(), R.string.ConversationActivity_unable_to_record_audio, Toast.LENGTH_LONG).show();
|
||||
Log.e(TAG, "Error in RecordingSession.", t);
|
||||
recordingSession.discardRecording();
|
||||
recordingSession.dispose();
|
||||
recordingSession = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user