Fixed stucked in 'wait for encryption' for SRTP & not encrypted calls

This commit is contained in:
Sylvain Berfini 2024-06-27 10:31:04 +02:00
parent a788191e50
commit f3eb821946
3 changed files with 138 additions and 1 deletions

123
.idea/codeStyles/Project.xml generated Normal file
View file

@ -0,0 +1,123 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View file

@ -241,7 +241,6 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
override fun onEncryptionChanged(call: Call, on: Boolean, authenticationToken: String?) { override fun onEncryptionChanged(call: Call, on: Boolean, authenticationToken: String?) {
Log.i("$TAG Call encryption changed, updating...") Log.i("$TAG Call encryption changed, updating...")
updateEncryption() updateEncryption()
callMediaEncryptionModel.update(call)
} }
override fun onAuthenticationTokenVerified(call: Call, verified: Boolean) { override fun onAuthenticationTokenVerified(call: Call, verified: Boolean) {
@ -346,6 +345,15 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
if (corePreferences.automaticallyStartCallRecording) { if (corePreferences.automaticallyStartCallRecording) {
isRecording.postValue(call.params.isRecording) isRecording.postValue(call.params.isRecording)
} }
// MediaEncryption None & SRTP won't be notified through onEncryptionChanged callback,
// we have to do it manually to leave the "wait for encryption" state
when (call.currentParams.mediaEncryption) {
MediaEncryption.SRTP, MediaEncryption.None -> {
updateEncryption()
}
else -> {}
}
} }
} }
@ -1035,6 +1043,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
} }
} }
waitingForEncryptionInfo.postValue(false) waitingForEncryptionInfo.postValue(false)
callMediaEncryptionModel.update(currentCall)
} }
@WorkerThread @WorkerThread