From f9cab09b3d358410a51a268acb234cd3792505c1 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 11 May 2026 08:40:39 +0300 Subject: [PATCH] Avoid lint warning in incallservice --- .../main/kotlin/com/tutpro/baresip/InCallService.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/InCallService.kt b/app/src/main/kotlin/com/tutpro/baresip/InCallService.kt index 19199d0f..40970583 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/InCallService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/InCallService.kt @@ -4,6 +4,7 @@ import android.content.Intent import android.os.IBinder import android.telecom.Call import android.telecom.InCallService +import java.lang.ref.WeakReference class InCallService : InCallService() { @@ -21,8 +22,7 @@ class InCallService : InCallService() { if (handle == baresipHandle) { Log.d(TAG, "InCallService: Identified as SIP call") - // The SIP call is already managed by ConnectionService/BaresipService. - // We just need to ensure the InCallService stays bound. + // SIP call is already managed by ConnectionService/BaresipService } else { Log.d(TAG, "InCallService: Identified as PSTN call from $handle") val aor = call.details.intentExtras?.getString("aor") @@ -43,6 +43,11 @@ class InCallService : InCallService() { companion object { private const val TAG = "Baresip" - var instance: InCallService? = null + private var _instance = WeakReference(null) + var instance: InCallService? + get() = _instance.get() + set(value) { + _instance = WeakReference(value) + } } }