mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
Calls: an Answer only while one rings; the call's alerts in the log
Phantom incoming calls were reported with nothing in the log to say where they came from. The log now says when the app shows a call ringing in (and from what) and when it's gone, and when the call's notification opens the app. And an Answer (or answer as fax) intent Android hands back later, as when the app comes back from Recents, does nothing with no call ringing: it went off hook for no call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
This commit is contained in:
2 files changed
+21
-1
No files matched your search
@@ -358,7 +358,16 @@ class ModemService : Service() {
|
||||
ModemState.incoming.state
|
||||
.map { c -> c?.takeIf { !it.ignored }?.let { it.since to it.from } }
|
||||
.distinctUntilChanged()
|
||||
.collect { callNotification(ModemState.incoming.state.value?.takeIf { !it.ignored }) }
|
||||
.collect {
|
||||
val c = ModemState.incoming.state.value
|
||||
// (in the log: what the call's popup and notification came from)
|
||||
if (c != null && !c.ignored) {
|
||||
log("a call ringing in (the modem's RING): its notification and popup" + (c.from?.let { " ($it)" } ?: ""))
|
||||
} else if (c == null) {
|
||||
log("the incoming call's notification and popup gone")
|
||||
}
|
||||
callNotification(c?.takeIf { !it.ignored })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +207,17 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
else -> return
|
||||
}
|
||||
val ringing = com.neodesktop.dmodem.modem.ModemState.incoming.state.value != null
|
||||
val stale = !ringing || i.flags and android.content.Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0
|
||||
com.neodesktop.dmodem.modem.ModemState.log.add(
|
||||
"app: the call's notification: ${i.action?.substringAfterLast('.')}" + if (stale) " (no call ringing: nothing done)" else "",
|
||||
)
|
||||
// (Android hands the intent that started the app back when it comes back from Recents: no answer
|
||||
// then, with no call ringing)
|
||||
if (stale) {
|
||||
i.action = null
|
||||
return
|
||||
}
|
||||
when (i.action) {
|
||||
ACTION_ANSWER -> {
|
||||
com.neodesktop.dmodem.modem.ModemState.answer()
|
||||
|
||||
Reference in new issue
Block a user