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

Commit 4b746205 authored by Shuki Hashimoto's avatar Shuki Hashimoto Committed by Andre Eisenbach
Browse files

OPP: Fix "0%" progress even after file transfer finished

When the file is small enough to be sent together with header in one
packet, PrivateOutputStream#write() never calls back ClientOperation,
because OBEX Client has no more data to send.
In this case, response code in ClientOperation is not updated from
default value (-1) until the PrivateOutputStream is closed.
It causes progress bar not updated from 0%.

The patch adds PrivateOutputStream#close() call after the first write
operation when file and header are sent in one packet, and ensures
progress bar to be updated properly.

Bug: 31895670
Test: manual

Change-Id: I735a872b756ab1c8892c2f8bbf2dce51ae24fc5a
parent a4d91e72
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -416,6 +416,13 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {

                        position += readLength;

                        if (position == fileInfo.mLength) {
                            // if file length is smaller than buffer size, only one packet
                            // so block point is here
                            outputStream.close();
                            outputStream = null;
                        }

                        mCallback.removeMessages(BluetoothOppObexSession.MSG_CONNECT_TIMEOUT);
                        synchronized (this) {
                            mWaitingForRemote = false;