feat: enhance background streaming functionality with improved wake lock management

- Updated the wake lock duration in BackgroundStreamingHandler to 3 hours, ensuring the service remains active for longer periods.
- Modified the keepAlive method to support both iOS and Android, allowing for better background task management across platforms.
- Implemented a periodic keep-alive timer in VoiceCallService to refresh the wake lock every 5 minutes, enhancing service reliability during voice calls.
- Added debug logging for successful keep-alive invocations, improving traceability of background operations.
This commit is contained in:
cogwheel0
2025-10-10 19:59:17 +05:30
parent 86892d21c8
commit 4eb1191748
3 changed files with 26 additions and 4 deletions

View File

@@ -144,13 +144,13 @@ class BackgroundStreamingService : Service() {
private fun acquireWakeLock() {
if (wakeLock?.isHeld == true) return
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
wakeLock = powerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK,
"Conduit::StreamingWakeLock"
).apply {
acquire(15 * 60 * 1000L) // 15 minutes max
acquire(3 * 60 * 60 * 1000L) // 3 hours max (refreshed every 5 minutes)
}
println("BackgroundStreamingService: Wake lock acquired")
}