mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Added a logger for Android Auto connection state + do not use bluetooth sound card as playback device for voice recordings when connected to Auto
This commit is contained in:
parent
144fc5d728
commit
cda23c44c0
5 changed files with 29 additions and 1 deletions
|
|
@ -175,6 +175,7 @@ dependencies {
|
|||
implementation(libs.androidx.navigation.fragment.ktx)
|
||||
implementation(libs.androidx.navigation.ui.ktx)
|
||||
implementation(libs.androidx.emoji2)
|
||||
implementation(libs.androidx.car)
|
||||
|
||||
// https://github.com/google/flexbox-layout/blob/main/LICENSE Apache v2.0
|
||||
implementation(libs.google.flexbox)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
var bearerAuthInfoPendingPasswordUpdate: AuthInfo? = null
|
||||
var digestAuthInfoPendingPasswordUpdate: AuthInfo? = null
|
||||
|
||||
var isConnectedToAndroidAuto: Boolean = false
|
||||
|
||||
val bearerAuthenticationRequestedEvent: MutableLiveData<Event<Pair<String, String?>>> by lazy {
|
||||
MutableLiveData<Event<Pair<String, String?>>>()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import android.os.Parcelable
|
|||
import android.view.Gravity
|
||||
import android.view.ViewTreeObserver
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.car.app.connection.CarConnection
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
|
@ -243,6 +244,18 @@ class MainActivity : GenericActivity() {
|
|||
showRedToast(message, icon)
|
||||
}
|
||||
}
|
||||
|
||||
CarConnection(this).type.observe(this) {
|
||||
val asString = when (it) {
|
||||
CarConnection.CONNECTION_TYPE_NOT_CONNECTED -> "NOT CONNECTED"
|
||||
CarConnection.CONNECTION_TYPE_PROJECTION -> "PROJECTION"
|
||||
CarConnection.CONNECTION_TYPE_NATIVE -> "NATIVE"
|
||||
else -> "UNEXPECTED ($it)"
|
||||
}
|
||||
Log.i("$TAG Car connection is [$asString]")
|
||||
val projection = it == CarConnection.CONNECTION_TYPE_PROJECTION
|
||||
coreContext.isConnectedToAndroidAuto = projection
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPostCreate(savedInstanceState: Bundle?) {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,17 @@ class AudioUtils {
|
|||
Log.i(
|
||||
"$TAG Found headset/headphones/hearingAid sound card [$headphonesCard], bluetooth sound card [$bluetoothCard], speaker sound card [$speakerCard] and earpiece sound card [$earpieceCard]"
|
||||
)
|
||||
return headphonesCard ?: bluetoothCard ?: speakerCard ?: earpieceCard
|
||||
return if (coreContext.isConnectedToAndroidAuto) {
|
||||
Log.w(
|
||||
"$TAG Device seems to be connected to Android Auto, do not use bluetooth sound card, priority order is headphone > speaker > earpiece"
|
||||
)
|
||||
headphonesCard ?: speakerCard ?: earpieceCard
|
||||
} else {
|
||||
Log.i(
|
||||
"$TAG Device doesn't seem to be connected to Android Auto, use headphone > bluetooth > speaker > earpiece sound card in priority order"
|
||||
)
|
||||
headphonesCard ?: bluetoothCard ?: speakerCard ?: earpieceCard
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ gridlayout = "1.0.0"
|
|||
securityCryptoKtx = "1.1.0-alpha06"
|
||||
navigation = "2.7.7"
|
||||
emoji2 = "1.4.0"
|
||||
car = "1.7.0-alpha02"
|
||||
flexbox = "3.0.0"
|
||||
material = "1.11.0"
|
||||
protobuf = "3.22.3"
|
||||
|
|
@ -47,6 +48,7 @@ androidx-security-crypto-ktx = { group = "androidx.security", name = "security-c
|
|||
androidx-navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigation" }
|
||||
androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigation" }
|
||||
androidx-emoji2 = { group = "androidx.emoji2", name = "emoji2-emojipicker", version.ref = "emoji2" }
|
||||
androidx-car = { group = "androidx.car.app", name = "app", version.ref = "car" }
|
||||
|
||||
google-firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBomVersion" }
|
||||
google-firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging" }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue