Fix ringing calls not stopping when the other user cancels the call (#4613)
* Fix ringing calls not being automatically canceled This will keep the sync active while the user is screening an incoming call, allowing receiving a call cancellation event, which will terminate the incoming call ringing early. * Add extra logs to help debugging ringing call issues.
This commit is contained in:
committed by
GitHub
parent
75cb3156a1
commit
3b35d96e1a
+10
@@ -18,6 +18,11 @@ interface AppForegroundStateService {
|
||||
*/
|
||||
val isInForeground: StateFlow<Boolean>
|
||||
|
||||
/**
|
||||
* Updates to whether the app is active because an incoming ringing call is happening will be emitted here.
|
||||
*/
|
||||
val hasRingingCall: StateFlow<Boolean>
|
||||
|
||||
/**
|
||||
* Updates to whether the app is in an active call or not will be emitted here.
|
||||
*/
|
||||
@@ -38,6 +43,11 @@ interface AppForegroundStateService {
|
||||
*/
|
||||
fun updateIsInCallState(isInCall: Boolean)
|
||||
|
||||
/**
|
||||
* Update the 'has ringing call' state.
|
||||
*/
|
||||
fun updateHasRingingCall(hasRingingCall: Boolean)
|
||||
|
||||
/**
|
||||
* Update the active state for the syncing notification event flow.
|
||||
*/
|
||||
|
||||
+5
@@ -17,6 +17,7 @@ class DefaultAppForegroundStateService : AppForegroundStateService {
|
||||
override val isInForeground = MutableStateFlow(false)
|
||||
override val isInCall = MutableStateFlow(false)
|
||||
override val isSyncingNotificationEvent = MutableStateFlow(false)
|
||||
override val hasRingingCall = MutableStateFlow(false)
|
||||
|
||||
private val appLifecycle: Lifecycle by lazy { ProcessLifecycleOwner.get().lifecycle }
|
||||
|
||||
@@ -28,6 +29,10 @@ class DefaultAppForegroundStateService : AppForegroundStateService {
|
||||
this.isInCall.value = isInCall
|
||||
}
|
||||
|
||||
override fun updateHasRingingCall(hasRingingCall: Boolean) {
|
||||
this.hasRingingCall.value = hasRingingCall
|
||||
}
|
||||
|
||||
override fun updateIsSyncingNotificationEvent(isSyncingNotificationEvent: Boolean) {
|
||||
this.isSyncingNotificationEvent.value = isSyncingNotificationEvent
|
||||
}
|
||||
|
||||
+7
-1
@@ -13,11 +13,13 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
class FakeAppForegroundStateService(
|
||||
initialForegroundValue: Boolean = true,
|
||||
initialIsInCallValue: Boolean = false,
|
||||
initialIsSyncingNotificationEventValue: Boolean = false
|
||||
initialIsSyncingNotificationEventValue: Boolean = false,
|
||||
initialHasRingingCall: Boolean = false,
|
||||
) : AppForegroundStateService {
|
||||
override val isInForeground = MutableStateFlow(initialForegroundValue)
|
||||
override val isInCall = MutableStateFlow(initialIsInCallValue)
|
||||
override val isSyncingNotificationEvent = MutableStateFlow(initialIsSyncingNotificationEventValue)
|
||||
override val hasRingingCall = MutableStateFlow(initialHasRingingCall)
|
||||
|
||||
override fun startObservingForeground() {
|
||||
// No-op
|
||||
@@ -34,4 +36,8 @@ class FakeAppForegroundStateService(
|
||||
override fun updateIsSyncingNotificationEvent(isSyncingNotificationEvent: Boolean) {
|
||||
this.isSyncingNotificationEvent.value = isSyncingNotificationEvent
|
||||
}
|
||||
|
||||
override fun updateHasRingingCall(hasRingingCall: Boolean) {
|
||||
this.hasRingingCall.value = hasRingingCall
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user