Toast if network or hw AEC is not available

This commit is contained in:
Juha Heinanen
2025-04-23 21:37:55 +03:00
parent b2ec3501c0
commit b33289b1ea
5 changed files with 17 additions and 21 deletions

View File

@ -468,7 +468,7 @@ class BaresipService: Service() {
activeNetwork = cm.activeNetwork
Log.i(TAG, "Active network: $activeNetwork")
Log.d(TAG, "AGC/NS available = $agcAvailable/$nsAvailable")
Log.i(TAG, "AEC/AGC/NS available = $aecAvailable/$agcAvailable/$nsAvailable")
val userAgent = Config.variable("user_agent")
Thread {
@ -498,15 +498,13 @@ class BaresipService: Service() {
)
}
if (linkAddresses.isEmpty()) {
val newIntent = Intent(this, MainActivity::class.java)
newIntent.flags =
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or
Intent.FLAG_ACTIVITY_NEW_TASK
newIntent.putExtra("action", "no network")
startActivity(newIntent)
}
var message = ""
if (linkAddresses.isEmpty())
message = '\u2022' + " " + getString(R.string.no_network) + '\n'
if (!aecAvailable)
message = message + '\u2022' + " " + getString(R.string.no_aec) + '\n'
if (message != "")
toast(message.dropLast(1), Toast.LENGTH_LONG)
}
"Start Content Observer" -> {
@ -1299,9 +1297,9 @@ class BaresipService: Service() {
}
}
private fun toast(message: String) {
private fun toast(message: String, length: Int = Toast.LENGTH_SHORT) {
Handler(Looper.getMainLooper()).post {
Toast.makeText(this@BaresipService.applicationContext, message, Toast.LENGTH_LONG).show()
Toast.makeText(this@BaresipService.applicationContext, message, length).show()
}
}
@ -1607,6 +1605,7 @@ class BaresipService: Service() {
}
}
@Suppress("unused")
private external fun baresipStart(
path: String,
addresses: String,
@ -1614,6 +1613,7 @@ class BaresipService: Service() {
software: String
)
@Suppress("unused")
external fun baresipStop(force: Boolean)
@SuppressLint("MutableCollectionMutableState")

View File

@ -2187,12 +2187,6 @@ class MainActivity : ComponentActivity() {
Log.d(TAG, "Handling intent '$action'")
val ev = action.split(",")
when (ev[0]) {
"no network" -> {
alertTitle.value = getString(R.string.notice)
alertMessage.value = getString(R.string.no_network)
showAlert.value = true
return
}
"call", "dial" -> {
if (Call.inCall()) {
Toast.makeText(applicationContext, getString(R.string.call_already_active),

View File

@ -994,7 +994,7 @@ object Utils {
if (aec != null) {
BaresipService.aecAvailable = true
aec.release()
Log.d(TAG, "Creation of hardware AEC for $sessionId succeeded")
Log.i(TAG, "Creation of hardware AEC for $sessionId succeeded")
} else {
Log.w(TAG, "Creation of hardware AEC for $sessionId failed")
}

View File

@ -576,9 +576,10 @@
<string name="no_video_calls">Salli Kamera-lupa jotta voit soittaa videopuheluita ja vastata niihin.</string>
<string name="no_backup">Et voi tallentaa sovelluksen tietoja ilman Tallennustila-lupaa.</string>
<string name="no_restore">Et voi palauttaa sovelluksen tietoja ilman Tallennustila-lupaa.</string>
<string name="no_cameras">Sinulla ei ole yhtään tuettua video-kameraa.</string>
<string name="no_cameras">Ei tuettuja videokameroita.</string>
<string name="show_password">Näytä salasana</string>
<string name="no_network">Ei verkkoyhteyttä!</string>
<string name="no_aec">Ei laitteistolla tuettua kaiun poistoa!</string>
<string name="call_details">Puhelutiedot</string>
<string name="no_android_contacts">Et voi käyttää Androidin yhteystietoja ilman Yhteystiedot-lupaa.</string>
<string name="audio_focus_denied">Audio fokus evätty!</string>

View File

@ -559,9 +559,10 @@
<string name="no_restore">You are not able restore backup without \"Storage\" permission.</string>
<string name="no_android_contacts">You are not able to access Android contacts without
\"Contacts\" permission.</string>
<string name="no_cameras">You don\'t have any supported video cameras.</string>
<string name="no_cameras">No supported video cameras!</string>
<string name="show_password">Show Password</string>
<string name="no_network">No network connection!</string>
<string name="no_aec">No hardware Acoustic Echo Cancellation!</string>
<string name="audio_focus_denied">Audio focus denied!</string>
<string name="permissions_rationale">Permissions rationale</string>
<string name="audio_permissions">baresip needs \"Microphone\" permission for voice calls,