summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmriti Gupta <smritig@codeaurora.org>2014-09-12 10:46:51 +0530
committerSmriti Gupta <smritig@codeaurora.org>2014-09-19 11:39:38 +0530
commite29990d1ff741824cbf5c54aee447f47fc7cf122 (patch)
treee4b09bf79efece6cb0dcfa58207fef91f752cc7f
parent0489f367e07024ae71628c47f67f246555fe10d4 (diff)
downloadandroid_packages_apps_BluetoothExt-e29990d1ff741824cbf5c54aee447f47fc7cf122.tar.gz
android_packages_apps_BluetoothExt-e29990d1ff741824cbf5c54aee447f47fc7cf122.tar.bz2
android_packages_apps_BluetoothExt-e29990d1ff741824cbf5c54aee447f47fc7cf122.zip
PBAP C: Run the abort operation in a seperate thread
This change has been done to start the ABORT in a seperate thread so that it doesn't block the main thread. The new thread was not spawned properly with the old implementation. Change-Id: I0676e11e1ccdbbd9f9c7d1378293e12a3059bd04 CRs-Fixed: 720092
-rw-r--r--src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapObexSession.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapObexSession.java b/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapObexSession.java
index c29f0f9..8292dae 100644
--- a/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapObexSession.java
+++ b/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapObexSession.java
@@ -100,14 +100,17 @@ final class BluetoothPbapObexSession {
* since abort may block until complete GET is processed inside OBEX
* session, let's run it in separate thread so it won't block UI
*/
- Log.d(TAG, "aborting the ongoing request");
- (new Thread() {
- @Override
- public void run() {
+ Thread t = new Thread(new Runnable() {
+ public void run () {
+ if (mObexClientThread != null && mObexClientThread.mRequest != null) {
+ Log.d(TAG, "Spawning a new thread for aborting");
mObexClientThread.mRequest.abort();
}
- }).run();
- }
+ }
+ });
+ t.start();
+ Log.d(TAG, "Exiting from the abort thread");
+ }
}
public boolean schedule(BluetoothPbapRequest request) {