only consider BLE pairing for addressValid

pull/373/head
andrekir 2022-02-12 19:33:30 -03:00
rodzic c04c1b4add
commit eb5abb4be9
2 zmienionych plików z 4 dodań i 5 usunięć

Wyświetl plik

@ -112,15 +112,14 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
/** Return true if this address is still acceptable. For BLE that means, still bonded */
@SuppressLint("NewApi", "MissingPermission")
override fun addressValid(context: Context, rest: String): Boolean {
val allPaired = if (hasCompanionDeviceApi(context)) {
/* val allPaired = if (hasCompanionDeviceApi(context)) {
val deviceManager: CompanionDeviceManager by lazy {
context.getSystemService(Context.COMPANION_DEVICE_SERVICE) as CompanionDeviceManager
}
deviceManager.associations.map { it }.toSet()
} else {
getBluetoothAdapter(context)?.bondedDevices.orEmpty()
} else { */
val allPaired = getBluetoothAdapter(context)?.bondedDevices.orEmpty()
.map { it.address }.toSet()
}
return if (!allPaired.contains(rest)) {
warn("Ignoring stale bond to ${rest.anonymize}")
false

Wyświetl plik

@ -813,7 +813,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
if (curRadio != null && !MockInterface.addressValid(requireContext(), "")) {
binding.warningNotPaired.visibility = View.GONE
// binding.scanStatusText.text = getString(R.string.current_pair).format(curRadio)
} else {
} else if (model.bluetoothEnabled.value == true){
binding.warningNotPaired.visibility = View.VISIBLE
binding.scanStatusText.text = getString(R.string.not_paired_yet)
}