Merge "OPP: Fix "0%" progress even after file transfer finished"
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index 1688c70..f57147d 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -416,6 +416,13 @@
 
                         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;