communicate: log which path ends a call, and whether proceed configured media
- Commit
534daf19b14c6bc03ed23f734f3a3331096ee9e5- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-22 23:21 UTC (3 months ago)
- Parents
16b0885
Diff
communicate/src/main/java/com/vayunmathur/communicate/data/call/InAppCall.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/call/InAppCall.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/call/InAppCall.ktindex f00873ef49..d7a50403ef 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/call/InAppCall.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/call/InAppCall.kt@@ -60,6 +60,8 @@ interface InAppCallConnectionBridge { * Google Voice deliberately stays outside this: it already has its own Telecom integration. */ object InAppCallRegistry {+ private const val TAG = "InAppCallRegistry"+ private val _state = MutableStateFlow(InAppCallState()) val state: StateFlow<InAppCallState> = _state.asStateFlow() @@ -133,11 +135,21 @@ object InAppCallRegistry { // -- Actions, forwarded to whichever line owns the call -- - fun answer() = controller?.answer() ?: Unit+ /** [source] is logged so it is clear what ended a call; several paths can. */+ fun answer(source: String = "ui") {+ android.util.Log.i(TAG, "answer requested by $source")+ controller?.answer()+ } - fun reject() = controller?.reject() ?: Unit+ fun reject(source: String = "ui") {+ android.util.Log.i(TAG, "reject requested by $source")+ controller?.reject()+ } - fun hangup() = controller?.hangup() ?: Unit+ fun hangup(source: String = "ui") {+ android.util.Log.i(TAG, "hangup requested by $source")+ controller?.hangup()+ } fun toggleMuted() { val next = !_state.value.muted
communicate/src/main/java/com/vayunmathur/communicate/data/signal/call/SignalCallManager.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/signal/call/SignalCallManager.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/signal/call/SignalCallManager.ktindex 62130742e3..413219d8f1 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/signal/call/SignalCallManager.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/signal/call/SignalCallManager.kt@@ -248,6 +248,7 @@ class SignalCallManager( mediaType.isVideo(), null, )+ Log.i(TAG, "proceed ok for call $callId with ${iceServers.size} ICE servers") } catch (t: Throwable) { Log.w(TAG, "proceed failed for call $callId", t) }@@ -261,6 +262,7 @@ class SignalCallManager( override fun onCallEvent(remote: Remote?, event: CallManager.CallEvent?) { val aci = (remote as? SignalRemote)?.aci ?: return+ Log.i(TAG, "call event for $aci: $event") val state = when (event) { CallManager.CallEvent.LOCAL_CONNECTED, CallManager.CallEvent.REMOTE_CONNECTED -> CallState.Connected CallManager.CallEvent.LOCAL_RINGING, CallManager.CallEvent.REMOTE_RINGING -> CallState.Ringing
communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallForegroundService.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallForegroundService.kt b/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallForegroundService.ktindex e21caca567..5f2ea427e2 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallForegroundService.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallForegroundService.kt@@ -36,12 +36,12 @@ class InAppCallForegroundService : Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { when (intent?.action) {- ACTION_ANSWER -> InAppCallRegistry.answer()+ ACTION_ANSWER -> InAppCallRegistry.answer("notification") ACTION_HANGUP -> { if (InAppCallRegistry.state.value.phase == InAppCallPhase.Incoming) {- InAppCallRegistry.reject()+ InAppCallRegistry.reject("notification") } else {- InAppCallRegistry.hangup()+ InAppCallRegistry.hangup("notification") } } }
communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallTelecom.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallTelecom.kt b/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallTelecom.ktindex c62f7b1064..7379c23ebe 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallTelecom.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/telephony/InAppCallTelecom.kt@@ -90,23 +90,23 @@ class InAppCallConnection : Connection(), InAppCallConnectionBridge { } override fun onAnswer() {- InAppCallRegistry.answer()+ InAppCallRegistry.answer("telecom.onAnswer") } override fun onReject() {- InAppCallRegistry.reject()+ InAppCallRegistry.reject("telecom.onReject") setDisconnected(DisconnectCause(DisconnectCause.REJECTED)) destroy() } override fun onDisconnect() {- InAppCallRegistry.hangup()+ InAppCallRegistry.hangup("telecom.onDisconnect") setDisconnected(DisconnectCause(DisconnectCause.LOCAL)) destroy() } override fun onAbort() {- InAppCallRegistry.hangup()+ InAppCallRegistry.hangup("telecom.onAbort") setDisconnected(DisconnectCause(DisconnectCause.CANCELED)) destroy() }