diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-12-26 18:29:58 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-12-26 18:29:58 -0800 |
commit | 056c7ac9baa27d1a6c6bca368553607df49bf770 (patch) | |
tree | f196c5eff51649d10a15f4d8d952b6b539261370 /src/com | |
parent | 47293a2f663bf441886450536b90ceb5c38fd8cd (diff) | |
parent | 19575c596d7b88c1b35e99282fa41d2d10802c68 (diff) | |
download | android_packages_apps_Bluetooth-056c7ac9baa27d1a6c6bca368553607df49bf770.tar.gz android_packages_apps_Bluetooth-056c7ac9baa27d1a6c6bca368553607df49bf770.tar.bz2 android_packages_apps_Bluetooth-056c7ac9baa27d1a6c6bca368553607df49bf770.zip |
Merge "Bluetooth-OPP: Don't wait on Socket thread while turning off BT."
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/bluetooth/opp/BluetoothOppL2capListener.java | 18 | ||||
-rw-r--r-- | src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java | 18 |
2 files changed, 16 insertions, 20 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppL2capListener.java b/src/com/android/bluetooth/opp/BluetoothOppL2capListener.java index 8356dc3db..855851272 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppL2capListener.java +++ b/src/com/android/bluetooth/opp/BluetoothOppL2capListener.java @@ -138,7 +138,10 @@ public class BluetoothOppL2capListener { Log.e(TAG, "Error accept connection " + e); try { Thread.sleep(500); - } catch (InterruptedException ie) {} + } catch (InterruptedException ie) { + Log.e(TAG, "mSocketAcceptThread was interrupted " + ie); + mInterrupted = true; + } } } Log.i(TAG, "BluetoothSocket listen thread finished"); @@ -180,17 +183,12 @@ public class BluetoothOppL2capListener { } } } - try { + if (mSocketAcceptThread != null) { + if (V) Log.v(TAG, "Interrupting mSocketAcceptThread :" + mSocketAcceptThread); mSocketAcceptThread.interrupt(); - if (V) Log.v(TAG, "waiting for thread to terminate"); - //mSocketAcceptThread.join(JOIN_TIMEOUT_MS); - mSocketAcceptThread.join(); - if (V) Log.v(TAG, "done waiting for thread to terminate"); - mSocketAcceptThread = null; - mCallback = null; - } catch (InterruptedException e) { - if (V) Log.v(TAG, "Interrupted waiting for Accept Thread to join"); } + mSocketAcceptThread = null; + mCallback = null; } } diff --git a/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java b/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java index 941878a85..5f7434d0c 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java +++ b/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java @@ -135,7 +135,10 @@ public class BluetoothOppRfcommListener { Log.e(TAG, "Error accept connection " + e); try { Thread.sleep(500); - } catch (InterruptedException ie) {} + } catch (InterruptedException ie) { + Log.e(TAG, "mSocketAcceptThread was interrupted " + ie); + mInterrupted = true; + } } } Log.i(TAG, "BluetoothSocket listen thread finished"); @@ -177,17 +180,12 @@ public class BluetoothOppRfcommListener { } } } - try { + if (mSocketAcceptThread != null) { + if (V) Log.v(TAG, "Interrupting mSocketAcceptThread :" + mSocketAcceptThread); mSocketAcceptThread.interrupt(); - if (V) Log.v(TAG, "waiting for thread to terminate"); - //mSocketAcceptThread.join(JOIN_TIMEOUT_MS); - mSocketAcceptThread.join(); - if (V) Log.v(TAG, "done waiting for thread to terminate"); - mSocketAcceptThread = null; - mCallback = null; - } catch (InterruptedException e) { - if (V) Log.v(TAG, "Interrupted waiting for Accept Thread to join"); } + mSocketAcceptThread = null; + mCallback = null; } } |