diff options
author | Pradeep Panigrahi <pradeepp@codeaurora.org> | 2013-08-29 09:28:05 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2016-08-24 08:17:08 -0600 |
commit | 77c8b6f08cc17b21a8ab78f6dad96e50d1432c10 (patch) | |
tree | b36311667f8870dca3801be35f66e12b3d65061a /src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java | |
parent | 8628d095d3af153251ced5179ca969b23b24056f (diff) | |
download | android_packages_apps_Bluetooth-77c8b6f08cc17b21a8ab78f6dad96e50d1432c10.tar.gz android_packages_apps_Bluetooth-77c8b6f08cc17b21a8ab78f6dad96e50d1432c10.tar.bz2 android_packages_apps_Bluetooth-77c8b6f08cc17b21a8ab78f6dad96e50d1432c10.zip |
Opp: Do not terminate session when a Batch contains an empty file
Use Case:
1) pair to remote device.
2) Send files in a batch, such that the batch
contains an empty file in between.
Failure:
Remote rejects empty file and DUT stop sending remaining
files in queue
Fix:
If an empty file is rejected by the remote device, client session is
terminated and remaining files in the batch also marked as failure.
This change continues to send the pending files in the batch even an
empty file is rejected by the remote device. Also it provides appropriate
message to the user.
CRs-Fixed: 1019540
Change-Id: I90d06ad9f21ae387e38f076c0f16ce1d05bdf7ea
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java')
-rw-r--r-- | src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java index aa6b159cd..5d7f36291 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java +++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java @@ -511,6 +511,13 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { if (responseCode != -1) { if (V) Log.v(TAG, "Get response code " + responseCode); if (responseCode != ResponseCodes.OBEX_HTTP_OK) { + if ((fileInfo.mLength == 0) && + (responseCode == ResponseCodes.OBEX_HTTP_LENGTH_REQUIRED)) { + /* Set if the file length is zero and it's rejected by remote */ + BluetoothOppManager.getInstance(mContext1).zero_length_file = true; + /* To mark transfer status as failed in the notification */ + status = BluetoothShare.STATUS_FORBIDDEN; + } else { Log.i(TAG, "Response error code is " + responseCode); status = BluetoothShare.STATUS_UNHANDLED_OBEX_CODE; if (responseCode == ResponseCodes.OBEX_HTTP_UNSUPPORTED_TYPE) { @@ -521,6 +528,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { status = BluetoothShare.STATUS_FORBIDDEN; } } + } } else { // responseCode is -1, which means connection error status = BluetoothShare.STATUS_CONNECTION_ERROR; @@ -529,6 +537,14 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { Constants.updateShareStatus(mContext1, mInfo.mId, status); + if (BluetoothOppManager.getInstance(mContext1).zero_length_file) { + /* Mark the status as success when a zero length file is rejected + * by the remote device. It allows us to continue the transfer if + * we have a batch and the file(s) are yet be sent in the row. + */ + status = BluetoothShare.STATUS_SUCCESS; + } + if (inputStream != null) { inputStream.close(); } |