b/2173596 Cancel Bluetooth scanning when the user leaves Bluetooth Settings.
Change-Id: Ib4dd6254c90da619e853b1be22fba3ff1365258e
This commit is contained in:
@@ -203,6 +203,12 @@ public class BluetoothSettings extends PreferenceActivity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUserLeaveHint() {
|
||||
super.onUserLeaveHint();
|
||||
mLocalManager.stopScanning();
|
||||
}
|
||||
|
||||
private void addDevices() {
|
||||
List<CachedBluetoothDevice> cachedDevices =
|
||||
mLocalManager.getCachedDeviceManager().getCachedDevicesCopy();
|
||||
|
@@ -52,7 +52,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
||||
private static final String TAG = "CachedBluetoothDevice";
|
||||
private static final boolean D = LocalBluetoothManager.D;
|
||||
private static final boolean V = LocalBluetoothManager.V;
|
||||
private static final boolean DEBUG = false;
|
||||
private static final boolean DEBUG = true; // STOPSHIP - disable before final rom
|
||||
|
||||
private static final int CONTEXT_ITEM_CONNECT = Menu.FIRST + 1;
|
||||
private static final int CONTEXT_ITEM_DISCONNECT = Menu.FIRST + 2;
|
||||
|
@@ -185,6 +185,12 @@ public class LocalBluetoothManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void stopScanning() {
|
||||
if (mAdapter.isDiscovering()) {
|
||||
mAdapter.cancelDiscovery();
|
||||
}
|
||||
}
|
||||
|
||||
public int getBluetoothState() {
|
||||
|
||||
if (mState == BluetoothAdapter.ERROR) {
|
||||
|
Reference in New Issue
Block a user