summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java')
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java b/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
index 2a51aa067..38873da12 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
@@ -42,31 +42,31 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver {
if (D) Log.d(TAG, "No device attached to handover intent.");
return;
}
+
+ String mimeType = intent.getType();
+ ArrayList<Uri> uris = new ArrayList<Uri>();
if (action.equals(Constants.ACTION_HANDOVER_SEND)) {
- String type = intent.getType();
Uri stream = (Uri)intent.getParcelableExtra(Intent.EXTRA_STREAM);
- if (stream != null && type != null) {
- // Save type/stream, will be used when adding transfer
- // session to DB.
- BluetoothOppManager.getInstance(context).saveSendingFileInfo(type,
- stream.toString(), true);
- } else {
- if (D) Log.d(TAG, "No mimeType or stream attached to handover request");
- }
+ if (stream != null) uris.add(stream);
} else if (action.equals(Constants.ACTION_HANDOVER_SEND_MULTIPLE)) {
- ArrayList<Uri> uris = new ArrayList<Uri>();
- String mimeType = intent.getType();
uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
- if (mimeType != null && uris != null) {
- BluetoothOppManager.getInstance(context).saveSendingFileInfo(mimeType,
- uris, true);
- } else {
- if (D) Log.d(TAG, "No mimeType or stream attached to handover request");
- return;
- }
}
- // we already know where to send to
- BluetoothOppManager.getInstance(context).startTransfer(device);
+
+ if (mimeType != null && uris != null && !uris.isEmpty()) {
+ final String finalType = mimeType;
+ final ArrayList<Uri> finalUris = uris;
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ BluetoothOppManager.getInstance(context).saveSendingFileInfo(finalType,
+ finalUris, true);
+ BluetoothOppManager.getInstance(context).startTransfer(device);
+ }
+ });
+ t.start();
+ } else {
+ if (D) Log.d(TAG, "No mimeType or stream attached to handover request");
+ return;
+ }
} else if (action.equals(Constants.ACTION_WHITELIST_DEVICE)) {
BluetoothDevice device =
(BluetoothDevice)intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);