mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
refactor: Small code improvement
This commit is contained in:
parent
07f3c49a88
commit
3f72efc8e6
@ -55,11 +55,13 @@ data class MicrophoneInfo(
|
||||
fun fetchDeviceMicrophones(context: Context): List<MicrophoneInfo> {
|
||||
return try {
|
||||
val audioManager = context.getSystemService(Context.AUDIO_SERVICE)!! as AudioManager
|
||||
(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val availableDevices = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
audioManager.availableCommunicationDevices.map(::fromDeviceInfo)
|
||||
} else {
|
||||
audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS).map(::fromDeviceInfo)
|
||||
}).filter {
|
||||
}
|
||||
|
||||
availableDevices.filter {
|
||||
ALLOWED_MICROPHONE_TYPES.contains(it.deviceInfo.type) && it.deviceInfo.isSink
|
||||
}
|
||||
} catch (error: Exception) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user