Preserve configured Telecom ownership when startup retries router cleanup

This commit is contained in:
evgeny committed 2026-10-29 13:34:23 +01:00
1 parent de72b6a799
commit e6c52ed413
2 files changed
+15 -1

No files matched your search

@@ -162,7 +162,11 @@ class CallAudioRouter {
@Synchronized fun start() {
if (started) return
if (cleanupPending) stop()
if (cleanupPending) {
val connection = telecom
stop()
bindTelecom(connection)
}
started = true
val startedAt = SystemClock.elapsedRealtime()
@@ -214,4 +214,14 @@ class CallAudioRouterCleanupTest {
audio.failures = emptySet(); router.stop()
assertFalse(router.cleanupPending); assertEquals(2, operation("stop sco")); assertEquals(2, operation("sco=false"))
}
@Test fun startupCleanupPreservesTheTelecomConnectionConfiguredBeforeStart() {
router.start(); adapter.connect(0)
audio.failures = setOf("unregister"); stopRejected()
val connection = UtunConnection()
router.bindTelecom(connection)
audio.failures = emptySet(); router.start()
assertSame(connection, router.telecom); assertEquals(listOf(AudioRoute.SPEAKER), connection.routeRequests)
assertFalse(router.cleanupPending)
}
}