diff options
| author | Steve Kondik <shade@chemlab.org> | 2012-06-24 00:42:57 +0400 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-06-24 00:42:57 +0400 |
| commit | cfb597a6eeeee591adb475789c7040774decece1 (patch) | |
| tree | 440a936f28ba1d8b54b55f07426ef76bed288b53 | |
| parent | 833be34d7f43e2395eb005c4a322ae1140157897 (diff) | |
| parent | 3496e98be274e94d65d7bcb8cc4137888b8e1e55 (diff) | |
| download | android_packages_apps_Bluetooth-cfb597a6eeeee591adb475789c7040774decece1.tar.gz android_packages_apps_Bluetooth-cfb597a6eeeee591adb475789c7040774decece1.tar.bz2 android_packages_apps_Bluetooth-cfb597a6eeeee591adb475789c7040774decece1.zip | |
Merge "Fix FC in Bluetooth due to MAP" into ics
| -rw-r--r-- | src/com/android/bluetooth/map/BluetoothMns.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMns.java b/src/com/android/bluetooth/map/BluetoothMns.java index c1387d8c8..d69ac3659 100644 --- a/src/com/android/bluetooth/map/BluetoothMns.java +++ b/src/com/android/bluetooth/map/BluetoothMns.java @@ -133,7 +133,7 @@ public class BluetoothMns { private BluetoothAdapter mAdapter; - private BluetoothMnsObexSession mSession; + private BluetoothMnsObexSession mSession=null; private int mStartId = -1; @@ -199,12 +199,15 @@ public class BluetoothMns { Log.d(TAG, " Handle Message " + msg.what); switch (msg.what) { case MNS_CONNECT: - if (mSession != null) { - Log.d(TAG, "Disconnect previous obex connection"); - mSession.disconnect(); - mSession = null; + /*The documentation just specifies that no more than one connection is initiated + at a time, so we re-use it here, rather than disconnecting and reconnecting, + which can cause issues on some vehicles */ + if (mSession == null) { + start((BluetoothDevice) msg.obj); } - start((BluetoothDevice) msg.obj); + else + Log.d(TAG, "Re-using previous obex connection"); + break; case MNS_DISCONNECT: deregisterUpdates(); @@ -239,7 +242,6 @@ public class BluetoothMns { case RFCOMM_ERROR: if (V) Log.v(TAG, "receive RFCOMM_ERROR msg"); mConnectThread = null; - break; /* * RFCOMM connected. Do an OBEX connect by starting the session @@ -283,7 +285,8 @@ public class BluetoothMns { break; case MNS_SEND_EVENT: - sendEvent((String) msg.obj); + if(mSession != null) /* Prevents an FC in case the session has died */ + sendEvent((String) msg.obj); break; } } |
