NPE in BluetoothSocket.write()
NPE in BluetoothSocket.write()

If calling connect succeed, we should not see this NPE.
An IOException may happen after call BluetoothSocket.connect.
If you still call write after the IOException,
you will get this NPE.
add NPE protection for possible wrong calling sequence from application,
To make bluetoothSocket more error-tolerant.

bug:12104154
Change-Id: I7fa4e847b500ca9b9d2a43df432f31a1bb016c0a

xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base