Prevent OPP connections from staying open forever

OPP connections could possibly stay open forever if no response to
the put request is received after transfering very small files. Fixed
by waiting to clear the timeout message until after the response is
received.

Bug: 30645605
Change-Id: I0743685e98e74195b99eff7012dc8c8044c425ca
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index 1688c70..1b431f9 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -415,13 +415,13 @@
                         outputStream.write(buffer, 0, readLength);
 
                         position += readLength;
+                        /* check remote accept or reject */
+                        responseCode = putOperation.getResponseCode();
 
                         mCallback.removeMessages(BluetoothOppObexSession.MSG_CONNECT_TIMEOUT);
                         synchronized (this) {
                             mWaitingForRemote = false;
                         }
-                        /* check remote accept or reject */
-                        responseCode = putOperation.getResponseCode();
 
                         if (responseCode == ResponseCodes.OBEX_HTTP_CONTINUE
                                 || responseCode == ResponseCodes.OBEX_HTTP_OK) {
@@ -497,7 +497,7 @@
             } finally {
                 try {
                     if (outputStream != null) {
-                      outputStream.close();
+                        outputStream.close();
                     }
 
                     // Close InputStream and remove SendFileInfo from map