Avoid some analyser warnings

This commit is contained in:
Juha Heinanen
2025-07-11 10:18:07 +03:00
parent 98a56353d6
commit e6072eb0db
2 changed files with 11 additions and 14 deletions
@@ -712,9 +712,9 @@ class BaresipService: Service() {
if (aecAvailable) { if (aecAvailable) {
aec = AcousticEchoCanceler.create(recorderSessionId) aec = AcousticEchoCanceler.create(recorderSessionId)
if (aec != null) { if (aec != null) {
if (!aec!!.getEnabled()) { if (!aec!!.enabled) {
aec!!.setEnabled(true) aec!!.enabled = true
if (aec!!.getEnabled()) if (aec!!.enabled)
Log.d(TAG, "AEC is enabled") Log.d(TAG, "AEC is enabled")
else else
Log.w(TAG, "Failed to enable AEC") Log.w(TAG, "Failed to enable AEC")
@@ -727,9 +727,9 @@ class BaresipService: Service() {
if (agcAvailable) { if (agcAvailable) {
agc = AutomaticGainControl.create(recorderSessionId) agc = AutomaticGainControl.create(recorderSessionId)
if (agc != null) { if (agc != null) {
if (!agc!!.getEnabled()) { if (!agc!!.enabled) {
agc!!.setEnabled(true) agc!!.enabled = true
if (agc!!.getEnabled()) if (agc!!.enabled)
Log.d(TAG, "AGC is enabled") Log.d(TAG, "AGC is enabled")
} }
} else } else
@@ -738,9 +738,9 @@ class BaresipService: Service() {
if (nsAvailable) { if (nsAvailable) {
ns = NoiseSuppressor.create(recorderSessionId) ns = NoiseSuppressor.create(recorderSessionId)
if (ns != null) { if (ns != null) {
if (!ns!!.getEnabled()) { if (!ns!!.enabled) {
ns!!.setEnabled(true) ns!!.enabled = true
if (ns!!.getEnabled()) if (ns!!.enabled)
Log.d(TAG, "NS is enabled") Log.d(TAG, "NS is enabled")
} }
} else } else
@@ -20,7 +20,6 @@ import android.widget.Chronometer
import android.widget.Toast import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.animation.animateContentSize import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.BorderStroke
@@ -240,7 +239,6 @@ private fun MainScreen(
} }
} }
@RequiresApi(29)
fun launchBackupRequest() { fun launchBackupRequest() {
if (Build.VERSION.SDK_INT < 29) { if (Build.VERSION.SDK_INT < 29) {
if (!Utils.checkPermissions(ctx, arrayOf(WRITE_EXTERNAL_STORAGE))) { if (!Utils.checkPermissions(ctx, arrayOf(WRITE_EXTERNAL_STORAGE))) {
@@ -284,7 +282,6 @@ private fun MainScreen(
} }
} }
@RequiresApi(29)
fun launchRestoreRequest() { fun launchRestoreRequest() {
if (Build.VERSION.SDK_INT < 29) { if (Build.VERSION.SDK_INT < 29) {
if (!Utils.checkPermissions(ctx, arrayOf(READ_EXTERNAL_STORAGE))) { if (!Utils.checkPermissions(ctx, arrayOf(READ_EXTERNAL_STORAGE))) {
@@ -1308,7 +1305,7 @@ private fun CallRow(ctx: Context, viewModel: ViewModel) {
onClick = { onClick = {
showSuggestions.value = false showSuggestions.value = false
abandonAudioFocus(ctx) abandonAudioFocus(ctx)
var ua: UserAgent = UserAgent.ofAor(viewModel.selectedAor.value)!! val ua: UserAgent = UserAgent.ofAor(viewModel.selectedAor.value)!!
val call = ua.currentCall() val call = ua.currentCall()
if (call != null) { if (call != null) {
val callp = call.callp 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") Log.d(TAG, "Action $action to $uri")
if (uri != null) { if (uri != null) {
var uriStr: String var uriStr: String
var uap = 0L var uap: Long
when (uri.scheme) { when (uri.scheme) {
"sip" -> { "sip" -> {
uriStr = Utils.uriUnescape(uri.toString()) uriStr = Utils.uriUnescape(uri.toString())