summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2012-08-08 12:19:13 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-08-08 12:19:13 -0700
commit73d192095093759688cccc896714f71fcee218d8 (patch)
treef140691c0194201178c164999088c14a1dee1a63 /src/com/android/bluetooth/opp/BluetoothOppRfcommListener.java
parent4f5430babbc5a8f870e5a578a4ea3452f41dd97a (diff)
parent15d36984a79d6e35c659edb0efdf929f0b526bd5 (diff)
downloadandroid_packages_apps_Bluetooth-73d192095093759688cccc896714f71fcee218d8.tar.gz
android_packages_apps_Bluetooth-73d192095093759688cccc896714f71fcee218d8.tar.bz2
android_packages_apps_Bluetooth-73d192095093759688cccc896714f71fcee218d8.zip
Merge "Fix for BT turn on/off issues: NPE, FD/thread leaks, ANR." into jb-mr1-dev
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");