am 81cdaff7: b/2173596 Cancel Bluetooth scanning when the user leaves Bluetooth Settings.

Merge commit '81cdaff7b5aed3ea2b987b23e2e9a6c0213b0aa5' into eclair-mr2-plus-aosp

* commit '81cdaff7b5aed3ea2b987b23e2e9a6c0213b0aa5':
  b/2173596 Cancel Bluetooth scanning when the user leaves Bluetooth Settings.
This commit is contained in:
Michael Chan
2009-10-08 12:07:14 -07:00
committed by Android Git Automerger
3 changed files with 13 additions and 1 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -185,6 +185,12 @@ public class LocalBluetoothManager {
}
}
public void stopScanning() {
if (mAdapter.isDiscovering()) {
mAdapter.cancelDiscovery();
}
}
public int getBluetoothState() {
if (mState == BluetoothAdapter.ERROR) {