mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
It seems that annotating the lambda makes the thread check works
This commit is contained in:
parent
61bd3978a4
commit
325feb5637
3 changed files with 9 additions and 2 deletions
|
|
@ -214,14 +214,18 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
}
|
||||
|
||||
@AnyThread
|
||||
fun postOnCoreThread(lambda: (core: Core) -> Unit) {
|
||||
fun postOnCoreThread(
|
||||
@WorkerThread lambda: (core: Core) -> Unit
|
||||
) {
|
||||
coreThread.post {
|
||||
lambda.invoke(core)
|
||||
}
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
fun postOnMainThread(lambda: () -> Unit) {
|
||||
fun postOnMainThread(
|
||||
@UiThread lambda: () -> Unit
|
||||
) {
|
||||
mainThread.post {
|
||||
lambda.invoke()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
package org.linphone.telecom
|
||||
|
||||
import android.telecom.DisconnectCause
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.core.telecom.CallAttributesCompat
|
||||
import androidx.core.telecom.CallControlResult
|
||||
import androidx.core.telecom.CallControlScope
|
||||
|
|
@ -48,6 +49,7 @@ class TelecomCallControlCallback constructor(
|
|||
private var availableEndpoints: List<CallEndpointCompat> = arrayListOf()
|
||||
|
||||
private val callListener = object : CallListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onStateChanged(call: Call, state: Call.State?, message: String) {
|
||||
Log.i("$TAG Call [${call.remoteAddress.asStringUriOnly()}] state changed [$state]")
|
||||
if (state == Call.State.Connected) {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class CallModel @WorkerThread constructor(val call: Call) {
|
|||
val contact = MutableLiveData<ContactAvatarModel>()
|
||||
|
||||
private val callListener = object : CallListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onStateChanged(call: Call, state: Call.State, message: String) {
|
||||
this@CallModel.state.postValue(LinphoneUtils.callStateToString(state))
|
||||
isPaused.postValue(LinphoneUtils.isCallPaused(state))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue