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

This commit is contained in:
TreeHugger Robot
2018-08-28 14:32:04 +00:00
committed by Android (Google) Code Review
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;

View File

@@ -192,6 +192,8 @@ public abstract class DeviceListPreferenceFragment extends
preference = new BluetoothDevicePreference(getPrefContext(), cachedDevice,
mShowDevicesWithoutNames);
preference.setKey(key);
//Set hideSecondTarget is true if it's bonded device.
preference.hideSecondTarget(true);
mDeviceListGroup.addPreference(preference);
} else {
// Tell the preference it is being re-used in case there is new info in the