am 843b4ee1
: Merge change 24276 into eclair
Merge commit '843b4ee178f6cfd7b965c8e2dea5296d1520894d' into eclair-plus-aosp * commit '843b4ee178f6cfd7b965c8e2dea5296d1520894d': Update application for Bluetooth API change: deprecation of BluetoothError.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
};
|
||||
|
@@ -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) {
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user