Fixed packet size in MyTagClient.

The packet was always sized to MIU instead of actual buffer size.

Change-Id: Iaf2fbd1cddf07a95e95a8dd69323d62dca8e6a2c
diff --git a/src/com/android/nfc/mytag/MyTagClient.java b/src/com/android/nfc/mytag/MyTagClient.java
index b42fb99..15d850c 100755
--- a/src/com/android/nfc/mytag/MyTagClient.java
+++ b/src/com/android/nfc/mytag/MyTagClient.java
@@ -71,7 +71,6 @@
             NfcService service = NfcService.getInstance();
             NdefMessage msg = msgs[0];
             byte[] buffer = msg.toByteArray();
-            byte[] tmpBuffer = new byte[MIU];
             int offset = 0;
             try {
                 if (DBG) Log.d(TAG, "about to create socket");
@@ -84,9 +83,10 @@
                 if (DBG) Log.d(TAG, "about to send a " + buffer.length + "-bytes message");
                 while (offset < buffer.length) {
                     int length = buffer.length - offset;
-                    if (length > tmpBuffer.length) {
-                        length = tmpBuffer.length;
+                    if (length > MIU) {
+                        length = MIU;
                     }
+                    byte[] tmpBuffer = new byte[length];
                     System.arraycopy(buffer, offset, tmpBuffer, 0, length);
                     if (DBG) Log.d(TAG, "about to send a " + length + "-bytes packet");
                     sock.send(tmpBuffer);