From 1594252aeb05682937637b38cef381f14508328e Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 28 May 2024 14:20:47 +0200 Subject: [PATCH] Updated icon & text for in-call media encryption label for SRTP --- .../linphone/ui/call/viewmodel/CurrentCallViewModel.kt | 10 ++++++++-- app/src/main/res/drawable/lock_key.xml | 9 +++++++++ app/src/main/res/layout/call_active_fragment.xml | 4 ++-- app/src/main/res/values-fr/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/drawable/lock_key.xml 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 4de403c23..33090e474 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 @@ -112,6 +112,8 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { val isZrtpPq = MutableLiveData() + val isZrtp = MutableLiveData() + val isMediaEncrypted = MutableLiveData() val hideVideo = MutableLiveData() @@ -941,7 +943,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { @WorkerThread private fun updateEncryption(): Boolean { - when (currentCall.currentParams.mediaEncryption) { + when (val mediaEncryption = currentCall.currentParams.mediaEncryption) { MediaEncryption.ZRTP -> { val authToken = currentCall.authenticationToken val isDeviceTrusted = currentCall.authenticationTokenVerified && authToken != null @@ -965,7 +967,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { } isMediaEncrypted.postValue(true) - + isZrtp.postValue(true) // When Post Quantum is available, ZRTP is Post Quantum if key exchange was made with Post Quantum algorithm val stats = currentCall.getStats(StreamType.Audio) isZrtpPq.postValue( @@ -980,11 +982,15 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { return isDeviceTrusted } MediaEncryption.SRTP, MediaEncryption.DTLS -> { + Log.i("$TAG Current call media encryption is [$mediaEncryption]") isMediaEncrypted.postValue(true) + isZrtp.postValue(false) isZrtpPq.postValue(false) } else -> { + Log.w("$TAG Current call doesn't have any media encryption!") isMediaEncrypted.postValue(false) + isZrtp.postValue(false) isZrtpPq.postValue(false) } } diff --git a/app/src/main/res/drawable/lock_key.xml b/app/src/main/res/drawable/lock_key.xml new file mode 100644 index 000000000..a240a6a84 --- /dev/null +++ b/app/src/main/res/drawable/lock_key.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/call_active_fragment.xml b/app/src/main/res/layout/call_active_fragment.xml index 5970f5571..35d08d7f2 100644 --- a/app/src/main/res/layout/call_active_fragment.xml +++ b/app/src/main/res/layout/call_active_fragment.xml @@ -238,7 +238,7 @@ android:adjustViewBounds="true" android:paddingTop="3dp" android:contentDescription="@null" - android:src="@{viewModel.isZrtpPq ? @drawable/atom : @drawable/lock_simple, default=@drawable/atom}" + android:src="@{viewModel.isZrtpPq ? @drawable/atom : viewModel.isZrtp ? @drawable/lock_key : @drawable/lock_simple, default=@drawable/atom}" android:visibility="@{!viewModel.fullScreenMode && !viewModel.pipMode && viewModel.isMediaEncrypted ? View.VISIBLE : View.GONE}" app:layout_constraintStart_toEndOf="@id/back" app:layout_constraintTop_toTopOf="@id/media_encryption_label" @@ -252,7 +252,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="5dp" - android:text="@{viewModel.isZrtpPq ? @string/call_post_quantum_zrtp_end_to_end_encrypted : @string/call_zrtp_end_to_end_encrypted, default=@string/call_post_quantum_zrtp_end_to_end_encrypted}" + android:text="@{viewModel.isZrtpPq ? @string/call_post_quantum_zrtp_end_to_end_encrypted : viewModel.isZrtp ? @string/call_zrtp_end_to_end_encrypted : @string/call_srtp_point_to_point_encrypted, default=@string/call_post_quantum_zrtp_end_to_end_encrypted}" android:textSize="12sp" android:textColor="@color/blue_info_500" android:maxLines="1" diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 898d454b3..3f3a97775 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -589,8 +589,9 @@ Reprise… Terminé Appel chiffré de bout en bout - Appel chiffré de bout en bout + Appel chiffré de bout en bout en post-quantique Faire la validation à nouveau + Appel chiffré de point à point Liste des appels Transférer l\'appel vers %s est en train d\'enregistrer diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aba42b1f8..cb91b20ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -627,6 +627,7 @@ End-to-end encrypted by ZRTP End-to-end encrypted by post-quantum ZRTP Validate ZRTP SAS again + Point-to-point encrypted by SRTP Calls list Transfer call to %s is recording