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
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;