summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java')
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index e2ecfc5b8..63de591b5 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -128,11 +128,13 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
private static final int sSleepTime = 1000;
private Uri contentUri;
private Context mContext1;
+ private volatile boolean interrupted = false;
public ContentResolverUpdateThread(Context context, Uri cntUri) {
super("BtOpp ContentResolverUpdateThread");
mContext1 = context;
contentUri = cntUri;
+ interrupted = false;
}
@@ -143,19 +145,33 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
ContentValues updateValues;
if (V) Log.v(TAG, "Is ContentResolverUpdateThread Interrupted :" + isInterrupted());
/* Check if the Operation is interrupted before entering into loop */
- while (!isInterrupted()) {
+ while (!interrupted) {
updateValues = new ContentValues();
updateValues.put(BluetoothShare.CURRENT_BYTES, position);
mContext1.getContentResolver().update(contentUri, updateValues,
null, null);
+
+ /* Check if the Operation is interrupted before entering sleep */
+ if (interrupted) {
+ if (V) Log.v(TAG, "ContentResolverUpdateThread was interrupted before sleep !, exiting");
+ return;
+ }
+
try {
Thread.sleep(sSleepTime);
} catch (InterruptedException e1) {
if (V) Log.v(TAG, "ContentResolverUpdateThread was interrupted (1), exiting");
+ interrupted = true;
return;
}
}
}
+
+ @Override
+ public void interrupt() {
+ interrupted = true;
+ super.interrupt();
+ }
}
private class ClientThread extends Thread {