From bf4ab1b412e31e78f4620924ad1aaaf1d23409e6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 19 Aug 2024 11:32:10 +0200 Subject: [PATCH] Added logs to help debug mic muted button state --- .../ui/call/viewmodel/CurrentCallViewModel.kt | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt index 3e14ba588..28dcd3ef6 100644 --- a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt @@ -644,6 +644,11 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { } else { currentCall.microphoneMuted = !micMuted } + if (micMuted) { + Log.w("$TAG Muting microphone") + } else { + Log.i("$TAG Un-muting microphone") + } isMicrophoneMuted.postValue(!micMuted) } } @@ -663,7 +668,14 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { } else { currentCall.microphoneMuted = !micMuted } - isMicrophoneMuted.postValue(micMuted) + if (micMuted != isMicrophoneMuted.value) { + if (micMuted) { + Log.w("$TAG Microphone is muted, updating button state accordingly") + } else { + Log.i("$TAG Microphone is not muted, updating button state accordingly") + } + isMicrophoneMuted.postValue(micMuted) + } } } } @@ -1080,7 +1092,11 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { ) isMicrophoneMuted.postValue(true) } else { - isMicrophoneMuted.postValue(call.conference?.microphoneMuted ?: call.microphoneMuted) + val micMuted = call.conference?.microphoneMuted ?: call.microphoneMuted + if (micMuted) { + Log.w("$TAG Microphone is currently muted") + } + isMicrophoneMuted.postValue(micMuted) } val audioDevice = call.outputAudioDevice