Bumped dependencies

This commit is contained in:
Sylvain Berfini 2023-10-05 14:42:18 +02:00
parent 0d880dda50
commit b105c436ba
3 changed files with 56 additions and 57 deletions

View file

@ -70,17 +70,18 @@ android {
}
dependencies {
implementation "androidx.activity:activity-ktx:1.8.0"
implementation "androidx.annotation:annotation:1.7.0"
implementation 'androidx.appcompat:appcompat:1.7.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core-ktx:1.12.0'
implementation "androidx.core:core-telecom:1.0.0-alpha01"
implementation 'androidx.media:media:1.6.0'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation "androidx.appcompat:appcompat:1.7.0-alpha03"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.core:core-ktx:1.12.0"
implementation "androidx.core:core-telecom:1.0.0-alpha02"
implementation "androidx.media:media:1.6.0"
implementation "androidx.recyclerview:recyclerview:1.3.1"
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
implementation 'androidx.window:window:1.1.0'
implementation "androidx.window:window:1.1.0"
def nav_version = "2.7.3"
def nav_version = "2.7.4"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

View file

@ -21,7 +21,7 @@ package org.linphone.telecom
import android.telecom.DisconnectCause
import androidx.core.telecom.CallAttributesCompat
import androidx.core.telecom.CallControlCallback
import androidx.core.telecom.CallControlResult
import androidx.core.telecom.CallControlScope
import androidx.core.telecom.CallEndpointCompat
import kotlinx.coroutines.CoroutineScope
@ -35,13 +35,12 @@ import org.linphone.core.Call
import org.linphone.core.CallListenerStub
import org.linphone.core.tools.Log
import org.linphone.utils.AudioRouteUtils
import org.linphone.utils.LinphoneUtils
class TelecomCallControlCallback constructor(
private val call: Call,
private val callControl: CallControlScope,
private val scope: CoroutineScope
) : CallControlCallback {
) {
companion object {
private const val TAG = "[Telecom Call Control Callback]"
}
@ -184,17 +183,19 @@ class TelecomCallControlCallback constructor(
scope.launch {
Log.i("$TAG Requesting audio endpoint change with [${endpoint.name}]")
var audioRouteUpdated = callControl.requestEndpointChange(endpoint)
var result: CallControlResult = callControl.requestEndpointChange(endpoint)
var attempts = 1
while (!audioRouteUpdated && attempts <= 10) {
while (result is CallControlResult.Error && attempts <= 10) {
delay(100)
Log.i("$TAG Requesting audio endpoint change with [${endpoint.name}]")
audioRouteUpdated = callControl.requestEndpointChange(endpoint)
Log.i(
"$TAG Previous attempt failed [$result], requesting again audio endpoint change with [${endpoint.name}]"
)
result = callControl.requestEndpointChange(endpoint)
attempts += 1
}
if (!audioRouteUpdated) {
Log.e("$TAG Failed to change endpoint audio device!")
if (result is CallControlResult.Error) {
Log.e("$TAG Failed to change endpoint audio device, error [$result]")
} else {
Log.i("$TAG It took [$attempts] to change endpoint audio device...")
}
@ -204,42 +205,4 @@ class TelecomCallControlCallback constructor(
}
}
}
override suspend fun onAnswer(callType: Int): Boolean {
Log.i("$TAG We're asked to answer the call with type [$callType]")
coreContext.postOnCoreThread {
if (LinphoneUtils.isCallIncoming(call.state)) {
Log.i("$TAG Answering call")
coreContext.answerCall(call) // TODO: use call type
}
}
return true
}
override suspend fun onDisconnect(disconnectCause: DisconnectCause): Boolean {
Log.i("$TAG We're asked to terminate the call with reason [$disconnectCause]")
coreContext.postOnCoreThread {
Log.i("$TAG Terminating call [${call.remoteAddress.asStringUriOnly()}]")
call.terminate() // TODO: use cause
}
return true
}
override suspend fun onSetActive(): Boolean {
Log.i("$TAG We're asked to resume the call")
coreContext.postOnCoreThread {
Log.i("$TAG Resuming call")
call.resume()
}
return true
}
override suspend fun onSetInactive(): Boolean {
Log.i("$TAG We're asked to pause the call")
coreContext.postOnCoreThread {
Log.i("$TAG Pausing call")
call.pause()
}
return true
}
}

View file

@ -79,7 +79,43 @@ class TelecomManager @WorkerThread constructor(context: Context) {
scope.launch {
try {
callsManager.addCall(callAttributes) {
callsManager.addCall(
callAttributes,
{ callType -> // onAnswer
Log.i("$TAG We're asked to answer the call with type [$callType]")
coreContext.postOnCoreThread {
if (LinphoneUtils.isCallIncoming(call.state)) {
Log.i("$TAG Answering call")
coreContext.answerCall(call) // TODO: use call type
}
}
},
{ disconnectCause -> // onDisconnect
Log.i(
"$TAG We're asked to terminate the call with reason [$disconnectCause]"
)
coreContext.postOnCoreThread {
Log.i(
"$TAG Terminating call [${call.remoteAddress.asStringUriOnly()}]"
)
call.terminate() // TODO: use cause
}
},
{ // onSetActive
Log.i("$TAG We're asked to resume the call")
coreContext.postOnCoreThread {
Log.i("$TAG Resuming call")
call.resume()
}
},
{ // onSetInactive
Log.i("$TAG We're asked to pause the call")
coreContext.postOnCoreThread {
Log.i("$TAG Pausing call")
call.pause()
}
}
) {
val callbacks = TelecomCallControlCallback(call, this, scope)
coreContext.postOnCoreThread {
@ -90,7 +126,6 @@ class TelecomManager @WorkerThread constructor(context: Context) {
}
}
setCallback(callbacks)
// We must first call setCallback on callControlScope before using it
callbacks.onCallControlCallbackSet()
}