diff --git a/tools/chatgui-android/router-tests/src/main/kotlin/android/os/HostOs.kt b/tools/chatgui-android/router-tests/src/main/kotlin/android/os/HostOs.kt index b8be65986..057a76f6d 100644 --- a/tools/chatgui-android/router-tests/src/main/kotlin/android/os/HostOs.kt +++ b/tools/chatgui-android/router-tests/src/main/kotlin/android/os/HostOs.kt @@ -46,6 +46,11 @@ object SystemClock { fun elapsedRealtimeNanos(): Long = System.nanoTime() } +object Process { + const val THREAD_PRIORITY_AUDIO = -16 + fun setThreadPriority(priority: Int) { check(priority == THREAD_PRIORITY_AUDIO) } +} + /** Конечные vibration pulses без аппаратных эффектов; тест может отказать на любом импульсе. */ class VibrationEffect private constructor(val timings: LongArray, val repeat: Int) { companion object { fun createWaveform(timings: LongArray, repeat: Int) = VibrationEffect(timings.copyOf(), repeat) } diff --git a/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/CallAudioHost.kt b/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/CallAudioHost.kt new file mode 100644 index 000000000..1f0f374cb --- /dev/null +++ b/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/CallAudioHost.kt @@ -0,0 +1,7 @@ +package com.utun.chat.data + +/** Граница Telecom для настоящего CallAudioEngine; DSP заменён только в host NativeLib. */ +object TelecomCallManager { + var connection: UtunConnection? = null + fun connectionFor(id: Long) = connection +} diff --git a/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/RouterHostEnvironment.kt b/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/RouterHostEnvironment.kt index 4471f62be..284404373 100644 --- a/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/RouterHostEnvironment.kt +++ b/tools/chatgui-android/router-tests/src/main/kotlin/com/utun/chat/data/RouterHostEnvironment.kt @@ -35,6 +35,24 @@ object LogManager { /** Только host-тест: считает уведомления standby, не загружает JNI и не запускает ядро. */ object NativeLib { + @Volatile var callAudioFailures = emptySet() + @Volatile var onCallFeed: () -> Unit = {} + val callAudioCommands: MutableList> = Collections.synchronizedList(mutableListOf()) + fun callAudioStart(id: Long): Boolean { + callAudioCommands.add("start" to id) + return "start" !in callAudioFailures + } + fun callAudioStop() { + callAudioCommands.add("stop" to 0L) + check("stop" !in callAudioFailures) { "native call audio stop failed" } + } + fun callAudioFeed(id: Long, samples: ShortArray, muted: Boolean, ptsUs: Long): Boolean { onCallFeed(); return true } + fun callAudioPull(id: Long, samples: ShortArray) = 0 + fun callAudioClock(id: Long, nowUs: Long, snapshot: LongArray): Boolean { snapshot[0] = 1; return true } + fun callAudioDiagnostics(id: Long, snapshot: LongArray) = false + fun callAudioProgress(id: Long, epoch: Long, position: Long, atUs: Long, nowUs: Long, measured: Boolean) {} + fun callAudioSetAec(enabled: Boolean) {} + fun callAudioSetAecDelay(frames: Int) {} val callCommands = mutableListOf>() fun callStart(channel: String, peer: Long, id: Long) { callCommands.add("start" to id) } fun callAccept(id: Long) { callCommands.add("accept" to id) }