summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
diff options
context:
space:
mode:
authorFred <fredc@broadcom.com>2012-07-31 21:14:11 -0700
committerMatthew Xie <mattx@google.com>2012-08-08 12:17:23 -0700
commit15d36984a79d6e35c659edb0efdf929f0b526bd5 (patch)
treeffa035fef889aa54c2e4c4953f343f9e5bb1bd6c /src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
parent0322ae1f5e8ea55c391145e7925cb5962a97c11f (diff)
downloadandroid_packages_apps_Bluetooth-15d36984a79d6e35c659edb0efdf929f0b526bd5.tar.gz
android_packages_apps_Bluetooth-15d36984a79d6e35c659edb0efdf929f0b526bd5.tar.bz2
android_packages_apps_Bluetooth-15d36984a79d6e35c659edb0efdf929f0b526bd5.zip
Fix for BT turn on/off issues: NPE, FD/thread leaks, ANR.
This fix addresses numerous BT on/off issues found from the CTS test. Fixed fD/pipe leak in various state machine Looper objects by calling quit() function. Fixed cursor leak in AtPhonebook. Change Pbap to stop the RFCOMM listener on the STATE_TURNING_OFF instead of STATE_OFF. Removed several cleanup() methods causing NPE. Reduced RFCOMM listener timeout from 3 seconds to 300ms between retry. bug 6834336 Change-Id: I52423343d8f52f65294af0143f373871a9874d77
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java')
-rwxr-xr-xsrc/com/android/bluetooth/opp/BluetoothOppRfcommListener.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java b/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
index b5506f07f..6109b5a61 100755
--- a/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
@@ -53,10 +53,8 @@ public class BluetoothOppRfcommListener {
private static final boolean V = Constants.VERBOSE;
public static final int MSG_INCOMING_BTOPP_CONNECTION = 100;
- private static final int JOIN_TIMEOUT_MS=2000;
private volatile boolean mInterrupted;
- private volatile boolean mFinish;
private Thread mSocketAcceptThread;
@@ -123,11 +121,12 @@ public class BluetoothOppRfcommListener {
Log.e(TAG, "Error create RfcommServerSocket " + e1);
serverOK = false;
}
+
if (!serverOK) {
synchronized (this) {
try {
- if (V) Log.v(TAG, "Wait 3 seconds");
- Thread.sleep(3000);
+ if (V) Log.v(TAG, "Wait 300 ms");
+ Thread.sleep(300);
} catch (InterruptedException e) {
Log.e(TAG, "socketAcceptThread thread was interrupted (3)");
mInterrupted = true;
@@ -169,6 +168,9 @@ public class BluetoothOppRfcommListener {
}
} catch (IOException e) {
Log.e(TAG, "Error accept connection " + e);
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException ie) {}
}
}
Log.i(TAG, "BluetoothSocket listen thread finished");