From b998718142254dbef82df468debc081eb0aec41d Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 7 Dec 2020 18:12:59 +0100 Subject: [PATCH] VoIP: clean files --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- .../matrix/android/sdk/api/session/call/CallState.kt | 1 - .../sdk/api/session/call/MxPeerConnectionState.java | 4 ++-- .../sdk/api/session/room/model/call/CallCandidate.kt | 2 +- .../session/room/model/call/CallNegotiateContent.kt | 8 +++----- .../api/session/room/model/call/CallRejectContent.kt | 2 +- .../room/model/call/CallSelectAnswerContent.kt | 2 +- .../session/room/model/call/CallSignallingContent.kt | 2 +- .../internal/session/call/CallListenersDispatcher.kt | 2 +- .../sdk/internal/session/call/model/MxCallImpl.kt | 5 ++--- .../vector/app/core/ui/views/ActiveCallViewHolder.kt | 1 - .../im/vector/app/features/call/CallControlsView.kt | 1 - .../vector/app/features/call/VectorCallViewModel.kt | 2 -- .../vector/app/features/call/VectorCallViewState.kt | 2 -- .../call/service/CallHeadsUpActionReceiver.kt | 1 - .../vector/app/features/call/utils/WebRtcMapping.kt | 2 -- .../im/vector/app/features/call/webrtc/WebRtcCall.kt | 12 ++++++------ .../app/features/call/webrtc/WebRtcCallManager.kt | 8 +++----- 18 files changed, 23 insertions(+), 38 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cdc95ef6eb..d1898f4c52 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ +#Mon Dec 07 18:05:35 CET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=22449f5231796abd892c98b2a07c9ceebe4688d192cd2d6763f8e3bf8acbedeb -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/CallState.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/CallState.kt index 5a97503e2f..2dbd1c9b01 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/CallState.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/CallState.kt @@ -16,7 +16,6 @@ package org.matrix.android.sdk.api.session.call - sealed class CallState { /** Idle, setting up objects */ diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxPeerConnectionState.java b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxPeerConnectionState.java index 5d2f208047..7ea0765809 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxPeerConnectionState.java +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxPeerConnectionState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 New Vector Ltd + * Copyright (c) 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,5 +26,5 @@ public enum MxPeerConnectionState { CONNECTED, DISCONNECTED, FAILED, - CLOSED; + CLOSED } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCandidate.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCandidate.kt index 80f7d56bd4..ace8c5a757 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCandidate.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallCandidate.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 New Vector Ltd + * Copyright (c) 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt index 21525c21dc..040993bb51 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt @@ -35,7 +35,7 @@ data class CallNegotiateContent( /** * Required. The time in milliseconds that the negotiation is valid for. Once exceeded the sender * of the negotiate event should consider the negotiation failed (timed out) and the recipient should ignore it. - **/ + **/ @Json(name = "lifetime") val lifetime: Int?, /** * Required. The session description object @@ -45,9 +45,9 @@ data class CallNegotiateContent( /** * Required. The version of the VoIP specification this message adheres to. */ - @Json(name = "version") override val version: String?, + @Json(name = "version") override val version: String? -): CallSignallingContent { + ): CallSignallingContent { @JsonClass(generateAdapter = true) data class Description( /** @@ -59,6 +59,4 @@ data class CallNegotiateContent( */ @Json(name = "sdp") val sdp: String? ) - } - diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt index a3cbae8969..d9a8090eb1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallRejectContent.kt @@ -36,5 +36,5 @@ data class CallRejectContent( /** * Required. The version of the VoIP specification this message adheres to. */ - @Json(name = "version") override val version: String?, + @Json(name = "version") override val version: String? ):CallSignallingContent diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSelectAnswerContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSelectAnswerContent.kt index 16c45512b9..6ea70ac990 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSelectAnswerContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSelectAnswerContent.kt @@ -40,5 +40,5 @@ data class CallSelectAnswerContent( /** * Required. The version of the VoIP specification this message adheres to. */ - @Json(name = "version") override val version: String?, + @Json(name = "version") override val version: String? ): CallSignallingContent diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSignallingContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSignallingContent.kt index e1c90f1952..f8d8c2a5e8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSignallingContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallSignallingContent.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 New Vector Ltd + * Copyright (c) 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt index 38826a194f..54e3df8416 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallListenersDispatcher.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 New Vector Ltd + * Copyright (c) 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt index c6ffcbcd28..9368e94efc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt @@ -121,8 +121,8 @@ internal class MxCallImpl( } override fun reject() { - if(opponentVersion < 1){ - Timber.v("Opponent version is less than 1 (${opponentVersion}): sending hangup instead of reject") + if (opponentVersion < 1) { + Timber.v("Opponent version is less than 1 ($opponentVersion): sending hangup instead of reject") hangUp() return } @@ -203,5 +203,4 @@ internal class MxCallImpl( ) .also { localEchoEventFactory.createLocalEcho(it) } } - } diff --git a/vector/src/main/java/im/vector/app/core/ui/views/ActiveCallViewHolder.kt b/vector/src/main/java/im/vector/app/core/ui/views/ActiveCallViewHolder.kt index b74d13e232..193a4b2387 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/ActiveCallViewHolder.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/ActiveCallViewHolder.kt @@ -20,7 +20,6 @@ import android.view.View import androidx.cardview.widget.CardView import androidx.core.view.isVisible import im.vector.app.core.utils.DebouncedClickListener -import im.vector.app.features.call.webrtc.WebRtcCallManager import org.matrix.android.sdk.api.session.call.CallState import im.vector.app.features.call.utils.EglUtils import im.vector.app.features.call.webrtc.WebRtcCall diff --git a/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt b/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt index 76707de94e..93fc132a8f 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallControlsView.kt @@ -30,7 +30,6 @@ import im.vector.app.R import kotlinx.android.synthetic.main.view_call_controls.view.* import org.matrix.android.sdk.api.session.call.CallState import org.matrix.android.sdk.api.session.call.MxPeerConnectionState -import org.webrtc.PeerConnection class CallControlsView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt index 658aac72ed..e1a01bbaa3 100644 --- a/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt @@ -36,7 +36,6 @@ import org.matrix.android.sdk.api.session.call.MxPeerConnectionState import org.matrix.android.sdk.api.session.call.TurnServerResponse import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem -import timber.log.Timber import java.util.Timer import java.util.TimerTask @@ -141,7 +140,6 @@ class VectorCallViewModel @AssistedInject constructor( ) } } - } init { diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallViewState.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallViewState.kt index 73db54adc8..8742e2cc7c 100644 --- a/vector/src/main/java/im/vector/app/features/call/VectorCallViewState.kt +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallViewState.kt @@ -45,6 +45,4 @@ data class VectorCallViewState( roomId = callArgs.roomId, isVideoCall = callArgs.isVideoCall ) - - } diff --git a/vector/src/main/java/im/vector/app/features/call/service/CallHeadsUpActionReceiver.kt b/vector/src/main/java/im/vector/app/features/call/service/CallHeadsUpActionReceiver.kt index 9991b4f753..5a1d8cd396 100644 --- a/vector/src/main/java/im/vector/app/features/call/service/CallHeadsUpActionReceiver.kt +++ b/vector/src/main/java/im/vector/app/features/call/service/CallHeadsUpActionReceiver.kt @@ -37,7 +37,6 @@ class CallHeadsUpActionReceiver : BroadcastReceiver() { ?.webRtcCallManager() ?: return - when (intent?.getIntExtra(EXTRA_CALL_ACTION_KEY, 0)) { CALL_ACTION_REJECT -> { val callId = intent.getStringExtra(EXTRA_CALL_ID) ?: return diff --git a/vector/src/main/java/im/vector/app/features/call/utils/WebRtcMapping.kt b/vector/src/main/java/im/vector/app/features/call/utils/WebRtcMapping.kt index fcea1a2a9b..2b0d5281d2 100644 --- a/vector/src/main/java/im/vector/app/features/call/utils/WebRtcMapping.kt +++ b/vector/src/main/java/im/vector/app/features/call/utils/WebRtcMapping.kt @@ -36,5 +36,3 @@ fun SdpType.asWebRTC(): SessionDescription.Type { SessionDescription.Type.ANSWER } } - - diff --git a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt index a8f5942a1a..4e12934d12 100644 --- a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt +++ b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt @@ -330,7 +330,7 @@ class WebRtcCall(val mxCall: MxCall, // 2. Access camera (if video call) + microphone, create local stream createLocalStream() attachViewRenderersInternal() - Timber.v("## VOIP remoteCandidateSource ${remoteCandidateSource}") + Timber.v("## VOIP remoteCandidateSource $remoteCandidateSource") remoteIceCandidateDisposable = remoteCandidateSource.subscribe({ Timber.v("## VOIP adding remote ice candidate $it") peerConnection?.addIceCandidate(it) @@ -383,7 +383,7 @@ class WebRtcCall(val mxCall: MxCall, createAnswer()?.also { mxCall.accept(it.description) } - Timber.v("## VOIP remoteCandidateSource ${remoteCandidateSource}") + Timber.v("## VOIP remoteCandidateSource $remoteCandidateSource") remoteIceCandidateDisposable = remoteCandidateSource.subscribe({ Timber.v("## VOIP adding remote ice candidate $it") peerConnection?.addIceCandidate(it) @@ -554,9 +554,9 @@ class WebRtcCall(val mxCall: MxCall, for (transceiver in peerConnection?.transceivers ?: emptyList()) { val trackOnHold = transceiver.currentDirection == RtpTransceiver.RtpTransceiverDirection.INACTIVE || transceiver.currentDirection == RtpTransceiver.RtpTransceiverDirection.RECV_ONLY - if (!trackOnHold) callOnHold = false; + if (!trackOnHold) callOnHold = false } - return callOnHold; + return callOnHold } fun updateRemoteOnHold(onHold: Boolean) { @@ -704,7 +704,7 @@ class WebRtcCall(val mxCall: MxCall, return } mxCall.state = CallState.Terminated - //Close tracks ASAP + // Close tracks ASAP localVideoTrack?.setEnabled(false) localVideoTrack?.setEnabled(false) cameraAvailabilityCallback?.let { cameraAvailabilityCallback -> @@ -760,7 +760,7 @@ class WebRtcCall(val mxCall: MxCall, val type = description?.type val sdpText = description?.sdp if (type == null || sdpText == null) { - Timber.i("Ignoring invalid m.call.negotiate event"); + Timber.i("Ignoring invalid m.call.negotiate event") return@launch } val peerConnection = peerConnection ?: return@launch diff --git a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt index c67abb3d72..8e94604260 100644 --- a/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCallManager.kt @@ -25,8 +25,6 @@ import im.vector.app.core.services.BluetoothHeadsetReceiver import im.vector.app.core.services.CallService import im.vector.app.core.services.WiredHeadsetStateReceiver import im.vector.app.features.call.CallAudioManager -import im.vector.app.features.call.CameraType -import im.vector.app.features.call.CaptureFormat import im.vector.app.features.call.VectorCallActivity import im.vector.app.features.call.utils.EglUtils import im.vector.app.push.fcm.FcmHelper @@ -46,7 +44,6 @@ import org.matrix.android.sdk.api.session.room.model.call.CallSelectAnswerConten import org.webrtc.DefaultVideoDecoderFactory import org.webrtc.DefaultVideoEncoderFactory import org.webrtc.PeerConnectionFactory -import org.webrtc.SurfaceViewRenderer import timber.log.Timber import java.util.concurrent.Executors import javax.inject.Inject @@ -230,7 +227,8 @@ class WebRtcCallManager @Inject constructor( ) currentCall = webRtcCall callsByCallId[mxCall.callId] = webRtcCall - callsByRoomId.getOrPut(mxCall.roomId, { ArrayList() }).add(webRtcCall) + callsByRoomId.getOrPut(mxCall.roomId) { ArrayList() } + .add(webRtcCall) return webRtcCall } @@ -332,7 +330,7 @@ class WebRtcCallManager @Inject constructor( } val selectedPartyId = callSelectAnswerContent.selectedPartyId if (selectedPartyId != call.mxCall.ourPartyId) { - Timber.i("Got select_answer for party ID ${selectedPartyId}: we are party ID ${call.mxCall.ourPartyId}."); + Timber.i("Got select_answer for party ID $selectedPartyId: we are party ID ${call.mxCall.ourPartyId}.") // The other party has picked somebody else's answer call.endCall(false) }