Fix device picker minor bug

When in device picker screen, if other device triggers pairing process with own
device, after paired succssfully, it should not send intent to OppReceiver to
start file sending. We need check if the paired device is the one user selected.

Original Author: Lixin Yue
Modified by: Jaikumar Ganesh (jaikumar@google.com)

Change-Id: I32df995ba94417470cccaead492844a9c61c0846
This commit is contained in:
Lixin Yue
2009-09-22 10:44:51 +08:00
committed by Jaikumar Ganesh
parent 4b6b2aa123
commit cd47ae6af2

View File

@@ -71,6 +71,8 @@ public class BluetoothSettings extends PreferenceActivity
private String mLaunchPackage; private String mLaunchPackage;
private String mLaunchClass; private String mLaunchClass;
private BluetoothDevice mSelectedDevice= null;
private LocalBluetoothManager mLocalManager; private LocalBluetoothManager mLocalManager;
private BluetoothEnabler mEnabler; private BluetoothEnabler mEnabler;
@@ -95,9 +97,12 @@ public class BluetoothSettings extends PreferenceActivity
int bondState = intent int bondState = intent
.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR); .getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR);
if (bondState == BluetoothDevice.BOND_BONDED) { if (bondState == BluetoothDevice.BOND_BONDED) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); BluetoothDevice device = intent
sendDevicePickedIntent(device); .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
finish(); if (device.equals(mSelectedDevice)) {
sendDevicePickedIntent(device);
finish();
}
} }
} }
} }
@@ -249,9 +254,10 @@ public class BluetoothSettings extends PreferenceActivity
} else if (mScreenType == SCREEN_TYPE_DEVICEPICKER) { } else if (mScreenType == SCREEN_TYPE_DEVICEPICKER) {
CachedBluetoothDevice device = btPreference.getCachedDevice(); CachedBluetoothDevice device = btPreference.getCachedDevice();
if ((device.getBondState() == BluetoothDevice.BOND_BONDED) || (mNeedAuth == false)) { mSelectedDevice = device.getDevice();
BluetoothDevice btAddress = btPreference.getCachedDevice().getDevice(); if ((device.getBondState() == BluetoothDevice.BOND_BONDED) ||
sendDevicePickedIntent(btAddress); (mNeedAuth == false)) {
sendDevicePickedIntent(mSelectedDevice);
finish(); finish();
} else { } else {
btPreference.getCachedDevice().onClicked(); btPreference.getCachedDevice().onClicked();