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 a66447300..55c238103 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 @@ -47,7 +47,6 @@ import org.linphone.core.CoreListenerStub import org.linphone.core.MediaDirection import org.linphone.core.MediaEncryption import org.linphone.core.SecurityLevel -import org.linphone.core.StreamType import org.linphone.core.tools.Log import org.linphone.ui.GenericViewModel import org.linphone.ui.call.conference.viewmodel.ConferenceViewModel @@ -109,10 +108,12 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { val halfOpenedFolded = MutableLiveData() - val isZrtpPq = MutableLiveData() - val isZrtp = MutableLiveData() + val isZrtpSasValidationRequired = MutableLiveData() + + val waitingForEncryptionInfo = MutableLiveData() + val isMediaEncrypted = MutableLiveData() val hideVideo = MutableLiveData() @@ -238,6 +239,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { Log.w( "$TAG Notified that authentication token is [${if (verified) "verified" else "not verified!"}]" ) + isZrtpSasValidationRequired.postValue(!verified) zrtpAuthTokenVerifiedEvent.postValue(Event(verified)) } @@ -270,6 +272,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { "$TAG From now on current call will be [${newCurrentCall.remoteAddress.asStringUriOnly()}]" ) configureCall(newCurrentCall) + updateEncryption() } else { Log.e( "$TAG Failed to get a valid call to display, go to ended call fragment" @@ -390,6 +393,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { ) currentCall.removeListener(callListener) configureCall(call) + updateEncryption() } else if (LinphoneUtils.isCallIncoming(call.state)) { Log.w( "$TAG A call is being received [${call.remoteAddress.asStringUriOnly()}], using it as current call unless declined" @@ -965,7 +969,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { } @WorkerThread - private fun updateEncryption(): Boolean { + private fun updateEncryption() { when (val mediaEncryption = currentCall.currentParams.mediaEncryption) { MediaEncryption.ZRTP -> { val isDeviceTrusted = currentCall.authenticationTokenVerified @@ -992,12 +996,8 @@ 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( - coreContext.core.postQuantumAvailable && stats?.isZrtpKeyAgreementAlgoPostQuantum == true - ) + isZrtpSasValidationRequired.postValue(cacheMismatch || !isDeviceTrusted) if (cacheMismatch || !isDeviceTrusted) { Log.i("$TAG Showing ZRTP SAS confirmation dialog") val tokenToRead = currentCall.localAuthenticationToken @@ -1010,23 +1010,19 @@ 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) } } - return false + waitingForEncryptionInfo.postValue(false) } @WorkerThread @@ -1035,6 +1031,8 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { "$TAG Configuring call with remote address [${call.remoteAddress.asStringUriOnly()}] as current" ) contact.value?.destroy() + waitingForEncryptionInfo.postValue(true) + isMediaEncrypted.postValue(false) terminatedByUsed = false currentCall = call @@ -1126,8 +1124,6 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() { } } - updateEncryption() - contact.postValue(model) displayedName.postValue(model.friend.name) diff --git a/app/src/main/res/layout/call_active_conference_fragment.xml b/app/src/main/res/layout/call_active_conference_fragment.xml index 97df6f1c2..2861f306f 100644 --- a/app/src/main/res/layout/call_active_conference_fragment.xml +++ b/app/src/main/res/layout/call_active_conference_fragment.xml @@ -164,37 +164,16 @@ app:layout_constraintEnd_toEndOf="parent" bind:ignore="UseAppTint" /> - - - + layout="@layout/call_media_encryption_info" + bind:viewModel="@{viewModel}" + bind:callMediaEncryptionStatisticsClickListener="@{callMediaEncryptionStatisticsClickListener}" + app:layout_constraintTop_toBottomOf="@id/conference_subject" + app:layout_constraintStart_toEndOf="@id/back" + app:layout_constraintEnd_toEndOf="parent"/> diff --git a/app/src/main/res/layout/call_active_fragment.xml b/app/src/main/res/layout/call_active_fragment.xml index 3d11b54db..5bbf33404 100644 --- a/app/src/main/res/layout/call_active_fragment.xml +++ b/app/src/main/res/layout/call_active_fragment.xml @@ -67,7 +67,7 @@ app:layout_constraintVertical_chainStyle="packed" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/media_encryption_icon" + app:layout_constraintTop_toBottomOf="@id/call_media_encryption_info" app:layout_constraintBottom_toTopOf="@id/display_name" /> - - - + layout="@layout/call_media_encryption_info" + bind:viewModel="@{viewModel}" + bind:callMediaEncryptionStatisticsClickListener="@{callMediaEncryptionStatisticsClickListener}" + app:layout_constraintTop_toBottomOf="@id/name" + app:layout_constraintStart_toEndOf="@id/back" + app:layout_constraintEnd_toEndOf="parent"/> diff --git a/app/src/main/res/layout/call_ended_fragment.xml b/app/src/main/res/layout/call_ended_fragment.xml index e28a2398b..e2d90291a 100644 --- a/app/src/main/res/layout/call_ended_fragment.xml +++ b/app/src/main/res/layout/call_ended_fragment.xml @@ -60,35 +60,15 @@ app:layout_constraintTop_toTopOf="@id/call_direction_label" app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/> - - - + layout="@layout/call_media_encryption_info" + bind:viewModel="@{viewModel}" + app:layout_constraintTop_toBottomOf="@id/name" + app:layout_constraintStart_toEndOf="@id/back" + app:layout_constraintEnd_toEndOf="parent"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8ccbbc3b6..13740ac3a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -571,10 +571,13 @@ Mis en pause par le correpondant Reprise… Terminé + En attente du chiffrement… Appel chiffré de bout en bout Appel chiffré de bout en bout en post-quantique - Faire la validation à nouveau + Faire la vérification à nouveau + Vérification nécessaire Appel chiffré de point à point + Appel non chiffré Liste des appels Transférer l\'appel vers %s est en train d\'enregistrer @@ -611,7 +614,7 @@ Algorithme SAS : %s L\'historique des appels a été supprimé - Cet appel est complètement sécurisé + Appareil vérifié Problème de sécurité ! Appel en cours de transfert L\'appel a été transferré diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e1ac40495..c693351bd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -608,10 +608,13 @@ Paused by remote Resuming… Ended + Waiting for encryption… End-to-end encrypted by ZRTP End-to-end encrypted by post-quantum ZRTP Validate ZRTP SAS again + Validation required Point-to-point encrypted by SRTP + Call is not encrypted Calls list Transfer call to %s is recording @@ -648,7 +651,7 @@ SAS algorithm: %s History has been deleted - This call can be trusted + Device validated Security alert ! Call is being transferred Call has been successfully transferred