From 14f827358878bd3ef2f8280ff8431db55bec4517 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 21 Jan 2026 11:36:40 +0100 Subject: [PATCH] Added setting to show more call stats --- .../java/org/linphone/core/CorePreferences.kt | 7 +++ .../linphone/ui/call/model/CallStatsModel.kt | 36 ++++++++++++++ .../settings/viewmodel/SettingsViewModel.kt | 12 +++++ .../layout-land/call_stats_bottom_sheet.xml | 48 +++++++++++++++++++ .../res/layout/call_stats_bottom_sheet.xml | 48 +++++++++++++++++++ .../layout/settings_developer_fragment.xml | 31 +++++++++++- app/src/main/res/values-fr/strings.xml | 3 ++ app/src/main/res/values/strings.xml | 3 ++ 8 files changed, 187 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/linphone/core/CorePreferences.kt b/app/src/main/java/org/linphone/core/CorePreferences.kt index f47a2d7e5..a7c7deffe 100644 --- a/app/src/main/java/org/linphone/core/CorePreferences.kt +++ b/app/src/main/java/org/linphone/core/CorePreferences.kt @@ -197,6 +197,13 @@ class CorePreferences config.setBool("app", "auto_answer_video_send_receive", value) } + @get:AnyThread @set:WorkerThread + var showAdvancedCallStats: Boolean + get() = config.getBool("ui", "show_advanced_call_stats", false) + set(value) { + config.setBool("ui", "show_advanced_call_stats", value) + } + // Conversation related @get:AnyThread @set:WorkerThread diff --git a/app/src/main/java/org/linphone/ui/call/model/CallStatsModel.kt b/app/src/main/java/org/linphone/ui/call/model/CallStatsModel.kt index f7a8d81bd..d8e437284 100644 --- a/app/src/main/java/org/linphone/ui/call/model/CallStatsModel.kt +++ b/app/src/main/java/org/linphone/ui/call/model/CallStatsModel.kt @@ -21,8 +21,10 @@ package org.linphone.ui.call.model import androidx.annotation.WorkerThread import androidx.lifecycle.MutableLiveData +import org.linphone.LinphoneApplication.Companion.corePreferences import kotlin.math.roundToInt import org.linphone.R +import org.linphone.core.Address import org.linphone.core.Call import org.linphone.core.CallStats import org.linphone.core.MediaDirection @@ -36,6 +38,8 @@ class CallStatsModel val audioBandwidth = MutableLiveData() val lossRate = MutableLiveData() val jitterBuffer = MutableLiveData() + val audioIce = MutableLiveData() + val audioIpFamily = MutableLiveData() val isVideoEnabled = MutableLiveData() val videoCodec = MutableLiveData() @@ -43,12 +47,20 @@ class CallStatsModel val videoLossRate = MutableLiveData() val videoResolution = MutableLiveData() val videoFps = MutableLiveData() + val videoIce = MutableLiveData() + val videoIpFamily = MutableLiveData() val fecEnabled = MutableLiveData() val lostPackets = MutableLiveData() val repairedPackets = MutableLiveData() val fecBandwidth = MutableLiveData() + val showAdvancedStats = MutableLiveData() + + init { + showAdvancedStats.postValue(corePreferences.showAdvancedCallStats) + } + @WorkerThread fun update(call: Call, stats: CallStats?) { stats ?: return @@ -96,6 +108,18 @@ class CallStatsModel "$jitterBufferSize ms" ) jitterBuffer.postValue(jitterBufferLabel) + + val iceLabel = AppUtils.getFormattedString( + R.string.call_stats_ice_label, + stats.iceState + ) + audioIce.postValue(iceLabel) + + val ipLabel = AppUtils.getFormattedString( + R.string.call_stats_ip_family_label, + if (stats.ipFamilyOfRemote == Address.Family.Inet6) "IPv6" else "IPv4" + ) + audioIpFamily.postValue(ipLabel) } StreamType.Video -> { val payloadType = call.currentParams.usedVideoPayloadType @@ -138,6 +162,18 @@ class CallStatsModel ) videoFps.postValue(fpsLabel) + val iceLabel = AppUtils.getFormattedString( + R.string.call_stats_ice_label, + stats.iceState + ) + videoIce.postValue(iceLabel) + + val ipLabel = AppUtils.getFormattedString( + R.string.call_stats_ip_family_label, + if (stats.ipFamilyOfRemote == Address.Family.Inet6) "IPv6" else "IPv4" + ) + videoIpFamily.postValue(ipLabel) + if (isFecEnabled) { val lostPacketsValue = stats.fecCumulativeLostPacketsNumber val lostPacketsLabel = AppUtils.getFormattedString( diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt index 3d481a515..57c8d3baa 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt @@ -249,6 +249,7 @@ class SettingsViewModel val logsSharingServerUrl = MutableLiveData() val createEndToEndEncryptedConferences = MutableLiveData() val enableVuMeters = MutableLiveData() + val enableAdvancedCallStats = MutableLiveData() val pushCompatibleDomainsList = MutableLiveData() private val coreListener = object : CoreListenerStub() { @@ -382,6 +383,7 @@ class SettingsViewModel logsSharingServerUrl.postValue(core.logCollectionUploadServerUrl) createEndToEndEncryptedConferences.postValue(corePreferences.createEndToEndEncryptedMeetingsAndGroupCalls) enableVuMeters.postValue(corePreferences.showMicrophoneAndSpeakerVuMeters) + enableAdvancedCallStats.postValue(corePreferences.showAdvancedCallStats) val domainsListBuilder = StringBuilder() val domainsArray = corePreferences.pushNotificationCompatibleDomains @@ -1197,6 +1199,16 @@ class SettingsViewModel } } + @UiThread + fun toggleEnableAdvancedCallStats() { + val newValue = enableAdvancedCallStats.value == false + + coreContext.postOnCoreThread { core -> + corePreferences.showAdvancedCallStats = newValue + enableAdvancedCallStats.postValue(newValue) + } + } + @UiThread fun updatePushCompatibleDomainsList() { coreContext.postOnCoreThread { core -> diff --git a/app/src/main/res/layout-land/call_stats_bottom_sheet.xml b/app/src/main/res/layout-land/call_stats_bottom_sheet.xml index 70a078608..739a82c4b 100644 --- a/app/src/main/res/layout-land/call_stats_bottom_sheet.xml +++ b/app/src/main/res/layout-land/call_stats_bottom_sheet.xml @@ -81,6 +81,30 @@ android:ellipsize="end" android:gravity="center" /> + + + + + + + + + + + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/enable_advanced_call_stats_switch"/> Paramètres développeurs activés Paramètres développeurs déjà activés Activer l\'indicateur des volumes d\'enregistrement et de lecture + Afficher plus de statistiques d\'appel Liste des domaines qui supportent les notifications poussées (séparés par des virgules) Supprimer les contacts natifs importés Ils seront synchronisés à nouveau au prochain démarrage de l\'application sauf si vous retirez la permission de lire les contacts @@ -752,6 +753,8 @@ Bande passante : %s Taux de perte : %s Tampon de gigue : %s + ICE : %s + Famille IP : %s Vidéo Définition : %s FPS : %s diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bca17f369..df6469ca9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -369,6 +369,7 @@ Developer settings enabled Developer settings already enabled Enable record/playback volume vu meters while in call + Show advanced call statistics List of push notifications compatible domains (comma separated) Clear imported contacts from native address book They will be imported again the next time the app starts unless you remove the contacts permission @@ -795,6 +796,8 @@ Bandwidth: %s Loss rate: %s Jitter buffer: %s + ICE: %s + IP Family: %s Video Resolution: %s FPS: %s