Show bonded devices in "Pair new device"(2/2)

Some users forgot they had paired devices and couldn't see their BT device
when they search device in "Pair new device". (b/80382940, b/80133137).
Need to change the behavior to let paired devices can be shown on "Available devices".

Bug: 111738593
Test: Bluetooth Pairing Test
Change-Id: Ib499785abaa8e4efc1875be113ac87bdbe0c89ba
This commit is contained in:
Ash_Chen
2018-08-17 22:31:41 +08:00
parent af643d3690
commit 8f7092a15e
3 changed files with 41 additions and 10 deletions

View File

@@ -152,7 +152,7 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
addDeviceCategory(mAvailableDevicesCategory,
R.string.bluetooth_preference_found_media_devices,
BluetoothDeviceFilter.UNBONDED_DEVICE_FILTER, mInitialScanStarted);
BluetoothDeviceFilter.ALL_FILTER, mInitialScanStarted);
updateFooterPreference(mFooterPreference);
mAlwaysDiscoverable.start();
enableScanning();
@@ -190,6 +190,17 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
}
}
@Override
public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
if (mSelectedDevice != null) {
BluetoothDevice device = cachedDevice.getDevice();
if (device != null && mSelectedDevice.equals(device)
&& state == BluetoothAdapter.STATE_CONNECTED) {
finish();
}
}
}
@Override
public int getHelpResource() {
return R.string.help_url_bluetooth;