summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bluetooth/opp')
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java40
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java6
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java1
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppUtility.java3
4 files changed, 27 insertions, 23 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);
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index 0f23bd382..59e7848b6 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -476,13 +476,13 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
outputStream.write(buffer, 0, readLength);
position += readLength;
+ /* check remote accept or reject */
+ responseCode = putOperation.getResponseCode();
mCallback.removeMessages(BluetoothOppObexSession.MSG_CONNECT_TIMEOUT);
synchronized (this) {
mWaitingForRemote = false;
}
- /* check remote accept or reject */
- responseCode = putOperation.getResponseCode();
if (responseCode == ResponseCodes.OBEX_HTTP_CONTINUE
|| responseCode == ResponseCodes.OBEX_HTTP_OK) {
@@ -595,7 +595,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
} finally {
try {
if (outputStream != null) {
- outputStream.close();
+ outputStream.close();
}
// Close InputStream and remove SendFileInfo from map
diff --git a/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java b/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java
index 2a9cadb8b..f60f06cab 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java
@@ -123,6 +123,7 @@ public class BluetoothOppSendFileInfo {
Log.e(TAG, "generateFileInfo: " + e);
return new BluetoothOppSendFileInfo(fileName, contentType, length, null, 0);
}
+
if (metadataCursor != null) {
try {
if (metadataCursor.moveToFirst()) {
diff --git a/src/com/android/bluetooth/opp/BluetoothOppUtility.java b/src/com/android/bluetooth/opp/BluetoothOppUtility.java
index 8294246f0..99777a5ae 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppUtility.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppUtility.java
@@ -367,6 +367,9 @@ public class BluetoothOppUtility {
static void putSendFileInfo(Uri uri, BluetoothOppSendFileInfo sendFileInfo) {
if (D) Log.d(TAG, "putSendFileInfo: uri=" + uri + " sendFileInfo=" + sendFileInfo);
+ if (sendFileInfo == BluetoothOppSendFileInfo.SEND_FILE_INFO_ERROR) {
+ Log.e(TAG, "putSendFileInfo: bad sendFileInfo, URI: " + uri);
+ }
sSendFileMap.put(uri, sendFileInfo);
}