[BT] Correct the filter when addCachedDevices

In Change Ia9750adb6b4c1424d084381e9d7c2ca8e7912391, addCachedDevices()
becomes async, but the filter is set outside of addCachedDevices(),
which makes the filter not apply to addCachedDevices().

Direct pass the filter to addCachedDevices() to fix this issue.

Also migrate the test to Kotlin so we can test coroutine.

Fix: 289876965
Test: manual - check BT pairing page
Test: m RunSettingsRoboTests
Change-Id: I95b16840881747ec9f69e5cd778e456bcc8a7626
This commit is contained in:
Chaohui Wang
2023-07-11 17:49:18 +08:00
parent 9416328ab7
commit 8dd32ab07d
4 changed files with 272 additions and 252 deletions

View File

@@ -101,10 +101,8 @@ public class BluetoothPairingDetail extends BluetoothDevicePairingDetailBase imp
if (bluetoothState == BluetoothAdapter.STATE_ON) {
if (mInitialScanStarted) {
// Don't show bonded devices when screen turned back on
setFilter(BluetoothDeviceFilter.UNBONDED_DEVICE_FILTER);
addCachedDevices();
addCachedDevices(BluetoothDeviceFilter.UNBONDED_DEVICE_FILTER);
}
setFilter(BluetoothDeviceFilter.ALL_FILTER);
updateFooterPreference(mFooterPreference);
mAlwaysDiscoverable.start();
}