From e6072eb0db629edfdb317d285d7c9eaca8f0b0b4 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Fri, 11 Jul 2025 10:18:07 +0300 Subject: [PATCH] Avoid some analyser warnings --- .../com/tutpro/baresip/BaresipService.kt | 18 +++++++++--------- .../kotlin/com/tutpro/baresip/MainScreen.kt | 7 ++----- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index dbb1aa34..ba92ab16 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -712,9 +712,9 @@ class BaresipService: Service() { if (aecAvailable) { aec = AcousticEchoCanceler.create(recorderSessionId) if (aec != null) { - if (!aec!!.getEnabled()) { - aec!!.setEnabled(true) - if (aec!!.getEnabled()) + if (!aec!!.enabled) { + aec!!.enabled = true + if (aec!!.enabled) Log.d(TAG, "AEC is enabled") else Log.w(TAG, "Failed to enable AEC") @@ -727,9 +727,9 @@ class BaresipService: Service() { if (agcAvailable) { agc = AutomaticGainControl.create(recorderSessionId) if (agc != null) { - if (!agc!!.getEnabled()) { - agc!!.setEnabled(true) - if (agc!!.getEnabled()) + if (!agc!!.enabled) { + agc!!.enabled = true + if (agc!!.enabled) Log.d(TAG, "AGC is enabled") } } else @@ -738,9 +738,9 @@ class BaresipService: Service() { if (nsAvailable) { ns = NoiseSuppressor.create(recorderSessionId) if (ns != null) { - if (!ns!!.getEnabled()) { - ns!!.setEnabled(true) - if (ns!!.getEnabled()) + if (!ns!!.enabled) { + ns!!.enabled = true + if (ns!!.enabled) Log.d(TAG, "NS is enabled") } } else diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt index b740db33..91e20615 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt @@ -20,7 +20,6 @@ import android.widget.Chronometer import android.widget.Toast import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts -import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatDelegate import androidx.compose.animation.animateContentSize import androidx.compose.foundation.BorderStroke @@ -240,7 +239,6 @@ private fun MainScreen( } } - @RequiresApi(29) fun launchBackupRequest() { if (Build.VERSION.SDK_INT < 29) { if (!Utils.checkPermissions(ctx, arrayOf(WRITE_EXTERNAL_STORAGE))) { @@ -284,7 +282,6 @@ private fun MainScreen( } } - @RequiresApi(29) fun launchRestoreRequest() { if (Build.VERSION.SDK_INT < 29) { if (!Utils.checkPermissions(ctx, arrayOf(READ_EXTERNAL_STORAGE))) { @@ -1308,7 +1305,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) { onClick = { showSuggestions.value = false abandonAudioFocus(ctx) - var ua: UserAgent = UserAgent.ofAor(viewModel.selectedAor.value)!! + val ua: UserAgent = UserAgent.ofAor(viewModel.selectedAor.value)!! val call = ua.currentCall() if (call != null) { val callp = call.callp @@ -2418,7 +2415,7 @@ fun callAction(ctx: Context, viewModel: ViewModel, uri: Uri?, action: String) { Log.d(TAG, "Action $action to $uri") if (uri != null) { var uriStr: String - var uap = 0L + var uap: Long when (uri.scheme) { "sip" -> { uriStr = Utils.uriUnescape(uri.toString())