MAP: Start new thread properly to prevent ANR
As MapClient thread join was happening in main thread
So if client is fetching the large data & do disconnect.
It causes the ANR. Starting MapClient thread join into
new thread properly to prevent ANR.
CRs-fixed: 934429
Change-Id: Ife121a05ba102a2f4b8e274051bbb068374faf54
diff --git a/src/android/bluetooth/client/map/BluetoothMasObexClientSession.java b/src/android/bluetooth/client/map/BluetoothMasObexClientSession.java
index 37f758c..4aa0cf4 100644
--- a/src/android/bluetooth/client/map/BluetoothMasObexClientSession.java
+++ b/src/android/bluetooth/client/map/BluetoothMasObexClientSession.java
@@ -179,9 +179,9 @@
if (mClientThread != null) {
mClientThread.shutdown();
- (new Thread() {
- @Override
- public void run() {
+ Thread t = new Thread(new Runnable() {
+ public void run () {
+ Log.d(TAG, "Spawning a new thread for stopping obex session");
try {
mClientThread.join();
mClientThread = null;
@@ -189,7 +189,9 @@
Log.w(TAG, "Interrupted while waiting for thread to join");
}
}
- }).run();
+ });
+ t.start();
+ Log.d(TAG, "Exiting from the stopping thread");
}
}