Enable reverse tethering in BT settings screen.

- Enable support for reverse tethering in BT settings.
- Add string resource for "Auto connect" preference.
- Remove unused imports and other minor cleanups.
- Add isConnectable() and isAutoConnectable() methods to Profile
  enum type and remove isConnectableProfile() method.

Change-Id: Ie606db04028a8278e98231f0671a388671f2f067
This commit is contained in:
Jake Hamby
2010-12-16 18:33:28 -08:00
parent 9757e30dfa
commit 39ef225e7c
16 changed files with 100 additions and 126 deletions

View File

@@ -57,12 +57,11 @@ public class LocalBluetoothManager {
private BluetoothAdapter mAdapter;
private CachedBluetoothDeviceManager mCachedDeviceManager;
private BluetoothEventRedirector mEventRedirector;
private BluetoothA2dp mBluetoothA2dp;
private int mState = BluetoothAdapter.ERROR;
private List<Callback> mCallbacks = new ArrayList<Callback>();
private final List<Callback> mCallbacks = new ArrayList<Callback>();
private static final int SCAN_EXPIRATION_MS = 5 * 60 * 1000; // 5 mins
@@ -111,15 +110,14 @@ public class LocalBluetoothManager {
mCachedDeviceManager = new CachedBluetoothDeviceManager(this);
mEventRedirector = new BluetoothEventRedirector(this);
mEventRedirector.start();
new BluetoothEventRedirector(this).registerReceiver();
mAdapter.getProfileProxy(mContext, mProfileListener, BluetoothProfile.A2DP);
return true;
}
private BluetoothProfile.ServiceListener mProfileListener =
private final BluetoothProfile.ServiceListener mProfileListener =
new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
mBluetoothA2dp = (BluetoothA2dp) proxy;
@@ -286,7 +284,7 @@ public class LocalBluetoothManager {
}
}
public void showError(BluetoothDevice device, int titleResId, int messageResId) {
public void showError(BluetoothDevice device, int messageResId) {
CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(device);
String name = null;
if (cachedDevice == null) {
@@ -304,7 +302,7 @@ public class LocalBluetoothManager {
// Need an activity context to show a dialog
mErrorDialog = new AlertDialog.Builder(mForegroundActivity)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(titleResId)
.setTitle(R.string.bluetooth_error_title)
.setMessage(message)
.setPositiveButton(android.R.string.ok, null)
.show();