OSDN Git Service

Bluetooth stopped working in master - "bad file descriptor"
authorZhihai Xu <zhihaixu@google.com>
Wed, 24 Jul 2013 22:09:45 +0000 (15:09 -0700)
committerZhihai Xu <zhihaixu@google.com>
Wed, 24 Jul 2013 22:09:45 +0000 (15:09 -0700)
ignore IllegalArgumentException in BluetoothSocket.close().

bug: 9960585
Change-Id: I301aa388b738dcb92b643fdd96b5c9cb6f8b3efe

core/java/android/bluetooth/BluetoothSocket.java

index d10eaea..5c534a1 100644 (file)
@@ -461,8 +461,13 @@ public final class BluetoothSocket implements Closeable {
                     mSocket.close();
                     mSocket = null;
                 }
-                if(mPfd != null)
-                    mPfd.detachFd();
+                if(mPfd != null) {
+                    try {
+                        mPfd.detachFd();
+                    } catch (IllegalArgumentException e) {
+                        Log.w(TAG, "ignore IllegalArgumentException");
+                    }
+                }
            }
         }
     }