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
@@ -468,7 +468,7 @@ class BaresipService: Service() {
activeNetwork = cm.activeNetwork activeNetwork = cm.activeNetwork
Log.i(TAG, "Active network: $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") val userAgent = Config.variable("user_agent")
Thread { Thread {
@@ -498,15 +498,13 @@ class BaresipService: Service() {
) )
} }
if (linkAddresses.isEmpty()) { var message = ""
val newIntent = Intent(this, MainActivity::class.java) if (linkAddresses.isEmpty())
newIntent.flags = message = '\u2022' + " " + getString(R.string.no_network) + '\n'
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or if (!aecAvailable)
Intent.FLAG_ACTIVITY_NEW_TASK message = message + '\u2022' + " " + getString(R.string.no_aec) + '\n'
newIntent.putExtra("action", "no network") if (message != "")
startActivity(newIntent) toast(message.dropLast(1), Toast.LENGTH_LONG)
}
} }
"Start Content Observer" -> { "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 { 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( private external fun baresipStart(
path: String, path: String,
addresses: String, addresses: String,
@@ -1614,6 +1613,7 @@ class BaresipService: Service() {
software: String software: String
) )
@Suppress("unused")
external fun baresipStop(force: Boolean) external fun baresipStop(force: Boolean)
@SuppressLint("MutableCollectionMutableState") @SuppressLint("MutableCollectionMutableState")
@@ -2187,12 +2187,6 @@ class MainActivity : ComponentActivity() {
Log.d(TAG, "Handling intent '$action'") Log.d(TAG, "Handling intent '$action'")
val ev = action.split(",") val ev = action.split(",")
when (ev[0]) { when (ev[0]) {
"no network" -> {
alertTitle.value = getString(R.string.notice)
alertMessage.value = getString(R.string.no_network)
showAlert.value = true
return
}
"call", "dial" -> { "call", "dial" -> {
if (Call.inCall()) { if (Call.inCall()) {
Toast.makeText(applicationContext, getString(R.string.call_already_active), Toast.makeText(applicationContext, getString(R.string.call_already_active),
@@ -994,7 +994,7 @@ object Utils {
if (aec != null) { if (aec != null) {
BaresipService.aecAvailable = true BaresipService.aecAvailable = true
aec.release() aec.release()
Log.d(TAG, "Creation of hardware AEC for $sessionId succeeded") Log.i(TAG, "Creation of hardware AEC for $sessionId succeeded")
} else { } else {
Log.w(TAG, "Creation of hardware AEC for $sessionId failed") Log.w(TAG, "Creation of hardware AEC for $sessionId failed")
} }
+2 -1
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_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_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_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="show_password">Näytä salasana</string>
<string name="no_network">Ei verkkoyhteyttä!</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="call_details">Puhelutiedot</string>
<string name="no_android_contacts">Et voi käyttää Androidin yhteystietoja ilman Yhteystiedot-lupaa.</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> <string name="audio_focus_denied">Audio fokus evätty!</string>
+2 -1
View File
@@ -559,9 +559,10 @@
<string name="no_restore">You are not able restore backup without \"Storage\" permission.</string> <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 <string name="no_android_contacts">You are not able to access Android contacts without
\"Contacts\" permission.</string> \"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="show_password">Show Password</string>
<string name="no_network">No network connection!</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="audio_focus_denied">Audio focus denied!</string>
<string name="permissions_rationale">Permissions rationale</string> <string name="permissions_rationale">Permissions rationale</string>
<string name="audio_permissions">baresip needs \"Microphone\" permission for voice calls, <string name="audio_permissions">baresip needs \"Microphone\" permission for voice calls,