mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Actually do not disable earpiece, it works even without telecom manager support
This commit is contained in:
parent
248a06c8be
commit
86e09b5dce
3 changed files with 1 additions and 17 deletions
|
|
@ -168,12 +168,6 @@ class TelecomCallControlCallback(
|
|||
}.launchIn(scope)
|
||||
}
|
||||
|
||||
fun isEarpieceAvailable(): Boolean {
|
||||
return availableEndpoints.find {
|
||||
it.type == CallEndpointCompat.Companion.TYPE_EARPIECE
|
||||
} != null
|
||||
}
|
||||
|
||||
fun applyAudioRouteToCallWithId(routes: List<AudioDevice.Type>): Boolean {
|
||||
Log.i("$TAG Looking for audio endpoint with type [${routes.first()}]")
|
||||
|
||||
|
|
|
|||
|
|
@ -194,10 +194,4 @@ class TelecomManager @WorkerThread constructor(context: Context) {
|
|||
|
||||
return callControlCallback.applyAudioRouteToCallWithId(routes)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
fun isEarpieceAvailable(callId: String): Boolean {
|
||||
val callControlCallback = map[callId]
|
||||
return callControlCallback?.isEarpieceAvailable() ?: false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -681,9 +681,6 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
|||
coreContext.postOnCoreThread { core ->
|
||||
val audioDevices = core.audioDevices
|
||||
val list = arrayListOf<AudioDeviceModel>()
|
||||
val isEarpieceAvailable = coreContext.telecomManager.isEarpieceAvailable(
|
||||
currentCall.callLog.callId ?: ""
|
||||
)
|
||||
for (device in audioDevices) {
|
||||
// Only list output audio devices
|
||||
if (!device.hasCapability(AudioDevice.Capabilities.CapabilityPlay)) continue
|
||||
|
|
@ -717,8 +714,7 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
val currentDevice = currentCall.outputAudioDevice
|
||||
val isCurrentlyInUse = device.type == currentDevice?.type && device.deviceName == currentDevice?.deviceName
|
||||
val enabled = if (device.type == AudioDevice.Type.Earpiece) isEarpieceAvailable else true
|
||||
val model = AudioDeviceModel(device, name, device.type, isCurrentlyInUse, enabled) {
|
||||
val model = AudioDeviceModel(device, name, device.type, isCurrentlyInUse, true) {
|
||||
// onSelected
|
||||
coreContext.postOnCoreThread {
|
||||
Log.i("$TAG Selected audio device with ID [${device.id}]")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue