Merge "Emulator: avoid accessing null BluetoothAdapter" into nyc-dev am: 9b9ca65db9

am: 11e94adaec

* commit '11e94adaec3b17bce9c4c304ae55c24682b090ba':
  Emulator: avoid accessing null BluetoothAdapter
This commit is contained in:
Bo Hu
2016-02-24 23:00:00 +00:00
committed by android-build-merger

View File

@@ -496,8 +496,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
@Override
public void setListening(boolean listening) {
BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
if (defaultAdapter == null) return;
if (listening) {
BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
mEnabled = defaultAdapter.isEnabled();
mConnected =
defaultAdapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED;