Prevent calls crashing due to background restrictions.

This commit is contained in:
Cody Henthorne
2025-01-10 13:51:53 -05:00
committed by Greyson Parrelli
parent a63fd5a584
commit 919648b94b
3 changed files with 15 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ import org.thoughtcrime.securesms.permissions.Permissions
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.service.SafeForegroundService
import org.thoughtcrime.securesms.util.DeviceProperties
import org.thoughtcrime.securesms.util.TelephonyUtil
import org.thoughtcrime.securesms.webrtc.CallNotificationBuilder
import org.thoughtcrime.securesms.webrtc.UncaughtExceptionHandlerManager
@@ -147,6 +148,8 @@ class ActiveCallManager(
private var previousNotificationDisposable = Disposable.disposed()
init {
Log.i(TAG, "init(bkgRestricted: ${DeviceProperties.isBackgroundRestricted()})")
registerUncaughtExceptionHandler()
registerNetworkReceiver()
@@ -266,6 +269,8 @@ class ActiveCallManager(
/** Foreground service started only after a call is established */
class ActiveCallForegroundService : SafeForegroundService() {
companion object {
private const val TAG = "ActiveCallService"
private const val EXTRA_RECIPIENT_ID = "RECIPIENT_ID"
private const val EXTRA_IS_VIDEO_CALL = "IS_VIDEO_CALL"
private const val EXTRA_TYPE = "TYPE"