mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(bluetooth): Check for permissions before accessing bonded devices (#3720)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
d6f39fdcb5
commit
12ccb34553
2 changed files with 17 additions and 14 deletions
|
|
@ -160,11 +160,13 @@ constructor(
|
|||
Timber.d("Detected our bluetooth access=$newState")
|
||||
}
|
||||
|
||||
private fun getBondedAppPeripherals(enabled: Boolean): List<Peripheral> = if (enabled) {
|
||||
centralManager.getBondedPeripherals().filter(::isMatchingPeripheral)
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
@SuppressLint("MissingPermission")
|
||||
private fun getBondedAppPeripherals(enabled: Boolean): List<Peripheral> =
|
||||
if (enabled && application.hasBluetoothPermission()) {
|
||||
centralManager.getBondedPeripherals().filter(::isMatchingPeripheral)
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
|
||||
/** Checks if a peripheral is one of ours, either by its advertised name or by the services it provides. */
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue