Merge #75: show the alias the driver gave a paired Bluetooth device

This commit is contained in:
Seb3thehacker committed 2026-11-04 13:28:16 -08:00
commit a70dea7bd5
1 file changed
+2 -2
@@ -104,11 +104,11 @@ object WirelessLink {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
fun pairedDevices(context: Context): List<BluetoothDevice> = fun pairedDevices(context: Context): List<BluetoothDevice> =
context.getSystemService(BluetoothManager::class.java)?.adapter?.bondedDevices context.getSystemService(BluetoothManager::class.java)?.adapter?.bondedDevices
?.sortedBy { it.name ?: it.address } ?.sortedBy { name(it) }
.orEmpty() .orEmpty()
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
fun name(device: BluetoothDevice): String = device.name ?: device.address fun name(device: BluetoothDevice): String = device.alias ?: device.name ?: device.address
fun start(context: Context, device: BluetoothDevice) { fun start(context: Context, device: BluetoothDevice) {
stop(context) stop(context)