Drop the comments from the double start guard

Review feedback: the guard, the warning it logs and the test names carry
the meaning on their own.
This commit is contained in:
hayaksi1
2026-08-09 14:48:14 +03:00
parent e63c897ec2
commit b32d48f7f6
3 changed files with 0 additions and 8 deletions
@@ -72,11 +72,6 @@ class DefaultVoiceRecorder(
@RequiresPermission(Manifest.permission.RECORD_AUDIO)
override suspend fun startRecord() = lock.withLock {
// The composer can emit a second Start before the first recording has produced its first
// buffer, i.e. before the state flips away from Idle. Without this guard the second call
// orphans the first job and its AudioReader, which keeps the microphone open and keeps
// emitting Recording forever, so Stop and Delete appear to do nothing.
// See https://github.com/element-hq/element-x-android/issues/5780
if (recordingJob != null) {
Timber.w("Voice recorder is already recording, ignoring this start")
return@withLock
@@ -116,7 +116,6 @@ class DefaultVoiceRecorderTest {
voiceRecorder.state.test {
assertThat(awaitItem()).isEqualTo(VoiceRecorderState.Idle)
// Two taps landing before the state has flipped away from Idle.
voiceRecorder.startRecord()
voiceRecorder.startRecord()
assertThat(audioReaderFactory.createdCount).isEqualTo(1)
@@ -133,7 +132,6 @@ class DefaultVoiceRecorderTest {
duration = 5.seconds,
)
)
// An orphaned recording job would keep emitting Recording after the stop.
expectNoEvents()
}
}
@@ -16,7 +16,6 @@ import io.element.android.libraries.voicerecorder.impl.audio.AudioReader
class FakeAudioReaderFactory(
private val audio: List<Audio>
) : AudioReader.Factory {
/** Number of readers created so far, to assert that a second recording is never started. */
var createdCount: Int = 0
private set