summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/bluetooth/gatt/GattService.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java
index 854e9ae5a..d231f0fed 100644
--- a/src/com/android/bluetooth/gatt/GattService.java
+++ b/src/com/android/bluetooth/gatt/GattService.java
@@ -727,7 +727,15 @@ public class GattService extends ProfileService {
void onSearchCompleted(int connId, int status) throws RemoteException {
if (DBG) Log.d(TAG, "onSearchCompleted() - connId=" + connId+ ", status=" + status);
// Gatt DB is ready!
- gattClientGetGattDbNative(connId);
+
+ // This callback was called from the jni_workqueue thread. If we make request to the stack
+ // on the same thread, it might cause deadlock. Schedule request on a new thread instead.
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ gattClientGetGattDbNative(connId);
+ }
+ });
+ t.start();
}
GattDbElement GetSampleGattDbElement() {