summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2009-09-08 17:49:57 -0700
committerNick Pelly <npelly@google.com>2009-09-08 17:49:57 -0700
commitf4779354b39353a48d0bec6cc5c71fd73e3f369a (patch)
tree355b00e6c0d56bc2938b9d506b66dd9d25d5a9f1 /src
parentca564d6bdaa56fba60f499e092e1024fff5d1aba (diff)
downloadpackages_apps_Settings-f4779354b39353a48d0bec6cc5c71fd73e3f369a.tar.gz
packages_apps_Settings-f4779354b39353a48d0bec6cc5c71fd73e3f369a.tar.bz2
packages_apps_Settings-f4779354b39353a48d0bec6cc5c71fd73e3f369a.zip
Update application for Bluetooth API change: deprecation of BluetoothError.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java6
-rw-r--r--src/com/android/settings/bluetooth/BluetoothEnabler.java4
-rw-r--r--src/com/android/settings/bluetooth/BluetoothEventRedirector.java7
-rw-r--r--src/com/android/settings/bluetooth/BluetoothNamePreference.java5
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java3
-rw-r--r--src/com/android/settings/bluetooth/CachedBluetoothDevice.java6
-rw-r--r--src/com/android/settings/bluetooth/LocalBluetoothManager.java7
-rw-r--r--src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java28
8 files changed, 28 insertions, 38 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
index db3ccf827..98d387c55 100644
--- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
@@ -19,7 +19,6 @@ package com.android.settings.bluetooth;
import com.android.settings.R;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -56,8 +55,9 @@ public class BluetoothDiscoverableEnabler implements Preference.OnPreferenceChan
@Override
public void onReceive(Context context, Intent intent) {
if (BluetoothAdapter.ACTION_SCAN_MODE_CHANGED.equals(intent.getAction())) {
- int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothError.ERROR);
- if (mode != BluetoothError.ERROR) {
+ int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE,
+ BluetoothAdapter.ERROR);
+ if (mode != BluetoothAdapter.ERROR) {
handleModeChanged(mode);
}
}
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 355ea1393..c1b6de336 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -19,7 +19,6 @@ package com.android.settings.bluetooth;
import com.android.settings.R;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -49,8 +48,7 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
- BluetoothError.ERROR);
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
handleStateChanged(state);
}
};
diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
index 01d61bb7c..645995081 100644
--- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
+++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
@@ -20,7 +20,6 @@ import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
@@ -54,7 +53,7 @@ public class BluetoothEventRedirector {
if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
- BluetoothError.ERROR);
+ BluetoothAdapter.ERROR);
mManager.setBluetoothStateInt(state);
} else if (action.equals(BluetoothIntent.DISCOVERY_STARTED_ACTION)) {
mManager.onScanningStateChanged(true);
@@ -76,10 +75,10 @@ public class BluetoothEventRedirector {
} else if (action.equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)) {
int bondState = intent.getIntExtra(BluetoothIntent.BOND_STATE,
- BluetoothError.ERROR);
+ BluetoothDevice.ERROR);
mManager.getCachedDeviceManager().onBondingStateChanged(device, bondState);
if (bondState == BluetoothDevice.BOND_NOT_BONDED) {
- int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothError.ERROR);
+ int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothDevice.ERROR);
if (reason == BluetoothDevice.UNBOND_REASON_AUTH_REJECTED ||
reason == BluetoothDevice.UNBOND_REASON_AUTH_FAILED ||
reason == BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN) {
diff --git a/src/com/android/settings/bluetooth/BluetoothNamePreference.java b/src/com/android/settings/bluetooth/BluetoothNamePreference.java
index c956f5a19..4a2358fe5 100644
--- a/src/com/android/settings/bluetooth/BluetoothNamePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothNamePreference.java
@@ -20,7 +20,6 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -50,8 +49,8 @@ public class BluetoothNamePreference extends EditTextPreference implements TextW
if (action.equals(BluetoothIntent.NAME_CHANGED_ACTION)) {
setSummaryToName();
} else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) &&
- (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
- BluetoothError.ERROR) == BluetoothAdapter.STATE_ON)) {
+ (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR) ==
+ BluetoothAdapter.STATE_ON)) {
setSummaryToName();
}
}
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 810e07b8c..0d2ebd72d 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -26,7 +26,6 @@ import java.util.WeakHashMap;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothIntent;
-import android.bluetooth.BluetoothError;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -92,7 +91,7 @@ public class BluetoothSettings extends PreferenceActivity
} else if (intent.getAction().equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)
&& mScreenType == SCREEN_TYPE_DEVICEPICKER) {
int bondState = intent
- .getIntExtra(BluetoothIntent.BOND_STATE, BluetoothError.ERROR);
+ .getIntExtra(BluetoothIntent.BOND_STATE, BluetoothDevice.ERROR);
if (bondState == BluetoothDevice.BOND_BONDED) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothIntent.DEVICE);
sendDevicePickedIntent(device);
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 65f4645d7..9ee2f365c 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -20,7 +20,6 @@ import android.app.AlertDialog;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -322,8 +321,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
if (SettingsBtStatus.isConnectionStatusConnected(status)) {
- if (profileManager.disconnect(cachedDevice.mDevice) ==
- BluetoothError.SUCCESS) {
+ if (profileManager.disconnect(cachedDevice.mDevice)) {
return true;
}
}
@@ -408,7 +406,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
- if (profileManager.connect(cachedDevice.mDevice) == BluetoothError.SUCCESS) {
+ if (profileManager.connect(cachedDevice.mDevice)) {
return true;
}
Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
index 77e16f570..a5a0140c7 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
@@ -27,7 +27,6 @@ import android.app.AlertDialog;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothIntent;
import android.content.Context;
import android.content.Intent;
@@ -64,7 +63,7 @@ public class LocalBluetoothManager {
private BluetoothEventRedirector mEventRedirector;
private BluetoothA2dp mBluetoothA2dp;
- private int mState = BluetoothError.ERROR;
+ private int mState = BluetoothAdapter.ERROR;
private List<Callback> mCallbacks = new ArrayList<Callback>();
@@ -187,7 +186,7 @@ public class LocalBluetoothManager {
public int getBluetoothState() {
- if (mState == BluetoothError.ERROR) {
+ if (mState == BluetoothAdapter.ERROR) {
syncBluetoothState();
}
@@ -211,7 +210,7 @@ public class LocalBluetoothManager {
? BluetoothAdapter.STATE_ON
: BluetoothAdapter.STATE_OFF;
} else {
- bluetoothState = BluetoothError.ERROR;
+ bluetoothState = BluetoothAdapter.ERROR;
}
setBluetoothStateInt(bluetoothState);
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
index 2a52a8ba5..6f343c10b 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
@@ -19,7 +19,6 @@ package com.android.settings.bluetooth;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothClass;
-import android.bluetooth.BluetoothError;
import android.bluetooth.BluetoothHeadset;
import android.os.Handler;
import android.text.TextUtils;
@@ -102,9 +101,9 @@ public abstract class LocalBluetoothProfileManager {
mLocalManager = localManager;
}
- public abstract int connect(BluetoothDevice device);
+ public abstract boolean connect(BluetoothDevice device);
- public abstract int disconnect(BluetoothDevice device);
+ public abstract boolean disconnect(BluetoothDevice device);
public abstract int getConnectionStatus(BluetoothDevice device);
@@ -145,7 +144,7 @@ public abstract class LocalBluetoothProfileManager {
}
@Override
- public int connect(BluetoothDevice device) {
+ public boolean connect(BluetoothDevice device) {
Set<BluetoothDevice> sinks = mService.getConnectedSinks();
if (sinks != null) {
for (BluetoothDevice sink : sinks) {
@@ -156,7 +155,7 @@ public abstract class LocalBluetoothProfileManager {
}
@Override
- public int disconnect(BluetoothDevice device) {
+ public boolean disconnect(BluetoothDevice device) {
return mService.disconnectSink(device);
}
@@ -240,20 +239,19 @@ public abstract class LocalBluetoothProfileManager {
}
@Override
- public int connect(BluetoothDevice device) {
+ public boolean connect(BluetoothDevice device) {
// Since connectHeadset fails if already connected to a headset, we
// disconnect from any headset first
mService.disconnectHeadset();
- return mService.connectHeadset(device)
- ? BluetoothError.SUCCESS : BluetoothError.ERROR;
+ return mService.connectHeadset(device);
}
@Override
- public int disconnect(BluetoothDevice device) {
+ public boolean disconnect(BluetoothDevice device) {
if (mService.getCurrentHeadset().equals(device)) {
- return mService.disconnectHeadset() ? BluetoothError.SUCCESS : BluetoothError.ERROR;
+ return mService.disconnectHeadset();
} else {
- return BluetoothError.SUCCESS;
+ return false;
}
}
@@ -312,13 +310,13 @@ public abstract class LocalBluetoothProfileManager {
}
@Override
- public int connect(BluetoothDevice device) {
- return -1;
+ public boolean connect(BluetoothDevice device) {
+ return false;
}
@Override
- public int disconnect(BluetoothDevice device) {
- return -1;
+ public boolean disconnect(BluetoothDevice device) {
+ return false;
}
@Override