Prevent competing Android capture while broadcasting

This commit is contained in:
evgeny committed 2026-10-12 02:07:04 +02:00
1 parent 3f809a816b
commit a5fde68ebf
3 files changed
+4

No files matched your search

@@ -138,6 +138,7 @@ class AudioRecorderManager {
fun isActive(): Boolean = isRecording
fun startMicTest(): Boolean {
if (StreamController.blocksCapture()) return false
if (isTesting) return true
if (!hasPermission()) return false
@@ -86,6 +86,7 @@ object CallController : TelecomCallManager.Listener {
fun start(channelId: String, peerNodeId: Long, peerName: String) {
checkMain()
if (StreamController.blocksCapture()) return
if (channelId.isEmpty() || peerNodeId == 0L) {
LogManager.addLog("ERROR", "Call", "invalid outgoing call channel=$channelId peer=$peerNodeId")
return
@@ -107,6 +108,7 @@ object CallController : TelecomCallManager.Listener {
fun accept() {
checkMain()
if (StreamController.blocksCapture()) return
val st = _state.value ?: return
if (st.phase != CallPhase.INCOMING || accepting) {
LogManager.addLog("WARN", "Call", "accept ignored id=${st.callId} phase=${st.phase} accepting=$accepting")
@@ -910,6 +910,7 @@ class ChatViewModel : ViewModel() {
val groupId = ch.id.toULongOrNull()?.toLong() ?: return
val wasOnHere = radioChannelId == ch.id
val next = !wasOnHere
if (next && com.utun.chat.data.StreamController.blocksCapture()) return
radioToggleCount++
val caller = Throwable().stackTrace.drop(1).take(8)
.joinToString(" <- ") { "${it.className.substringAfterLast('.')}.${it.methodName}:${it.lineNumber}" }