feat: improve background streaming handler with microphone management

- Enhanced BackgroundStreamingHandler to manage microphone streams effectively during background execution.
- Introduced VoiceBackgroundAudioManager for better audio session handling, ensuring proper activation and deactivation based on microphone usage.
- Updated startBackgroundExecution method to handle microphone requirements dynamically, improving resource management.
- Ensured microphone streams are cleared appropriately when stopping background execution, enhancing overall stability.
This commit is contained in:
cogwheel0
2025-10-09 16:37:58 +05:30
parent a9030473b0
commit b3e1184d8d
2 changed files with 67 additions and 5 deletions

View File

@@ -266,7 +266,9 @@ class BackgroundStreamingHandler(private val activity: MainActivity) : MethodCal
}
private fun startBackgroundExecution(streamIds: List<String>, requiresMic: Boolean) {
activeStreams.clear()
activeStreams.addAll(streamIds)
streamsRequiringMic.retainAll(activeStreams)
if (requiresMic) {
streamsRequiringMic.addAll(streamIds)
}