diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2011-08-03 16:37:48 -0700 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-08-03 16:42:55 -0700 |
commit | 2cbb33c362f865a21e08a8c36a7186e269bb568a (patch) | |
tree | f18634480bd88289425658c29d5500528ddcac87 /core | |
parent | 62c7b37590b1a692384a55949d3b9eba221a3652 (diff) | |
download | frameworks_base-2cbb33c362f865a21e08a8c36a7186e269bb568a.zip frameworks_base-2cbb33c362f865a21e08a8c36a7186e269bb568a.tar.gz frameworks_base-2cbb33c362f865a21e08a8c36a7186e269bb568a.tar.bz2 |
Fix PAN bug for reverse tethering.
We were the setting the iface as null while disconnecting
and so when disconnected the iface used was null - which would
lead to a crash. During connecting we don't know the interface,
so we use null.
Change-Id: I970f2f1886fa32237936eff439c359187a798832
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/server/BluetoothPanProfileHandler.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/core/java/android/server/BluetoothPanProfileHandler.java b/core/java/android/server/BluetoothPanProfileHandler.java index 0d63e19..6636181 100644 --- a/core/java/android/server/BluetoothPanProfileHandler.java +++ b/core/java/android/server/BluetoothPanProfileHandler.java @@ -145,13 +145,14 @@ final class BluetoothPanProfileHandler { return false; } - handlePanDeviceStateChange(device, BluetoothPan.STATE_CONNECTING, + // Send interface as null as it is not known + handlePanDeviceStateChange(device, null, BluetoothPan.STATE_CONNECTING, BluetoothPan.LOCAL_PANU_ROLE); if (mBluetoothService.connectPanDeviceNative(objectPath, "nap")) { debugLog("connecting to PAN"); return true; } else { - handlePanDeviceStateChange(device, BluetoothPan.STATE_DISCONNECTED, + handlePanDeviceStateChange(device, null, BluetoothPan.STATE_DISCONNECTED, BluetoothPan.LOCAL_PANU_ROLE); errorLog("could not connect to PAN"); return false; @@ -168,8 +169,8 @@ final class BluetoothPanProfileHandler { panDevice.mLocalRole == BluetoothPan.LOCAL_NAP_ROLE) { String objectPath = mBluetoothService.getObjectPathFromAddress(device.getAddress()); - handlePanDeviceStateChange(device, BluetoothPan.STATE_DISCONNECTING, - panDevice.mLocalRole); + handlePanDeviceStateChange(device, panDevice.mIface, + BluetoothPan.STATE_DISCONNECTING, panDevice.mLocalRole); if (!mBluetoothService.disconnectPanServerDeviceNative(objectPath, device.getAddress(), @@ -177,7 +178,7 @@ final class BluetoothPanProfileHandler { errorLog("could not disconnect Pan Server Device "+device.getAddress()); // Restore prev state - handlePanDeviceStateChange(device, state, + handlePanDeviceStateChange(device, panDevice.mIface, state, panDevice.mLocalRole); return false; @@ -230,19 +231,19 @@ final class BluetoothPanProfileHandler { return false; } - handlePanDeviceStateChange(device, BluetoothPan.STATE_DISCONNECTING, + handlePanDeviceStateChange(device, panDevice.mIface, BluetoothPan.STATE_DISCONNECTING, panDevice.mLocalRole); if (panDevice.mLocalRole == BluetoothPan.LOCAL_NAP_ROLE) { if (!mBluetoothService.disconnectPanServerDeviceNative(objectPath, device.getAddress(), panDevice.mIface)) { // Restore prev state, this shouldn't happen - handlePanDeviceStateChange(device, state, panDevice.mLocalRole); + handlePanDeviceStateChange(device, panDevice.mIface, state, panDevice.mLocalRole); return false; } } else { if (!mBluetoothService.disconnectPanDeviceNative(objectPath)) { // Restore prev state, this shouldn't happen - handlePanDeviceStateChange(device, state, panDevice.mLocalRole); + handlePanDeviceStateChange(device, panDevice.mIface, state, panDevice.mLocalRole); return false; } } @@ -304,11 +305,6 @@ final class BluetoothPanProfileHandler { mBluetoothService.sendConnectionStateChange(device, state, prevState); } - void handlePanDeviceStateChange(BluetoothDevice device, - int state, int role) { - handlePanDeviceStateChange(device, null, state, role); - } - private class BluetoothPanDevice { private int mState; private String mIfaceAddr; |