summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorMike Playle <mike.playle@realvnc.com>2010-10-22 13:58:17 +0100
committerMike Playle <mike.playle@realvnc.com>2011-04-04 08:56:22 +0100
commit36aa8839d5509d12323a6025329d6913cbaa353b (patch)
tree1aadc4aa7325748ae1e8d42cf29d449bfb290dbe /policy
parentc6b22e2727bd3730edd5ad72831a9bb4670d00f3 (diff)
downloadframeworks_base-36aa8839d5509d12323a6025329d6913cbaa353b.zip
frameworks_base-36aa8839d5509d12323a6025329d6913cbaa353b.tar.gz
frameworks_base-36aa8839d5509d12323a6025329d6913cbaa353b.tar.bz2
Fix data corruption when writing to Bluetooth socket
Writes to Bluetooth sockets are handled by writeNative() in android_bluetooth_BluetoothSocket.cpp. This calls asocket_write() which is implemented in abort_socket.c. This latter function sleeps until poll() indicates that the socket is writeable, then calls write() once, returning the number of bytes written. However writeNative() just returns this byte count to the caller; it's eventually ignored in BluetoothOutputStream.java. This doesn't match the semantics of a Java OutputStream, which is required to block until all bytes have been written. This fix adds a loop to writeNative() that repeatedly calls the lower level write function until all the data has been written (or an error occurred in which case we should exit the loop early). With this change it is possible to write large amounts of data to a Bluetooth socket without experiencing data loss. Change-Id: I0b464382817e15adec32ba0e3cb37e7d1cccc730
Diffstat (limited to 'policy')
0 files changed, 0 insertions, 0 deletions