Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef90053d authored by Juffin Alex Varghese's avatar Juffin Alex Varghese Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth-OPP: Enable support to send multiple files

Change will add support to send multiple files. Otherwise, if
same file is selected to send multiple times after first transfer
succeeds queued instances of the same file got removed and its shown
as failed to sent.

CRs-Fixed: 561121
Change-Id: Ifcaee3f8a6373773d0bccfc36899f81f8fd73f26
parent b5ff6942
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -611,7 +611,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
            } finally {
                try {
                    // Close InputStream and remove SendFileInfo from map
                    BluetoothOppUtility.closeSendFileInfo(mInfo.mUri);
                    BluetoothOppUtility.closeSendFileInfo(mInfo.mUri, fileInfo);

                    if (uiUpdateThread != null) {
                        uiUpdateThread.interrupt ();
+1 −1
Original line number Diff line number Diff line
@@ -719,7 +719,7 @@ public class BluetoothOppService extends Service {
                if (sendFileInfo == null || sendFileInfo.mInputStream == null) {
                    Log.e(TAG, "Can't open file for OUTBOUND info " + info.mId);
                    Constants.updateShareStatus(this, info.mId, BluetoothShare.STATUS_BAD_REQUEST);
                    BluetoothOppUtility.closeSendFileInfo(info.mUri);
                    BluetoothOppUtility.closeSendFileInfo(info.mUri, sendFileInfo);
                    return;
                }
            }
+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
                if (info.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
                    BluetoothOppSendFileInfo fileInfo
                            = BluetoothOppUtility.getSendFileInfo(info.mUri);
                    BluetoothOppUtility.closeSendFileInfo(info.mUri);
                    BluetoothOppUtility.closeSendFileInfo(info.mUri, fileInfo);
                    if (fileInfo.mFileName != null) {
                        updateValues.put(BluetoothShare.FILENAME_HINT, fileInfo.mFileName);
                        updateValues.put(BluetoothShare.TOTAL_BYTES, fileInfo.mLength);
+5 −5
Original line number Diff line number Diff line
@@ -334,12 +334,12 @@ public class BluetoothOppUtility {
        return (info != null) ? info : BluetoothOppSendFileInfo.SEND_FILE_INFO_ERROR;
    }

    static void closeSendFileInfo(Uri uri) {
        if (D) Log.d(TAG, "closeSendFileInfo: uri=" + uri);
        BluetoothOppSendFileInfo info = sSendFileMap.remove(uri);
        if (info != null && info.mInputStream != null) {
    static void closeSendFileInfo(Uri uri, BluetoothOppSendFileInfo sendFileInfo) {
        if (D) Log.d(TAG, "closeSendFileInfo: uri=" + uri + "sendFileInfo: " + sendFileInfo);
        boolean removed = sSendFileMap.remove(uri, sendFileInfo);
        if (removed && sendFileInfo != null && sendFileInfo.mInputStream != null) {
            try {
                info.mInputStream.close();
                sendFileInfo.mInputStream.close();
            } catch (IOException ignored) {
            }
        }